summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xsim/examples/xsim.texsx-369065.tex
blob: f35149c8ea14747bd7b7fa6bc8c130767d76c45f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
% https://tex.stackexchange.com/q/369065/
\documentclass{article}
\usepackage{xsim,tcolorbox,needspace}

\xsimsetup{
  exercise/within=section ,
  exercise/the-counter = \thesection.\arabic{exercise} ,
  exercise/template=cyan-box ,
  exercise/name=Example ,
  solution/template=red ,
  solution/print=true
}

\DeclareExerciseEnvironmentTemplate{cyan-box}{%
  \begin{tcolorbox}[arc=0mm,boxrule=1pt,colback=white,colframe=cyan,leftrule=3mm]
    \textsf{%
      \MakeUppercase{%
        \XSIMmixedcase{\GetExerciseName}~\GetExerciseProperty{counter}%
      }%
    }%
    \GetExercisePropertyT{subtitle}{ \textit{#1}}%
    \quad
}{\end{tcolorbox}}

\DeclareExerciseEnvironmentTemplate{red}{%
  \par
  \Needspace*{2\baselineskip}
  \noindent
  \textsf{\textcolor{red}{\MakeUppercase{\XSIMmixedcase{\GetExerciseName}}}}%
  \quad
}{\par\bigskip}

\begin{document}

\section{My first set of exercises}
\begin{exercise}
  Prove that $\frac{1}{2}\Delta(f_{ij}f^{ij})
  =\nabla^{k}f^{ij}+f^{ij}f^{k}[2\nabla_{i}R_{jk}-\nabla_{k}R_{ij}]$
\end{exercise}
\begin{solution}
  From \dots
\end{solution}

\begin{exercise}
  Prove that Paulinho is smart.
\end{exercise}
\begin{solution}
  All ducks are smart. Paulinho is a duck. Therefore, Paulinho is smart.
\end{solution}

\begin{exercise}
  Prove that Paulinho is smart.
\end{exercise}
\begin{solution}
  All ducks are smart. Paulinho is a duck. Therefore, Paulinho is smart.
\end{solution}

\section{My second set of exercises}
\begin{exercise}
  Prove that Paulinho is smart.
\end{exercise}
\begin{solution}
  All ducks are smart. Paulinho is a duck. Therefore, Paulinho is smart.
\end{solution}

\begin{exercise}
  Prove that Paulinho is smart.
\end{exercise}
\begin{solution}
  All ducks are smart. Paulinho is a duck. Therefore, Paulinho is smart.
\end{solution}

\end{document}