如何为“每个问题”制作“紫色模板”?

如何为“每个问题”制作“紫色模板”?

我在 tex.stackexchange 页面上找到了这个模板。

我不希望页面样式发生改变,

我还有 1 个请求:

  1. 我想转到没有的页面的另一边\\[1cm]在此处输入图片描述
\documentclass[a4paper]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{multicol}
\usepackage{lastpage}
\usepackage{fancyhdr}
\pagestyle{fancy}
% 
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[O]{\textsc{}~\thepage/\pageref{LastPage}}
% 
\newcounter{numex}
% 
\def\thrulefill{\leavevmode\leaders\hrule height 0.5ex depth \dimexpr2pt-0.7ex\hfill\kern0pt}
\setlength{\columnsep}{1.2cm}
% 
\newcommand\Startex{%
\stepcounter{numex}
\begin{center}
\textsc\thrulefill~{\bfseries Question~\thenumex)}~\thrulefill
\end{center}}
%
\begin{document}
%
\begin{multicols*}{2}
\Startex
\begin{equation}
\label{eq:solve}
x^2-5x+6 = 0
\end{equation}
\begin{equation}
x_1=\frac{5+\sqrt{25-4\times6}}{2} = 3
\end{equation}
\begin{equation}
x_2=\frac{5-\sqrt{25-4\times6}}{2} =2
\end{equation}
and so we have solved equation \ref{eq:solve}\\[1cm]
% 
\Startex
\begin{equation}
\label{eq:solve}
x^2-5x+6 = 0
\end{equation}
\begin{equation}
x_1=\frac{5+\sqrt{25-4\times6}}{2} = 3
\end{equation}
\begin{equation}
x_2=\frac{5-\sqrt{25-4\times6}}{2} =2
\end{equation}
and so we have solved equation \ref{eq:solve}\\[1cm]
% 
\Startex
\begin{equation}
\label{eq:solve}
x^2-5x+6 = 0
\end{equation}
\begin{equation}
x_1=\frac{5+\sqrt{25-4\times6}}{2} = 3
\end{equation}
\begin{equation}
x_2=\frac{5-\sqrt{25-4\times6}}{2} =2
\end{equation}
and so we have solved equation \ref{eq:solve}
% 
\end{multicols*}
\end{document}

在此处输入图片描述

答案1

这些能满足您的需要吗?

