summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/homework
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-10-01 03:01:18 +0000
committerNorbert Preining <norbert@preining.info>2023-10-01 03:01:18 +0000
commit8a05034cb5d7ae61b2de6857258caa3e43b496aa (patch)
treeb9c266e7f98a034ed060178b3c0c162598e68948 /macros/latex/contrib/homework
parent61bc2520e547446bddedc290572684496c9347a0 (diff)
CTAN sync 202310010301
Diffstat (limited to 'macros/latex/contrib/homework')
-rw-r--r--macros/latex/contrib/homework/README.md49
-rw-r--r--macros/latex/contrib/homework/homework-demo-cn.pdfbin83711 -> 83733 bytes
-rw-r--r--macros/latex/contrib/homework/homework-demo-cn.tex9
-rw-r--r--macros/latex/contrib/homework/homework-demo-de.pdfbin52262 -> 52415 bytes
-rw-r--r--macros/latex/contrib/homework/homework-demo-de.tex7
-rw-r--r--macros/latex/contrib/homework/homework-demo-en.pdfbin50985 -> 51164 bytes
-rw-r--r--macros/latex/contrib/homework/homework-demo-en.tex6
-rw-r--r--macros/latex/contrib/homework/homework-demo-es.pdfbin51505 -> 51652 bytes
-rw-r--r--macros/latex/contrib/homework/homework-demo-es.tex18
-rw-r--r--macros/latex/contrib/homework/homework-demo-fr.pdfbin51376 -> 51535 bytes
-rw-r--r--macros/latex/contrib/homework/homework-demo-fr.tex7
-rw-r--r--macros/latex/contrib/homework/homework-demo-jp.pdfbin86676 -> 86926 bytes
-rw-r--r--macros/latex/contrib/homework/homework-demo-jp.tex7
-rw-r--r--macros/latex/contrib/homework/homework-demo-tc.pdfbin90595 -> 90633 bytes
-rw-r--r--macros/latex/contrib/homework/homework-demo-tc.tex9
-rw-r--r--macros/latex/contrib/homework/homework-example-sheet-answer.pdfbin0 -> 30090 bytes
-rw-r--r--macros/latex/contrib/homework/homework-example-sheet.pdfbin0 -> 21936 bytes
-rw-r--r--macros/latex/contrib/homework/homework-example-sheet.tex126
-rw-r--r--macros/latex/contrib/homework/homework.cls180
19 files changed, 348 insertions, 70 deletions
diff --git a/macros/latex/contrib/homework/README.md b/macros/latex/contrib/homework/README.md
index 28cdf8b29a..57da7f2d66 100644
--- a/macros/latex/contrib/homework/README.md
+++ b/macros/latex/contrib/homework/README.md
@@ -40,12 +40,13 @@ A typical homework document looks like this:
```latex
\documentclass[a4paper, 11pt,
- logo = {image-file-of-your-university-logo}, % Remove this line if you don't want logo presented.
- % logo height = 1cm, % In case you are not satisfied with the default logo size.
+ logo = {image-of-university-logo}, % Remove this line if you don't want logo presented.
+ % logo height = 1cm, % In case you are not satisfied with the default logo size.
title in boldface,
title in sffamily,
theorem in new line,
- % twoside,
+ % twoside, % Use this option if you wish to use double-sided printing
+ % hide solution, % Use this option to hide the solutions/answers
]{homework}
\UseLanguage{...} % If you wish to write your homework in languages other than English.
@@ -135,16 +136,54 @@ A typical homework document looks like this:
\end{document}
```
+Alternatively, if you are making an exercise sheet and prefer a more formal title style, you may write the title part as:
+```latex
+\documentclass[a4paper,
+ formal title,
+ title in boldface,
+ % hide solution, % Use this option to hide the solutions/answers
+]{homework}
+
+
+% EDIT THE FOLLOWING INFORMATION AS NEEDED
+
+\pretitle{%
+ \scshape
+ The University
+ \hfill
+ The Program \& Level
+ \\
+ Course ID \& Course Name
+ \hfill
+ Year 2023--24
+}
+
+\title{%
+ Sheet 1. Title of the current file
+}
+\author{}
+\date{%
+ % \TheDate{2023-12-25}
+}
+
+
+\begin{document}
+ ...
+\end{document}
+```
+
> You may refer to the demo documents for more examples.
Regarding some of the class options:
-1) The logo image can be included via the class option `logo = {⟨image file name⟩}`, and if you are not satisfied with its default size, then you may manually specify the size via the option `logo height = {⟨height⟩}`. If you do not want to show any logo in the title bar, you may simply remove the option `logo = {⟨image file name⟩}`.
+1) The logo image can be included via the class option `logo = {⟨image file name⟩}`, and if you are not satisfied with its default size, then you may manually specify the size via the option `logo height = {⟨height⟩}` or `logo width = {width}`. If you do not want to show any logo in the title bar, you may simply remove the option `logo = {⟨image file name⟩}`.
1) The options `title in boldface`, `title in sffamily` or even `title in scshape` are for configuring the text effect of the title line, the sectional titles and theorem names.
1) The option `theorem in new line` is for showing the problem / theorem name, numbering and description in a separate line, for the sake of clarity.
1) The option `twoside` is for double-sided printing.
+1) The option `formal title` is for enabling the formal title style.
+1) The option `hide solution` (or `hide answer`) is for hiding the `solution` and `answer` environments.
A few extra remarks:
-1) `\title`, `\author` and `\date` should be placed before `\begin{document}`.
+1) `\title`, `\author` and `\date`, etc. should be placed before `\begin{document}`.
1) Since the problem, solution and other theorem-type environments have a Q.E.D. symbol at the end, if your text ends with a displayed equation or a `itemize`/`enumerate`/`description` list, then you would need to add a `\qedhere` so that the Q.E.D. symbol is placed in the right place. There are also `\proofless` and `\noQED` for controlling the Q.E.D. symbol, see the demo documents for their usage.
1) Every theorem-type environment has a starred unnumbered version, for instance, `claim*` for unnumbered `claim`, `lemma*` for unnumbered `lemma`, etc.
1) It is recommended to use clever reference, such as `\cref`, `\Cref` and `\namecref`, etc. For languages such as French and German, to ensure that the generated referencing text is grammatically correct, you may write the definite article and/or declension as optional argument for the referencing commands, for instance, `\cref[à]{⟨label⟩}` or `\cref[de]{⟨label⟩}` for French, `\cref[nom.]{⟨label⟩}` or `\cref[von,dat.]{⟨label⟩}` for German, etc.
diff --git a/macros/latex/contrib/homework/homework-demo-cn.pdf b/macros/latex/contrib/homework/homework-demo-cn.pdf
index cab3b09986..6236b301e1 100644
--- a/macros/latex/contrib/homework/homework-demo-cn.pdf
+++ b/macros/latex/contrib/homework/homework-demo-cn.pdf
Binary files differ
diff --git a/macros/latex/contrib/homework/homework-demo-cn.tex b/macros/latex/contrib/homework/homework-demo-cn.tex
index 44bc036e2c..79f28d7860 100644
--- a/macros/latex/contrib/homework/homework-demo-cn.tex
+++ b/macros/latex/contrib/homework/homework-demo-cn.tex
@@ -1,6 +1,6 @@
\documentclass[11pt,
logo = {example-image},
- % logo height = 1cm,
+ % logo height = 1cm, % logo width = 2cm,
title in boldface,
% title in sffamily,
theorem in new line,
@@ -27,7 +27,7 @@
\begin{document}
-\bigskip\textcolor{gray!55}{(如果你打算直接写出解答…)}
+\textcolor{gray!55}{(如果你打算直接写出解答…)}
\begin{problem}
这里是解答/证明。
@@ -73,7 +73,10 @@
\end{answer}
-\bigskip\textcolor{gray!55}{(如果你更喜欢传统的证明样式…)}
+\enlargethispage*{3\baselineskip}
+
+
+\bigskip\textcolor{gray!55}{(或者如果你更喜欢传统的证明样式…)}
\begin{proof}
\verb|proof| 环境依然可用。
diff --git a/macros/latex/contrib/homework/homework-demo-de.pdf b/macros/latex/contrib/homework/homework-demo-de.pdf
index dc4051f0bb..03ea38e7e0 100644
--- a/macros/latex/contrib/homework/homework-demo-de.pdf
+++ b/macros/latex/contrib/homework/homework-demo-de.pdf
Binary files differ
diff --git a/macros/latex/contrib/homework/homework-demo-de.tex b/macros/latex/contrib/homework/homework-demo-de.tex
index d81f2cc5a6..09c3c123e6 100644
--- a/macros/latex/contrib/homework/homework-demo-de.tex
+++ b/macros/latex/contrib/homework/homework-demo-de.tex
@@ -1,6 +1,6 @@
\documentclass[11pt,
logo = {example-image},
- % logo height = 1cm,
+ % logo height = 1cm, % logo width = 2cm,
title in boldface,
% title in sffamily,
theorem in new line,
@@ -27,7 +27,7 @@
\begin{document}
-\bigskip\textcolor{gray!55}{(Wenn Sie die Antwort direkt schreiben möchten ...)}
+\textcolor{gray!55}{(Wenn Sie die Antwort direkt schreiben möchten ...)}
\begin{problem}
Hier liegt die Lösung / der Beweis.
@@ -73,6 +73,9 @@
\end{answer}
+\enlargethispage*{3\baselineskip}
+
+
\bigskip\textcolor{gray!55}{(Wenn Sie den klassischen Proof-Stil bevorzugen ...)}
\begin{proof}
diff --git a/macros/latex/contrib/homework/homework-demo-en.pdf b/macros/latex/contrib/homework/homework-demo-en.pdf
index 5d0834762c..ebd75dba40 100644
--- a/macros/latex/contrib/homework/homework-demo-en.pdf
+++ b/macros/latex/contrib/homework/homework-demo-en.pdf
Binary files differ
diff --git a/macros/latex/contrib/homework/homework-demo-en.tex b/macros/latex/contrib/homework/homework-demo-en.tex
index 40585d77ef..a4840d2948 100644
--- a/macros/latex/contrib/homework/homework-demo-en.tex
+++ b/macros/latex/contrib/homework/homework-demo-en.tex
@@ -1,6 +1,6 @@
\documentclass[11pt,
logo = {example-image},
- % logo height = 1cm,
+ % logo height = 1cm, % logo width = 2cm,
title in boldface,
% title in sffamily,
theorem in new line,
@@ -24,7 +24,7 @@
\begin{document}
-\bigskip\textcolor{gray!55}{(If you wish to write the answer directly...)}
+\textcolor{gray!55}{(If you wish to write the answer directly...)}
\begin{problem}
Here lies the solution / proof.
@@ -70,7 +70,7 @@
\end{answer}
-\pagebreak
+\enlargethispage*{\baselineskip}
\bigskip\textcolor{gray!55}{(If you prefer the classical proof style...)}
diff --git a/macros/latex/contrib/homework/homework-demo-es.pdf b/macros/latex/contrib/homework/homework-demo-es.pdf
index 3dd42d5e30..530d8b016f 100644
--- a/macros/latex/contrib/homework/homework-demo-es.pdf
+++ b/macros/latex/contrib/homework/homework-demo-es.pdf
Binary files differ
diff --git a/macros/latex/contrib/homework/homework-demo-es.tex b/macros/latex/contrib/homework/homework-demo-es.tex
index d73a1207c2..63ded1fe95 100644
--- a/macros/latex/contrib/homework/homework-demo-es.tex
+++ b/macros/latex/contrib/homework/homework-demo-es.tex
@@ -1,6 +1,6 @@
\documentclass[11pt,
logo = {example-image},
- % logo height = 1cm,
+ % logo height = 1cm, % logo width = 2cm,
title in boldface,
% title in sffamily,
theorem in new line,
@@ -27,7 +27,7 @@
\begin{document}
-\bigskip\textcolor{gray!55}{(Si desea escribir la respuesta directamente...)}
+\textcolor{gray!55}{(Si desea escribir la respuesta directamente...)}
\begin{problem}
Aquí está la solución / la prueba.
@@ -37,7 +37,7 @@
\bigskip\textcolor{gray!55}{(Si desea plantear el problema y luego escribir su respuesta...)}
\begin{problem}[Breve descripción]
- También puedes plantear el problema aquí...
+ También puede plantear el problema aquí...
\end{problem}
\begin{solution}
@@ -48,7 +48,7 @@
\begin{solution}[Prueba]
... o una prueba como ésta...
- \begin{lemma}[Puedes escribir alguna descripción aquí]\label{lem}
+ \begin{lemma}[Puede escribir alguna descripción aquí]\label{lem}
Algún resultado auxiliar.
\end{lemma}
\begin{proof}
@@ -62,21 +62,21 @@
\proofless
Utilice \cverb|\proofless| para cambiar la caja hueca que marca el final de un entorno de tipo teorema en una caja sólida.
\end{fact}
- ... y el resto pasos...
+ ... y el resto de pasos...
\end{solution}
-\bigskip\textcolor{gray!55}{(También puedes escribir \texttt{answer} en lugar de \texttt{solution} si lo deseas...)}
+\bigskip\textcolor{gray!55}{(También puede escribir \texttt{answer} en lugar de \texttt{solution} si lo deseas...)}
\begin{answer}
El uso del entorno \verb|answer| es exactamente lo mismo que \verb|solution|.
\end{answer}
-\pagebreak
+\enlargethispage*{\baselineskip}
-\bigskip\textcolor{gray!55}{(Si prefieres el estilo clásico de prueba...)}
+\bigskip\textcolor{gray!55}{(Si prefiere el estilo clásico de prueba...)}
\begin{proof}
El entorno habitual de \verb|proof| también funciona.
@@ -122,7 +122,7 @@
\end{problem}
-\bigskip\textcolor{gray!55}{(Si hay alguna pregunta que no sabes cómo resolver en este momento...)}
+\bigskip\textcolor{gray!55}{(Si hay una pregunta que no sabe cómo resolver en este momento...)}
\DNF<alguna descripción>
diff --git a/macros/latex/contrib/homework/homework-demo-fr.pdf b/macros/latex/contrib/homework/homework-demo-fr.pdf
index eff533c39e..b98eed2126 100644
--- a/macros/latex/contrib/homework/homework-demo-fr.pdf
+++ b/macros/latex/contrib/homework/homework-demo-fr.pdf
Binary files differ
diff --git a/macros/latex/contrib/homework/homework-demo-fr.tex b/macros/latex/contrib/homework/homework-demo-fr.tex
index 9c90e8b261..b8394edda5 100644
--- a/macros/latex/contrib/homework/homework-demo-fr.tex
+++ b/macros/latex/contrib/homework/homework-demo-fr.tex
@@ -1,6 +1,6 @@
\documentclass[11pt,
logo = {example-image},
- % logo height = 1cm,
+ % logo height = 1cm, % logo width = 2cm,
title in boldface,
% title in sffamily,
theorem in new line,
@@ -27,7 +27,7 @@
\begin{document}
-\bigskip\textcolor{gray!55}{(Si vous souhaitez écrire la réponse directement...)}
+\textcolor{gray!55}{(Si vous souhaitez écrire la réponse directement...)}
\begin{problem}
Voici la solution / la preuve.
@@ -73,6 +73,9 @@
\end{answer}
+\enlargethispage*{2\baselineskip}
+
+
\bigskip\textcolor{gray!55}{(Si vous préférez le style classique...)}
\begin{proof}
diff --git a/macros/latex/contrib/homework/homework-demo-jp.pdf b/macros/latex/contrib/homework/homework-demo-jp.pdf
index f0f294cbf1..4439738e75 100644
--- a/macros/latex/contrib/homework/homework-demo-jp.pdf
+++ b/macros/latex/contrib/homework/homework-demo-jp.pdf
Binary files differ
diff --git a/macros/latex/contrib/homework/homework-demo-jp.tex b/macros/latex/contrib/homework/homework-demo-jp.tex
index 15839ef40a..4ee7d4c62b 100644
--- a/macros/latex/contrib/homework/homework-demo-jp.tex
+++ b/macros/latex/contrib/homework/homework-demo-jp.tex
@@ -1,6 +1,6 @@
\documentclass[11pt,
logo = {example-image},
- % logo height = 1cm,
+ % logo height = 1cm, % logo width = 2cm,
title in boldface,
% title in sffamily,
theorem in new line,
@@ -27,7 +27,7 @@
\begin{document}
-\bigskip\textcolor{gray!55}{(ソリューションを直接書くつもりなら…)}
+\textcolor{gray!55}{(ソリューションを直接書くつもりなら…)}
\begin{problem}
これが答え/証明です。
@@ -67,9 +67,6 @@
\end{solution}
-\enlargethispage*{\baselineskip}
-
-
\bigskip\textcolor{gray!55}{(\texttt{answer} 環境を使用することもできます…)}
\begin{answer}
diff --git a/macros/latex/contrib/homework/homework-demo-tc.pdf b/macros/latex/contrib/homework/homework-demo-tc.pdf
index 2901b5d592..2860d04f15 100644
--- a/macros/latex/contrib/homework/homework-demo-tc.pdf
+++ b/macros/latex/contrib/homework/homework-demo-tc.pdf
Binary files differ
diff --git a/macros/latex/contrib/homework/homework-demo-tc.tex b/macros/latex/contrib/homework/homework-demo-tc.tex
index 4fda4f0049..1ceea979e6 100644
--- a/macros/latex/contrib/homework/homework-demo-tc.tex
+++ b/macros/latex/contrib/homework/homework-demo-tc.tex
@@ -1,6 +1,6 @@
\documentclass[11pt,
logo = {example-image},
- % logo height = 1cm,
+ % logo height = 1cm, % logo width = 2cm,
title in boldface,
% title in sffamily,
theorem in new line,
@@ -27,7 +27,7 @@
\begin{document}
-\bigskip\textcolor{gray!55}{(如果你打算直接寫出解答…)}
+\textcolor{gray!55}{(如果你打算直接寫出解答…)}
\begin{problem}
這裡是解答/證明。
@@ -73,7 +73,10 @@
\end{answer}
-\bigskip\textcolor{gray!55}{(如果你更喜歡傳統的證明樣式…)}
+\enlargethispage*{3\baselineskip}
+
+
+\bigskip\textcolor{gray!55}{(或者如果你更喜歡傳統的證明樣式…)}
\begin{proof}
\verb|proof| 環境仍可使用。
diff --git a/macros/latex/contrib/homework/homework-example-sheet-answer.pdf b/macros/latex/contrib/homework/homework-example-sheet-answer.pdf
new file mode 100644
index 0000000000..44a2eb9724
--- /dev/null
+++ b/macros/latex/contrib/homework/homework-example-sheet-answer.pdf
Binary files differ
diff --git a/macros/latex/contrib/homework/homework-example-sheet.pdf b/macros/latex/contrib/homework/homework-example-sheet.pdf
new file mode 100644
index 0000000000..a4640b04f9
--- /dev/null
+++ b/macros/latex/contrib/homework/homework-example-sheet.pdf
Binary files differ
diff --git a/macros/latex/contrib/homework/homework-example-sheet.tex b/macros/latex/contrib/homework/homework-example-sheet.tex
new file mode 100644
index 0000000000..00f703f5c1
--- /dev/null
+++ b/macros/latex/contrib/homework/homework-example-sheet.tex
@@ -0,0 +1,126 @@
+\documentclass[a4paper, 11pt,
+ formal title,
+ title in boldface,
+ % title in sffamily,
+ % theorem in new line,
+ % twoside,
+ hide solution, % Use this option to hide the solutions/answers
+]{homework}
+
+
+% EDIT THE FOLLOWING INFORMATION AS NEEDED
+
+\pretitle{%
+ \scshape
+ The University
+ \hfill
+ The Program \& Level
+ \\
+ Course ID \& Course Name
+ \hfill
+ Year 2023--24
+}
+
+\title{%
+ Sheet 1. Title of the current file
+}
+\author{}
+\date{%
+ % \TheDate{2023-12-25}
+}
+
+
+\begin{document}
+
+
+Here starts the main text.
+
+
+\section*{First theme}
+
+We shall show that...
+
+\begin{problem}
+ A preliminary result.
+\end{problem}
+\begin{solution}
+ \blindtext
+\end{solution}
+
+\begin{problem}[Brief description]
+ One step ahead.
+
+ \blindtext
+\end{problem}
+\begin{solution}
+ \blindtext[2]
+\end{solution}
+
+At this stage, we may conclude that...
+
+
+\section*{Second theme}
+
+Now we look at...
+
+\begin{problem}[Some prepration]
+ This is the prepration for...
+ \begin{enumerate}%[itemsep=.5\baselineskip]
+ \item First question.
+ \begin{solution}
+ \blindtext
+ \end{solution}
+ \item Second question.
+ \begin{solution}
+ \blindtext
+ \end{solution}
+ \item Third question.
+ \qedhere
+ \begin{solution}
+ \blindtext
+ \end{solution}
+ \end{enumerate}
+\end{problem}
+
+\begin{problem}[Another problem with many sub-questions]
+ \leavevmode % so that the first item start in new line
+ \begin{enumerate}%[itemsep=.5\baselineskip]
+ \item First question.
+
+ \blindtext
+
+ \begin{solution}
+ \blindtext[2]
+ \end{solution}
+ \item Second question.
+ \begin{enumerate}%[itemsep=.3\baselineskip]
+ \item First sub-question.
+
+ \blindtext
+
+ \begin{solution}
+ \blindtext[2]
+ \end{solution}
+ \item Second sub-question.
+ \\[.3\baselineskip]
+ \blindtext
+ \begin{solution}
+ \blindtext[2]
+ \end{solution}
+ \end{enumerate}
+ \item Third question.
+ \\[.5\baselineskip]
+ \blindtext[2]
+ \begin{solution}
+ \blindtext[2]
+ \end{solution}
+ \item Conclusion.
+ \qedhere
+ \begin{solution}
+ \blindtext
+ \end{solution}
+ \end{enumerate}
+\end{problem}
+
+
+\end{document}
diff --git a/macros/latex/contrib/homework/homework.cls b/macros/latex/contrib/homework/homework.cls
index eabf109563..3af754dd25 100644
--- a/macros/latex/contrib/homework/homework.cls
+++ b/macros/latex/contrib/homework/homework.cls
@@ -12,22 +12,38 @@
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplClass
{homework}
- {2023/09/28} {}
+ {2023/09/30} {}
{Document class for writing homework}
\keys_define:nn { homework }
{
- , logo .tl_set:N = \l__homework_logo_name_tl
- , logo .initial:n = { }
- , logo-height .dim_set:N = \l__homework_logo_height_dim
- , logo~height .dim_set:N = \l__homework_logo_height_dim
- , logo height .dim_set:N = \l__homework_logo_height_dim
+ , logo .tl_set:N = \l__homework_logo_name_tl
+ , logo .initial:n = { }
+ , logo-height .dim_set:N = \l__homework_logo_height_dim
+ , logo~height .dim_set:N = \l__homework_logo_height_dim
+ , logo height .dim_set:N = \l__homework_logo_height_dim
+ , logo-width .dim_set:N = \l__homework_logo_width_dim
+ , logo~width .dim_set:N = \l__homework_logo_width_dim
+ , logo width .dim_set:N = \l__homework_logo_width_dim
- , unknown .code:n = {
- \PassOptionsToClass { \CurrentOption } { minimart }
- \PassOptionsToClass { \CurrentOption } { einfart }
- \PassOptionsToPackage { \CurrentOption } { ProjLib }
- }
+ , formal-title .bool_set:N = \l__homework_formal_title_bool
+ , formal-title .initial:n = { false }
+ , formal~title .bool_set:N = \l__homework_formal_title_bool
+ , formal title .bool_set:N = \l__homework_formal_title_bool
+
+ , hide-solution .bool_set:N = \l__homework_hide_solution_bool
+ , hide-solution .initial:n = { false }
+ , hide~solution .bool_set:N = \l__homework_hide_solution_bool
+ , hide solution .bool_set:N = \l__homework_hide_solution_bool
+ , hide-answer .bool_set:N = \l__homework_hide_solution_bool
+ , hide~answer .bool_set:N = \l__homework_hide_solution_bool
+ , hide answer .bool_set:N = \l__homework_hide_solution_bool
+
+ , unknown .code:n = {
+ \PassOptionsToClass { \CurrentOption } { minimart }
+ \PassOptionsToClass { \CurrentOption } { einfart }
+ \PassOptionsToPackage { \CurrentOption } { ProjLib }
+ }
}
\ProcessKeyOptions [ homework ]
@@ -37,43 +53,100 @@
\sys_if_engine_pdftex:TF
{
- \PassOptionsToClass { use style = classical } { minimart }
+ \PassOptionsToClass { use indent = false, theorem with qed } { minimart }
\LoadClass { minimart }
}
{
- \PassOptionsToClass { use style = classical } { einfart }
+ \PassOptionsToClass { use indent = false, theorem with qed } { einfart }
\LoadClass { einfart }
}
\RequirePackage { ProjLib }
%%================================
-%% Insert the logo
+%% Print the title
%%================================
-\cs_new_protected:Nn \homework_include_logo:nn
- % #1 = height
- % #2 = name
+\newcommand\@pretitle{}
+
+\NewDocumentCommand \pretitle { +m }
{
- \includegraphics [ height = #1 ] { #2 }
+ \renewcommand{\@pretitle}{#1}
}
-\AddToHook { begindocument/end }
+\renewcommand{\@maketitle}
{
- \maketitle
+ \LocallyStopLineNumbers
+
+ % Insert the pretitle
+ \noindent{\@pretitle}\par
- \tl_if_empty:NF \l__homework_logo_name_tl
+ \bool_if:NTF \l__homework_formal_title_bool
+ {
+ \bigskip
+ \begin{center}
+ \let\footnote\thanks
+ {\minimalist_bfseries:\minimalist_sffamily:\minimalist_scshape:\Large\@title}\\\bigskip
+ \color{main-text!80!paper}
+ {\small\@author}
+ \par\smallskip\vspace{-\parskip}
+ {\small\@date}
+ \end{center}
+ \projlib_author_if_content_empty:nT { \@date } { \medskip }
+ \medskip\par
+ }
{
- \dim_compare:nNnT { \l__homework_logo_height_dim } < { 1pt }
- {
- \dim_set:Nn \l__homework_logo_height_dim { .6\pagetotal }
- }
- \dim_set:Nn \l_tmpa_dim { \pagetotal + .33\baselineskip }
- \vspace { - \l_tmpa_dim }
- \vspace { .5\l_tmpa_dim - .5\l__homework_logo_height_dim }
- \homework_include_logo:nn { \l__homework_logo_height_dim } { \l__homework_logo_name_tl }
- \vspace { .5\l_tmpa_dim - .5\l__homework_logo_height_dim }
+ \begin{tcolorbox}[
+ enhanced~jigsaw, sharp~corners,
+ sidebyside,
+ % sidebyside~adapt=left,
+ lefthand~width = .33\linewidth,
+ lower~separated = false,
+ toprule = .75pt, bottomrule = .75pt,
+ leftrule = 0pt, rightrule = 0pt,
+ boxsep = 0pt,
+ top = 1.5ex, bottom = 1.5ex,
+ left = 0pt, right = 0pt,
+ colframe = main-text!27!paper,
+ colback = paper,
+ ]
+ \tl_if_empty:NF \l__homework_logo_name_tl
+ {
+ \dim_compare:nNnTF { \l__homework_logo_height_dim } < { 1pt }
+ {% height not given
+ \dim_compare:nNnTF { \l__homework_logo_width_dim } < { 1pt }
+ {% width not given
+ \includegraphics [ height = 1.5cm ] { \l__homework_logo_name_tl }
+ }
+ {% width given
+ \includegraphics [ width = \l__homework_logo_width_dim ] { \l__homework_logo_name_tl }
+ }
+ }
+ {% height given
+ \includegraphics [ height = \l__homework_logo_height_dim ] { \l__homework_logo_name_tl }
+ }
+ }
+ \tcblower
+ \begin{flushright}
+ \let\footnote\thanks
+ {\minimalist_bfseries:\minimalist_sffamily:\@title}\\\medskip
+ \color{main-text!80!paper}
+ {\small\minimalist_scshape:\@author}
+ \par\vspace{-\parskip}\vspace{2pt}
+ {\small\@date}
+ \end{flushright}
+ \vspace{-2pt}
+ \end{tcolorbox}
+ \vspace{\baselineskip}
}
+
+ \par
+ \ResumeLineNumbers
+ }
+
+\AddToHook { begindocument/end }
+ {
+ \maketitle
}
%%================================
@@ -143,15 +216,17 @@
\newcommand\soluline{\bgroup\markoverwith{\rule[-.45ex]{1pt}{.75pt}}\ULon}
\NewDocumentEnvironment { solution } { O{ \l__homework_solution_tl } }
{
- \par\noindent
+ \par
+ \topsep0\p@\relax
+ \trivlist
\color{cyan!50!blue!90!main-text}
- \soluline{#1}\nobreakspace\nobreakspace
+ \item[\hskip\labelsep\soluline{#1}\nobreakspace\nobreakspace]
\let\qedsymbol\customqedsymbol
+ \ignorespaces
}
{
\pushQED{\qed}
- \popQED
- \par
+ \popQED\endtrivlist\@endpefalse
}
\NewDocumentEnvironment { answer } { O{ \l__homework_answer_tl } }
@@ -171,12 +246,41 @@
\SetTheorem { definition, lemma, theorem, proposition, corollary, example, fact, remark, assertion, assumption, claim, conclusion, conjecture, construction, convention, notation, observation, property, recall } { number within = homework }
%%================================
-%% Special cases for the QED
+%% Hide solution
%%================================
-\def\noQED{\let\popQED\relax}
-\let\noqed\noQED
-\def\proofless{\let\qedsymbol\customqedsymbol\let\simpleqedsymbol\customqedsymbol}
+\RequirePackage { verbatim }
+
+\bool_if:NT \l__homework_hide_solution_bool
+ {
+ \let\solution=\comment
+ \let\endsolution=\endcomment
+ \let\answer=\comment
+ \let\endanswer=\endcomment
+ }
+
+\prg_new_conditional:Nnn \homework_if_solution_shown: { T, F, TF }
+ {
+ \bool_if:NTF \l__homework_hide_solution_bool
+ { \prg_return_false: }
+ { \prg_return_true: }
+ }
+\NewCommandCopy \IfSolutionT \homework_if_solution_shown:T
+\NewCommandCopy \IfSolutionF \homework_if_solution_shown:F
+\NewCommandCopy \IfSolutionTF \homework_if_solution_shown:TF
+\NewCommandCopy \IfAnswerT \homework_if_solution_shown:T
+\NewCommandCopy \IfAnswerF \homework_if_solution_shown:F
+\NewCommandCopy \IfAnswerTF \homework_if_solution_shown:TF
+
+\bool_if:NTF \l__homework_hide_solution_bool
+ {
+ \setlist*[1]{itemsep=0\baselineskip, parsep=\parskip}
+ \setlist*[2]{itemsep=0\baselineskip, parsep=\parskip}
+ }
+ {
+ \setlist*[1]{itemsep=.5\baselineskip, parsep=\parskip}
+ \setlist*[2]{itemsep=.3\baselineskip, parsep=\parskip}
+ }
\endinput
%%