| 1 |
% https://tex.stackexchange.com/q/369065/ |
| 2 |
\documentclass{article} |
| 3 |
\usepackage{xsim,tcolorbox,needspace} |
| 4 |
|
| 5 |
\xsimsetup{ |
| 6 |
exercise/within=section , |
| 7 |
exercise/the-counter = \thesection.\arabic{exercise} , |
| 8 |
exercise/template=cyan-box , |
| 9 |
exercise/name=Example , |
| 10 |
solution/template=red , |
| 11 |
solution/print=true |
| 12 |
} |
| 13 |
|
| 14 |
\DeclareExerciseEnvironmentTemplate{cyan-box}{% |
| 15 |
\begin{tcolorbox}[arc=0mm,boxrule=1pt,colback=white,colframe=cyan,leftrule=3mm] |
| 16 |
\textsf{% |
| 17 |
\MakeUppercase{% |
| 18 |
\XSIMmixedcase{\GetExerciseName}~\GetExerciseProperty{counter}% |
| 19 |
}% |
| 20 |
}% |
| 21 |
\GetExercisePropertyT{subtitle}{ \textit{#1}}% |
| 22 |
\quad |
| 23 |
}{\end{tcolorbox}} |
| 24 |
|
| 25 |
\DeclareExerciseEnvironmentTemplate{red}{% |
| 26 |
\par |
| 27 |
\Needspace*{2\baselineskip} |
| 28 |
\noindent |
| 29 |
\textsf{\textcolor{red}{\MakeUppercase{\XSIMmixedcase{\GetExerciseName}}}}% |
| 30 |
\quad |
| 31 |
}{\par\bigskip} |
| 32 |
|
| 33 |
\begin{document} |
| 34 |
|
| 35 |
\section{My first set of exercises} |
| 36 |
\begin{exercise} |
| 37 |
Prove that $\frac{1}{2}\Delta(f_{ij}f^{ij}) |
| 38 |
=\nabla^{k}f^{ij}+f^{ij}f^{k}[2\nabla_{i}R_{jk}-\nabla_{k}R_{ij}]$ |
| 39 |
\end{exercise} |
| 40 |
\begin{solution} |
| 41 |
From \dots |
| 42 |
\end{solution} |
| 43 |
|
| 44 |
\begin{exercise} |
| 45 |
Prove that Paulinho is smart. |
| 46 |
\end{exercise} |
| 47 |
\begin{solution} |
| 48 |
All ducks are smart. Paulinho is a duck. Therefore, Paulinho is smart. |
| 49 |
\end{solution} |
| 50 |
|
| 51 |
\begin{exercise} |
| 52 |
Prove that Paulinho is smart. |
| 53 |
\end{exercise} |
| 54 |
\begin{solution} |
| 55 |
All ducks are smart. Paulinho is a duck. Therefore, Paulinho is smart. |
| 56 |
\end{solution} |
| 57 |
|
| 58 |
\section{My second set of exercises} |
| 59 |
\begin{exercise} |
| 60 |
Prove that Paulinho is smart. |
| 61 |
\end{exercise} |
| 62 |
\begin{solution} |
| 63 |
All ducks are smart. Paulinho is a duck. Therefore, Paulinho is smart. |
| 64 |
\end{solution} |
| 65 |
|
| 66 |
\begin{exercise} |
| 67 |
Prove that Paulinho is smart. |
| 68 |
\end{exercise} |
| 69 |
\begin{solution} |
| 70 |
All ducks are smart. Paulinho is a duck. Therefore, Paulinho is smart. |
| 71 |
\end{solution} |
| 72 |
|
| 73 |
\end{document} |