\documentclass[a4paper]{article}
\usepackage[most]{tcolorbox}
\usepackage{refcount}
\usepackage[margin=1.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{multicol}
\usepackage{lastpage}
%\usepackage{hyperref}
\usepackage{fancyhdr}
\pagestyle{fancy}
% 
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[O]{\textsc{}~\thepage/\pageref{LastPage}}
% 
\newcounter{numex}
\newcommand\equationnumberoffset{0}%
\makeatletter
\newcommand\setequationnumberoffset[1]{%
  \edef\equationnumberoffset{\number\numexpr#1\relax}%
}%
\renewcommand\theequation{\@arabic{\number\numexpr\c@equation-\equationnumberoffset\relax}}%
\newcommand\MyBox[1]{%
  \begingroup
  \edef\equationnumberoffset{\number\value{equation}}%
  \renewcommand\theequation{\arabic{numex}.\@arabic{\number\numexpr\c@equation-\equationnumberoffset\relax}}%
  \stepcounter{numex}%
  \begin{tcolorbox}[enhanced,title=Question~\thenumex,
  attach boxed title to top left={xshift=5mm,yshift=-3.75mm},
  boxed title style={size=normal,colframe=blue, colback=blue!10, boxsep=0mm},
  colframe=blue, colback=white, coltitle=black, top=5.5mm]
  #1%
  \end{tcolorbox}%
  \endgroup
}%
\makeatother
% 
\setlength{\columnsep}{1.2cm}
\setlength\columnseprule{.4pt}
% 

\begin{document}
%
\begin{multicols*}{2}

\MyBox{%
  \begin{equation}
  \label{eq:solveA}
  x^2-5x+6 = 0
  \end{equation}
  \begin{equation}
  x_1=\frac{5+\sqrt{25-4\times6}}{2} = 3
  \end{equation}
  \begin{equation}
  x_2=\frac{5-\sqrt{25-4\times6}}{2} =2
  \end{equation}
  \par
  \begingroup\centering and so we have solved equation \ref{eq:solveA}\par\endgroup
}

\MyBox{%
  \begin{equation}
  \label{eq:solveB}
  x^2-5x+6 = 0
  \end{equation}
  \begin{equation}
  x_1=\frac{5+\sqrt{25-4\times6}}{2} = 3
  \end{equation}
  \begin{equation}
   x_2=\frac{5-\sqrt{25-4\times6}}{2} =2
  \end{equation}
  \par\centering
  \begingroup\centering and so we have solved equation \ref{eq:solveB}\par\endgroup
}

\MyBox{%
  \begin{equation}
  \label{eq:solveC}
  x^2-5x+6 = 0
  \end{equation}
  \begin{equation}
  x_1=\frac{5+\sqrt{25-4\times6}}{2} = 3
  \end{equation}
  \begin{equation}
  x_2=\frac{5-\sqrt{25-4\times6}}{2} =2
  \end{equation}
  \par\centering
  \begingroup\centering and so we have solved equation \ref{eq:solveC}\par\endgroup
} 

\MyBox{%
  \begin{equation}
  \label{eq:solveD}
  x^2-5x+6 = 0
  \end{equation}
  \begin{equation}
  x_1=\frac{5+\sqrt{25-4\times6}}{2} = 3
  \end{equation}
  \begin{equation}
  x_2=\frac{5-\sqrt{25-4\times6}}{2} =2
  \end{equation}
  \par\centering
  \begingroup\centering and so we have solved equation \ref{eq:solveD}\par\endgroup
}

\MyBox{%
  \begin{equation}
  \label{eq:solveE}
  x^2-5x+6 = 0
  \end{equation}
  \begin{equation}
  x_1=\frac{5+\sqrt{25-4\times6}}{2} = 3
  \end{equation}
  \begin{equation}
   x_2=\frac{5-\sqrt{25-4\times6}}{2} =2
  \end{equation}
  \par\centering
  \begingroup\centering and so we have solved equation \ref{eq:solveE}\par\endgroup
}

\MyBox{%
  \begin{equation}
  \label{eq:solveF}
  x^2-5x+6 = 0
  \end{equation}
  \begin{equation}
  x_1=\frac{5+\sqrt{25-4\times6}}{2} = 3
  \end{equation}
  \begin{equation}
  x_2=\frac{5-\sqrt{25-4\times6}}{2} =2
  \end{equation}
  \par\centering
  \begingroup\centering and so we have solved equation \ref{eq:solveF}\par\endgroup
} 

\end{multicols*}

\noindent A \hfill B

% We have 18 equations but want to continue with equation number 7
\setequationnumberoffset{12}

\begin{equation}
\sum_{k=1}^{n}{k^2}=\frac{n(n+1)(2n+1)}{6}
\end{equation}

\end{document}

在此处输入图片描述

在此处输入图片描述



\documentclass[a4paper]{article}
\usepackage[most]{tcolorbox}
\usepackage[margin=1.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{lastpage}
%\usepackage{hyperref}
\usepackage{tabularx}
\usepackage{fancyhdr}
\pagestyle{fancy}
% 
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[O]{\textsc{}~\thepage/\pageref{LastPage}}
% 
\newcounter{numex}
\newcommand\equationnumberoffset{0}%
\makeatletter
\newcommand\setequationnumberoffset[1]{%
  \edef\equationnumberoffset{\number\numexpr#1\relax}%
}%
\renewcommand\theequation{\@arabic{\number\numexpr\c@equation-\equationnumberoffset\relax}}%
\newcommand\MyBox[1]{%
  \begingroup
  \edef\equationnumberoffset{\number\value{equation}}%
  \renewcommand\theequation{\arabic{numex}.\@arabic{\number\numexpr\c@equation-\equationnumberoffset\relax}}%
  \stepcounter{numex}%
  \begin{tcolorbox}[enhanced,title=Question~\thenumex,
  attach boxed title to top left={xshift=5mm,yshift=-3.75mm},
  boxed title style={size=normal,colframe=blue, colback=blue!10, boxsep=0mm},
  colframe=blue, colback=white, coltitle=black, top=5.5mm]
  #1%
  \end{tcolorbox}%
  \endgroup
}%
\makeatother


\begin{document}

\tabcolsep=.5\dimexpr1.2cm-\arrayrulewidth\relax

\noindent\begin{tabularx}{\textwidth}{@{}X|X@{}}
\MyBox{%
  \begin{equation}
  \label{eq:solveA}
  x^2-5x+6 = 0
  \end{equation}
  \begin{equation}
  x_1=\frac{5+\sqrt{25-4\times6}}{2} = 3
  \end{equation}
  \begin{equation}
  x_2=\frac{5-\sqrt{25-4\times6}}{2} =2
  \end{equation}
  \par
  \begingroup\centering and so we have solved equation \ref{eq:solveA}\par\endgroup
}
&
\MyBox{%
  \begin{equation}
  \label{eq:solveB}
  x^2-5x+6 = 0
  \end{equation}
  \begin{equation}
  x_1=\frac{5+\sqrt{25-4\times6}}{2} = 3
  \end{equation}
  \begin{equation}
   x_2=\frac{5-\sqrt{25-4\times6}}{2} =2
  \end{equation}
  \par\centering
  \begingroup\centering and so we have solved equation \ref{eq:solveB}\par\endgroup
}
\\[.5cm]
\end{tabularx}
\vskip-\lineskip
\noindent\begin{tabularx}{\textwidth}{@{}X|X@{}}
\MyBox{%
  \begin{equation}
  \label{eq:solveC}
  x^2-5x+6 = 0
  \end{equation}
  \begin{equation}
  x_1=\frac{5+\sqrt{25-4\times6}}{2} = 3
  \end{equation}
  \begin{equation}
  x_2=\frac{5-\sqrt{25-4\times6}}{2} =2
  \end{equation}
  \par\centering
  \begingroup\centering and so we have solved equation \ref{eq:solveC}\par\endgroup
} 
&
\MyBox{%
  \begin{equation}
  \label{eq:solveD}
  x^2-5x+6 = 0
  \end{equation}
  \begin{equation}
  x_1=\frac{5+\sqrt{25-4\times6}}{2} = 3
  \end{equation}
  \begin{equation}
  x_2=\frac{5-\sqrt{25-4\times6}}{2} =2
  \end{equation}
  \par\centering
  \begingroup\centering and so we have solved equation \ref{eq:solveD}\par\endgroup
}
\\[.5cm]
\end{tabularx}
\vskip-\lineskip
\noindent\begin{tabularx}{\textwidth}{@{}X|X@{}}
\MyBox{%
  \begin{equation}
  \label{eq:solveE}
  x^2-5x+6 = 0
  \end{equation}
  \begin{equation}
  x_1=\frac{5+\sqrt{25-4\times6}}{2} = 3
  \end{equation}
  \begin{equation}
   x_2=\frac{5-\sqrt{25-4\times6}}{2} =2
  \end{equation}
  \par\centering
  \begingroup\centering and so we have solved equation \ref{eq:solveE}\par\endgroup
}
&
\MyBox{%
  \begin{equation}
  \label{eq:solveF}
  x^2-5x+6 = 0
  \end{equation}
  \begin{equation}
  x_1=\frac{5+\sqrt{25-4\times6}}{2} = 3
  \end{equation}
  \begin{equation}
  x_2=\frac{5-\sqrt{25-4\times6}}{2} =2
  \end{equation}
  \par\centering
  \begingroup\centering and so we have solved equation \ref{eq:solveF}\par\endgroup
} 
\end{tabularx}

\noindent A \hfill B

% We have 18 equations but want to continue with equation number 7
\setequationnumberoffset{12}

\begin{equation}
\sum_{k=1}^{n}{k^2}=\frac{n(n+1)(2n+1)}{6}
\end{equation}

\end{document}

在此处输入图片描述

相关内容