summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/homework
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-09-26 03:01:14 +0000
committerNorbert Preining <norbert@preining.info>2023-09-26 03:01:14 +0000
commit48486f016a3101e6a13547bf0d44e210fedfbacf (patch)
tree82e32650576597bf136bc964af7ea88d975a02f6 /macros/latex/contrib/homework
parent9a8ccd95ca1117b976453194f16ad53dd02949ad (diff)
CTAN sync 202309260301
Diffstat (limited to 'macros/latex/contrib/homework')
-rw-r--r--macros/latex/contrib/homework/README.md29
-rw-r--r--macros/latex/contrib/homework/homework-demo-cn.pdfbin50131 -> 68674 bytes
-rw-r--r--macros/latex/contrib/homework/homework-demo-cn.tex30
-rw-r--r--macros/latex/contrib/homework/homework-demo-en.pdfbin34754 -> 46621 bytes
-rw-r--r--macros/latex/contrib/homework/homework-demo-en.tex22
-rw-r--r--macros/latex/contrib/homework/homework-demo-fr.pdfbin35349 -> 46759 bytes
-rw-r--r--macros/latex/contrib/homework/homework-demo-fr.tex22
-rw-r--r--macros/latex/contrib/homework/homework.cls38
8 files changed, 117 insertions, 24 deletions
diff --git a/macros/latex/contrib/homework/README.md b/macros/latex/contrib/homework/README.md
index 0eecd3843f..0374b4030f 100644
--- a/macros/latex/contrib/homework/README.md
+++ b/macros/latex/contrib/homework/README.md
@@ -11,7 +11,7 @@ The current document class is for writing homework. It has the following feature
- Page numbers are of the form `Page [current] of [total]`, which can help you ensure that there are no missing pages when you print your homework for submission.
- Support writing problem statements and solutions (or proofs) in different colors.
- Every statement and solution has its own QED symbol, in hollow or solid shape, respectively.
-- You may mark unfinished parts with `\DNF` or `\DNF<⟨remark⟩>` (meaning "did not finish") for reminding — this will give you a report on the unfinished parts at the end of your document.
+- You may mark unfinished parts with `\DNF` or `\DNF<⟨remark⟩>` (meaning "did not finish") for reminding — this will give you a clickable report on the unfinished parts at the end of your document.
## Usage
@@ -21,7 +21,7 @@ A typical homework document looks like this:
```latex
\documentclass[11pt,
logo = {image-file-of-your-university-logo},
- % logo height = 2\baselineskip,
+ % logo height = 1cm,
title in boldface,
title in sffamily,
theorem in new line,
@@ -65,7 +65,11 @@ A typical homework document looks like this:
Some auxiliary result.
\end{lemma}
\begin{proof}
- The proof of \cref{lem}.
+ The proof of \cref{lem}, where we use the following formula:
+ \[
+ \infty = \infty + 1.
+ \qedhere % To place the QED symbol in the right place
+ \]
\end{proof}
... and the rest steps...
\end{solution}
@@ -94,6 +98,25 @@ A few remarks:
The `\maketitle` has been automatically added just after `\begin{document}`, thus you don't need to write it by yourself. Note, however, that this also means that you cannot place `\title`, `author` and `\date` after `\begin{document}`.
+### Regarding the numbering
+
+A new counter named `homework` is defined, which is shared by the environments `problem`, `question` and `exercise`, thus you would see them numbered as `1`, `2`, `3`, etc. The other theorem-type environments are numbered within this counter `homework`, thus within, say, `Problem 1`, you would see them numbered as `Theorem 1.1`, `Lemma 1.2` and `Claim 1.3`, etc.
+
+Therefore, if you wish to manually change the numbering, you may directly access the value of the counter `homework`. Also, each theorem-type environment has its own counter, thus it would still work if you write `\setcounter{exercise}{10}`, but this would also affect the numbering of `problem` and `question`, so don't forget to reset the value as needed.
+
+If you wish them to be numbered separately, you may define new counters, say `problem-counter`, `question-counter` and `exercise-counter` via
+```latex
+\newcounter{problem-counter}
+\newcounter{question-counter}
+\newcounter{exercise-counter}
+```
+and then write this in your preamble:
+```latex
+\SetTheorem{problem}{shared counter=problem-counter}
+\SetTheorem{question}{shared counter=question-counter}
+\SetTheorem{exercise}{shared counter=exercise-counter}
+```
+
# License
diff --git a/macros/latex/contrib/homework/homework-demo-cn.pdf b/macros/latex/contrib/homework/homework-demo-cn.pdf
index fee8009ae6..03fbd68d8c 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 b62c665cee..4089820107 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 = 2\baselineskip,
+ % logo height = 1cm,
title in boldface,
% title in sffamily,
theorem in new line,
@@ -18,16 +18,16 @@
\begin{document}
-\bigskip\textcolor{gray!55}{(如果你打算直接写出解答…)}
+\bigskip\textcolor{gray!55}{(如果你打算直接写出解答…)}
\begin{problem}
这里是解答/证明。
\end{problem}
-\bigskip\textcolor{gray!55}{((如果你打算先陈述问题后再写出解答…))}
+\bigskip\textcolor{gray!55}{(如果你打算先陈述问题后再写出解答…)}
-\begin{problem}
+\begin{problem}[问题简介]
你可以把问题陈述在这里…
\end{problem}
@@ -35,25 +35,39 @@
…然后把解答写在这里…
\end{solution}
-\bigskip\textcolor{gray!55}{(如果比起\textquote{解},你更希望写\textquote{证明}…)}
+\bigskip\textcolor{gray!55}{(如果比起\textquote{解},你更希望写\textquote{证明}…)}
\begin{solution}[证明]
…或者写一个这样的证明…
- \begin{lemma}\label{lem}
+ \begin{lemma}[你可以在这里写一些注释]\label{lem}
一些辅助结果。
\end{lemma}
\begin{proof}
- \Cref{lem}的证明。
+ \Cref{lem}的证明,其中用到下面的公式:
+ \[
+ \infty = \infty + 1
+ \makebox[0pt][l]{\,。} % 句尾的句号
+ \qedhere % 用来把 QED 放在正确的位置
+ \]
\end{proof}
…剩余的步骤……
\end{solution}
+\bigskip\textcolor{gray!55}{(写\textquote{答}也是可以的…)}
+
+\begin{answer}
+ \verb|answer| 环境的用法和 \verb|solution| 是完全相同的。
+\end{answer}
+
-\bigskip\textcolor{gray!55}{(如果你更喜欢传统的证明样式…)}
+\bigskip\textcolor{gray!55}{(如果你更喜欢传统的证明样式…)}
\begin{proof}
\verb|proof| 环境依然可用。
\end{proof}
+\DNF<一些描述>
+
+
\end{document}
diff --git a/macros/latex/contrib/homework/homework-demo-en.pdf b/macros/latex/contrib/homework/homework-demo-en.pdf
index b698ad3a57..19dff1fb8f 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 fc99795da7..dd25bbc6b5 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 = 2\baselineskip,
+ % logo height = 1cm,
title in boldface,
% title in sffamily,
theorem in new line,
@@ -25,7 +25,7 @@
\bigskip\textcolor{gray!55}{(If you wish to state the problem and then write your answer...)}
-\begin{problem}
+\begin{problem}[Brief description]
You may also state the problem here...
\end{problem}
@@ -37,16 +37,27 @@
\begin{solution}[Proof]
... or a proof like this one...
- \begin{lemma}\label{lem}
+ \begin{lemma}[You may write some description here]\label{lem}
Some auxiliary result.
\end{lemma}
\begin{proof}
- The proof of \cref{lem}.
+ The proof of \cref{lem}, where we use the following formula:
+ \[
+ \infty = \infty + 1.
+ \qedhere % To place the QED symbol in the right place
+ \]
\end{proof}
... and the rest steps...
\end{solution}
+\bigskip\textcolor{gray!55}{(You may also write \texttt{answer} instead of \texttt{solution} if you wish...)}
+
+\begin{answer}
+ The usage of the \verb|answer| environment is exactly the same as \verb|solution|.
+\end{answer}
+
+
\bigskip\textcolor{gray!55}{(If you prefer the classical proof style...)}
\begin{proof}
@@ -54,4 +65,7 @@
\end{proof}
+\DNF<some description>
+
+
\end{document}
diff --git a/macros/latex/contrib/homework/homework-demo-fr.pdf b/macros/latex/contrib/homework/homework-demo-fr.pdf
index af035e9f3d..30abef74de 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 d978dcf875..0c79fc02b7 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 = 2\baselineskip,
+ % logo height = 1cm,
title in boldface,
% title in sffamily,
theorem in new line,
@@ -27,7 +27,7 @@
\bigskip\textcolor{gray!55}{(Si vous souhaitez énoncer le problème puis écrire votre réponse...)}
-\begin{problem}
+\begin{problem}[Description brève]
Vous pouvez également énoncer le problème ici...
\end{problem}
@@ -39,16 +39,27 @@
\begin{solution}[Preuve]
... ou une preuve comme ça...
- \begin{lemma}\label{lem}
+ \begin{lemma}[Vous pouvez écrire ici quelques descriptions]\label{lem}
Un résultat auxiliaire.
\end{lemma}
\begin{proof}
- La preuve \cref[de]{lem}.
+ La preuve \cref[de]{lem}, où l'on utilise la formule suivante :
+ \[
+ \infty = \infty + 1.
+ \qedhere % pour placer le symbole QED au bon endroit
+ \]
\end{proof}
... et les étapes restantes...
\end{solution}
+\bigskip\textcolor{gray!55}{(Vous pouvez également écrire \texttt{answer} au lieu de \texttt{solution} si vous le souhaitez...)}
+
+\begin{answer}
+ L'utilisation de l'environnement \verb|answer| est exactement le même que celui de \verb|solution|.
+\end{answer}
+
+
\bigskip\textcolor{gray!55}{(Si vous préférez le style classique...)}
\begin{proof}
@@ -56,4 +67,7 @@
\end{proof}
+\DNF<la description>
+
+
\end{document}
diff --git a/macros/latex/contrib/homework/homework.cls b/macros/latex/contrib/homework/homework.cls
index bf965588a5..1f3fe68cb8 100644
--- a/macros/latex/contrib/homework/homework.cls
+++ b/macros/latex/contrib/homework/homework.cls
@@ -12,7 +12,7 @@
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplClass
{homework}
- {2023/09/24} {}
+ {2023/09/25} {}
{Document class for writing homework}
\keys_define:nn { homework }
@@ -121,7 +121,22 @@
, RU = { Решение }
}
-\newcommand\soluline{\bgroup\markoverwith{\rule[-.45ex]{2pt}{.75pt}}\ULon}
+\projlib_langauge_define_multilingual_text:Nn \l__homework_answer_tl
+ {
+ , EN = { Answer }
+ , FR = { Réponse }
+ , DE = { Antwort }
+ , IT = { Risposta }
+ , PT = { Resposta }
+ , BR = { Resposta }
+ , ES = { Respuesta }
+ , CN = { 答 }
+ , TC = { 答 }
+ , JP = { 解答 }
+ , RU = { Ответ }
+ }
+
+\newcommand\soluline{\bgroup\markoverwith{\rule[-.45ex]{1pt}{.75pt}}\ULon}
\NewDocumentEnvironment { solution } { O{ \l__homework_solution_tl } }
{
\setlength\abovedisplayskip{.3\baselineskip}
@@ -132,15 +147,28 @@
\color{cyan!50!blue!90!main-text}
\soluline{#1}\nobreakspace\nobreakspace
\let\qedsymbol\customqedsymbol
- }{\pushQED{\qed}\popQED\par}
+ }
+ {
+ \pushQED{\qed}
+ \popQED
+ \par
+ }
+
+\NewDocumentEnvironment { answer } { O{ \l__homework_answer_tl } }
+ {
+ \begin{solution}[#1]
+ }
+ {
+ \end{solution}
+ }
%%================================
%% Configuration of the theorems
%%================================
\newcounter{homework}
-\SetTheorem{problem,question}{shared counter=homework}
-\SetTheorem{lemma,theorem,proposition,fact,remark}{number within=homework}
+\SetTheorem{problem,question,exercise}{shared counter=homework}
+\SetTheorem{definition,lemma,theorem,proposition,corollary,example,fact,remark,assertion,assumption,claim,conclusion,conjecture,construction,convention,notation,observation,property,recall}{number within=homework}
\endinput
%%