summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/homework/homework-demo-en.tex
blob: ef63ba7c275ed005d4dd04dc42ce1ea9fb8363b7 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
\documentclass[11pt,
  % twoside,
  logo = {example-image},
  % logo height = 1cm,  % logo width = 2cm,
  title in boldface,
  % title in sffamily,
  theorem in new line,
  % remove qed,
  colored solution,
]{homework}

%% For highlighting the code in this document
\usepackage{newverbs}
\newverbcommand{\cverb}{\color{red!50!orange}}{}

%% Below is the main document


\title{The Subject, Week 1}
\author{Author NAME}
% \date{\today, Location}
% \date{\today[only-year-month], Location}
\date{\TheDate{2024-01-01}, Location}


\begin{document}


\textcolor{gray!55}{(If you wish to write the answer directly...)}

\begin{problem}
    Here lies the solution / proof.
\end{problem}


\bigskip\textcolor{gray!55}{(If you wish to state the problem and then write your answer...)}

\begin{problem}[Brief description]
    You may also state the problem here...
\end{problem}

\begin{solution}
    ... and write the solution here...
\end{solution}

\bigskip\textcolor{gray!55}{(If you prefer \textquote{Proof} instead of \textquote{Solution}...)}

\begin{solution}[Proof]
    ... or a proof like this one...
    \begin{lemma}[You may write some description here]\label{lem}
        Some auxiliary result.
    \end{lemma}
    \begin{proof}
        The proof of \cref{lem}, where we use the following formula (note the use of \cverb|\qedhere|):
        \[
            \infty = \infty + 1.
            \qedhere % To place the Q.E.D. symbol in the right place.
        \]
    \end{proof}
    \begin{fact}[This statement requires no proof]
        \proofless
        Use \cverb|\proofless| to change the hollow box marking the end of a theorem-type environment into a solid one.
    \end{fact}
    ... 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}
    The usual \verb|proof| environment also works.
\end{proof}


\bigskip\textcolor{gray!55}{(If you wish to answer each sub-question of a problem separately...)}

\begin{problem}[A problem with many sub-questions]
    \begin{enumerate}
        \item First question.

        \begin{solution}
            The solution of the first question.
        \end{solution}

        \item Second question.

        \begin{enumerate}
            \item First sub-question.

            \begin{solution}
                The solution of the first sub-question.
            \end{solution}

            \item Second sub-question.

            \begin{solution}
                The solution of the second sub-question.
            \end{solution}

        \end{enumerate}

        \item Third question.

        \begin{solution}
            The solution of the third question.
        \end{solution}

    \end{enumerate}
    Use \cverb|\noqed| (or \cverb|\noQED|) at the end to suppress the Q.E.D. symbol that marks the end of the current problem.
    \noQED
\end{problem}


\bigskip\textcolor{gray!55}{(If you wish to number the exercise manually...)}

\ManualNumbering{exercise}{A.1.1}
\begin{exercise}[An exercise with custom numbering]
    Use \cverb|\ManualNumbering| to manually set the numbering. This number will only be applied to the next specified environment.
\end{exercise}

\begin{exercise}
    Back to normal numbering.
\end{exercise}


\bigskip\textcolor{gray!55}{(If there is a question that you can't figure out how to solve at the moment...)}

\DNF<some description>


\end{document}