summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-09-30 20:11:44 +0000
committerKarl Berry <karl@freefriends.org>2023-09-30 20:11:44 +0000
commited02c3313c35866f89e3d8ee092ab766a27403e3 (patch)
tree485b1dc77043e5ced1d819869c12a0651f56edb7 /Master
parentd53ffb157430428a59011124cd54d7f8bd64006a (diff)
homework (30sep23)
git-svn-id: svn://tug.org/texlive/trunk@68410 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/homework/README.md49
-rw-r--r--Master/texmf-dist/doc/latex/homework/homework-demo-cn.pdfbin83711 -> 83733 bytes
-rw-r--r--Master/texmf-dist/doc/latex/homework/homework-demo-cn.tex9
-rw-r--r--Master/texmf-dist/doc/latex/homework/homework-demo-de.pdfbin52262 -> 52415 bytes
-rw-r--r--Master/texmf-dist/doc/latex/homework/homework-demo-de.tex7
-rw-r--r--Master/texmf-dist/doc/latex/homework/homework-demo-en.pdfbin50985 -> 51164 bytes
-rw-r--r--Master/texmf-dist/doc/latex/homework/homework-demo-en.tex6
-rw-r--r--Master/texmf-dist/doc/latex/homework/homework-demo-es.pdfbin51505 -> 51652 bytes
-rw-r--r--Master/texmf-dist/doc/latex/homework/homework-demo-es.tex18
-rw-r--r--Master/texmf-dist/doc/latex/homework/homework-demo-fr.pdfbin51376 -> 51535 bytes
-rw-r--r--Master/texmf-dist/doc/latex/homework/homework-demo-fr.tex7
-rw-r--r--Master/texmf-dist/doc/latex/homework/homework-demo-jp.pdfbin86676 -> 86926 bytes
-rw-r--r--Master/texmf-dist/doc/latex/homework/homework-demo-jp.tex7
-rw-r--r--Master/texmf-dist/doc/latex/homework/homework-demo-tc.pdfbin90595 -> 90633 bytes
-rw-r--r--Master/texmf-dist/doc/latex/homework/homework-demo-tc.tex9
-rw-r--r--Master/texmf-dist/doc/latex/homework/homework-example-sheet-answer.pdfbin0 -> 30090 bytes
-rw-r--r--Master/texmf-dist/doc/latex/homework/homework-example-sheet.pdfbin0 -> 21936 bytes
-rw-r--r--Master/texmf-dist/doc/latex/homework/homework-example-sheet.tex126
-rw-r--r--Master/texmf-dist/tex/latex/homework/homework.cls180
19 files changed, 348 insertions, 70 deletions
diff --git a/Master/texmf-dist/doc/latex/homework/README.md b/Master/texmf-dist/doc/latex/homework/README.md
index 28cdf8b29ad..57da7f2d669 100644
--- a/Master/texmf-dist/doc/latex/homework/README.md
+++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/homework/homework-demo-cn.pdf b/Master/texmf-dist/doc/latex/homework/homework-demo-cn.pdf
index cab3b099860..6236b301e17 100644
--- a/Master/texmf-dist/doc/latex/homework/homework-demo-cn.pdf
+++ b/Master/texmf-dist/doc/latex/homework/homework-demo-cn.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/homework/homework-demo-cn.tex b/Master/texmf-dist/doc/latex/homework/homework-demo-cn.tex
index 44bc036e2c2..79f28d78607 100644
--- a/Master/texmf-dist/doc/latex/homework/homework-demo-cn.tex
+++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/homework/homework-demo-de.pdf b/Master/texmf-dist/doc/latex/homework/homework-demo-de.pdf
index dc4051f0bb6..03ea38e7e05 100644
--- a/Master/texmf-dist/doc/latex/homework/homework-demo-de.pdf
+++ b/Master/texmf-dist/doc/latex/homework/homework-demo-de.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/homework/homework-demo-de.tex b/Master/texmf-dist/doc/latex/homework/homework-demo-de.tex
index d81f2cc5a62..09c3c123e63 100644
--- a/Master/texmf-dist/doc/latex/homework/homework-demo-de.tex
+++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/homework/homework-demo-en.pdf b/Master/texmf-dist/doc/latex/homework/homework-demo-en.pdf
index 5d0834762c1..ebd75dba406 100644
--- a/Master/texmf-dist/doc/latex/homework/homework-demo-en.pdf
+++ b/Master/texmf-dist/doc/latex/homework/homework-demo-en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/homework/homework-demo-en.tex b/Master/texmf-dist/doc/latex/homework/homework-demo-en.tex
index 40585d77efd..a4840d29486 100644
--- a/Master/texmf-dist/doc/latex/homework/homework-demo-en.tex
+++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/homework/homework-demo-es.pdf b/Master/texmf-dist/doc/latex/homework/homework-demo-es.pdf
index 3dd42d5e30a..530d8b016f3 100644
--- a/Master/texmf-dist/doc/latex/homework/homework-demo-es.pdf
+++ b/Master/texmf-dist/doc/latex/homework/homework-demo-es.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/homework/homework-demo-es.tex b/Master/texmf-dist/doc/latex/homework/homework-demo-es.tex
index d73a1207c26..63ded1fe955 100644
--- a/Master/texmf-dist/doc/latex/homework/homework-demo-es.tex
+++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/homework/homework-demo-fr.pdf b/Master/texmf-dist/doc/latex/homework/homework-demo-fr.pdf
index eff533c39ef..b98eed2126b 100644
--- a/Master/texmf-dist/doc/latex/homework/homework-demo-fr.pdf
+++ b/Master/texmf-dist/doc/latex/homework/homework-demo-fr.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/homework/homework-demo-fr.tex b/Master/texmf-dist/doc/latex/homework/homework-demo-fr.tex
index 9c90e8b261c..b8394edda58 100644
--- a/Master/texmf-dist/doc/latex/homework/homework-demo-fr.tex
+++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/homework/homework-demo-jp.pdf b/Master/texmf-dist/doc/latex/homework/homework-demo-jp.pdf
index f0f294cbf1d..4439738e75f 100644
--- a/Master/texmf-dist/doc/latex/homework/homework-demo-jp.pdf
+++ b/Master/texmf-dist/doc/latex/homework/homework-demo-jp.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/homework/homework-demo-jp.tex b/Master/texmf-dist/doc/latex/homework/homework-demo-jp.tex
index 15839ef40a5..4ee7d4c62b7 100644
--- a/Master/texmf-dist/doc/latex/homework/homework-demo-jp.tex
+++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/homework/homework-demo-tc.pdf b/Master/texmf-dist/doc/latex/homework/homework-demo-tc.pdf
index 2901b5d5923..2860d04f156 100644
--- a/Master/texmf-dist/doc/latex/homework/homework-demo-tc.pdf
+++ b/Master/texmf-dist/doc/latex/homework/homework-demo-tc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/homework/homework-demo-tc.tex b/Master/texmf-dist/doc/latex/homework/homework-demo-tc.tex
index 4fda4f0049f..1ceea979e61 100644
--- a/Master/texmf-dist/doc/latex/homework/homework-demo-tc.tex
+++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/homework/homework-example-sheet-answer.pdf b/Master/texmf-dist/doc/latex/homework/homework-example-sheet-answer.pdf
new file mode 100644
index 00000000000..44a2eb9724c
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/homework/homework-example-sheet-answer.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/homework/homework-example-sheet.pdf b/Master/texmf-dist/doc/latex/homework/homework-example-sheet.pdf
new file mode 100644
index 00000000000..a4640b04f92
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/homework/homework-example-sheet.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/homework/homework-example-sheet.tex b/Master/texmf-dist/doc/latex/homework/homework-example-sheet.tex
new file mode 100644
index 00000000000..00f703f5c12
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/tex/latex/homework/homework.cls b/Master/texmf-dist/tex/latex/homework/homework.cls
index eabf1095631..3af754dd257 100644
--- a/Master/texmf-dist/tex/latex/homework/homework.cls
+++ b/Master/texmf-dist/tex/latex/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
%%