Debian Codegraph @

texmf-dist/doc/latex/seu-ml-assign/seu-ml-assign-doc.tex

raw
1 %! TEX program = pdflatex
2
3 \documentclass[twoside]{seu-ml-assign}
4
5 \usepackage{booktabs}
6 \usepackage{colortbl}
7 \usepackage{multicol}
8 \usepackage{threeparttable}
9
10 \title{Documentation}
11 \author{Teddy van Jerry}
12 \studentID{}
13 \instructor{TeX - LaTeX Stack Exchange}
14 \date{\today}
15 \duedate{20:00 March 30, 2022}
16 \assignno{1.1}
17 \semester{LaTeX Template}
18 \mainproblem{Template Documentation}
19
20 \renewcommand{\sectionheadname}{Section}
21 \renewcommand{\pdftitleadditionalname}{}
22
23 % option for tabular with '\midrule'
24 \aboverulesep = 0mm \belowrulesep = 0mm
25
26 \newcommand{\grayrow}{\rowcolor[rgb]{ .906, .902, .902}}
27
28 \begin{document}
29 \maketitle
30
31 \problem{Basic Information of This Template Class}
32
33 Despite this \textit{SEU-ML-Assign} class is dedicated to Southeast University as the Machine Learning assignment \LaTeX{} template both for teachers and students, it can also be used for other schools.
34 In the near future, it will eventually become an elegant template for all assignment requirememts.
35
36 \begin{table}[htbp]
37 \bgroup
38 \def\arraystretch{1.2}
39 \setlength{\tabcolsep}{1.5em}
40 \begin{tabular}{ll}
41 \toprule
42 \grayrow \textbf{Package Class Name} & \texttt{seu-ml-assign} \\
43 \textbf{Version} & 1.1 (2022/03/28) \\
44 \grayrow \textbf{Description} & \LaTeX{} Template for Southeast University Machine Learning Assignment \\
45 \textbf{Author} & Teddy van Jerry (Wuqiong Zhao) \\
46 \grayrow \textbf{Maintainer} & Teddy van Jerry (Wuqiong Zhao) \\
47 \textbf{GitHub Repository} & \url{https://tvj.one/ml-tex} \\
48 \grayrow \textbf{Issues} & \url{https://tvj.one/ml-tex/issues} \\
49 \textbf{CTAN Package} & \url{https://www.ctan.org/pkg/seu-ml-assign} \\
50 \grayrow \textbf{Information Page} & \url{https://seu-ml-assign.github.io} \\
51 \textbf{Open Source License} & MIT License (\url{https://tvj.one/ml-tex/blob/master/LICENSE}) \\
52 \bottomrule
53 \end{tabular}%
54 \egroup
55 \end{table}
56
57 You can contact me at \href{mailto:[email protected]}{[email protected]} for support.
58
59 \problem{Class Options}
60
61 To use this template, put \texttt{seu-ml-assign.cls} file under the same directory with your main \texttt{tex} file.
62 \begin{lstlisting}[language=tex,numbers=none]
63 \documentclass{seu-ml-assign} % SEU Machine Learning Assignment Template
64 \end{lstlisting}
65 The page size is A4 paper. There are 8 supported options:
66 \begin{table}[htbp]
67 \bgroup
68 \def\arraystretch{1.2}
69 \setlength{\tabcolsep}{1.5em}
70 \begin{tabular}{llc}
71 \toprule
72 \textbf{Option} & \textbf{Description} & \textbf{Default} \\
73 \midrule\midrule
74 \grayrow \texttt{solution} & Write solutions (for students). & \Large\textbullet \\
75 \texttt{problem} & Write problem sets (for instructors). & \\
76 \hline
77 \grayrow \texttt{oneside} & One-sided document. & \Large\textbullet \\
78 \texttt{twoside}& Two-sided document. & \\
79 \hline
80 \grayrow \texttt{9pt} & Set font size as 9 points. & \\
81 \texttt{10pt} & Set font size as 10 points. & \Large\textbullet \\
82 \grayrow \texttt{11pt} & Set font size as 11 points. & \\
83 \texttt{12pt} & Set font size as 12 points. & \\
84 \bottomrule
85 \end{tabular}%
86 \egroup
87 \end{table}
88
89 For example, a 10pt, two-sided document for instructors to create an assignment consisting of problem sets should use
90
91 \begin{lstlisting}[language=tex,numbers=none]
92 \documentclass[10pt,twoside,problem]{seu-ml-assign} % The 10pt option can be omitted.
93 \end{lstlisting}
94
95 With the \texttt{twoside} option, the header will switch style every page, as is the case in this documentation.
96 In contrast, the sample file uses the \texttt{oneside} option.
97
98 There are several differences between the \texttt{solution} mode and \texttt{problem} mode,
99 including the preset texts on the document (for example the student name is not shown in the \texttt{problem} mode) and some properties can only be used with the \texttt{problem} mode which will be elaborated on in \S\ref{subsec:prob_only_properties}.
100
101 \problem{Document Properties}
102
103 \subproblem{Fields}
104
105 There are several fields to set.
106 The \verb|\mainproblem{}| can be left empty.
107 Consider the following example used in the sample file:
108 \begin{lstlisting}[language=tex,numbers=none]
109 \title{Assignment} % Document Type: assignment, quiz, etc.
110 \author{Teddy van Jerry} % Your Name
111 \studentID{61520522} % Your Student ID
112 \instructor{TeX - LaTeX Stack Exchange} % The Name of Your Instructor
113 \date{\today} % The Submission or Release Date
114 \duedate{20:00 March 21, 2022} % The Time the Assignment is Due
115 \assignno{1} % Assignment Number
116 \semester{SEU --- 2022 Spring} % Semester
117 \mainproblem{Linear Algreba} % The Main Problem or Topic
118 \end{lstlisting}
119
120 With these fields set, you can use the command \verb|\maketitle| to print the title.
121 At the same time, the metadata for the PDF document is automatically set.
122
123 \subproblem{Problem Mode Only Properties}\label{subsec:prob_only_properties}
124 One of the fields \verb|\author{}| and \verb|\instructor{}| can be omitted or set as empty provided that they are the same.
125
126 \problem{Section Title (Problem) Settings}
127
128 \subproblem{Normal Title}\label{subsec:section_normal_title}
129
130 The title of a problem can be set as \verb|\problem{This is a Section Title}| or uses a lower level command \verb|\section{This is a Section Title}|.
131 There are two slight different between these two ways.
132 \begin{itemize}
133 \item The name in the table of contents (ToC) using \verb|\problem{}| will add the section/problem number before the section/problem title name.
134 \item The optional argument of \verb|\section{}| will set the name in the ToC which is by default in \LaTeX{} in the format of \verb|\section[<ToC Name>]{<Section Title Name>}|.
135 By contrast, the optional argument in \verb|\problem{}| sets the problem points as is detailed in \S\ref{subsec:problem_with_points}.
136 \end{itemize}
137 \verb|\section[\thesection~<Title>]{<Title>}|
138 is equivalent to
139 \verb|\problem{<Title>}| or \verb|\problem[]{<Title>}|.
140
141
142 \subproblem{Unnumbered Title}
143
144 Use the \verb|\section*{}| or \verb|\problem*{}| to get an unnumbered section.\vspace{-8mm}
145
146 \problem*{This is an Unnumbered Problem}
147
148 This title will also not appear in the ToC or bookmarks of the PDF.
149
150 \subproblem{Problem with Points}\label{subsec:problem_with_points}
151
152 The points of a problem can be set using command \verb|\problempts{xxx}| before calling the \verb|\section{}| command.
153 These two commands can be simplified to \verb|\problem[xxx]{}|.
154 For example, using the command \verb|\problem[15]{This is a Problem Worth 15 Points}| will have:\footnote{This title is actually faked in this documentation because I do not want the ToC of this documentation contaminated. But it will look the same.}\vspace{-8mm}
155
156 \renewcommand{\sectionheadname}{Problem}
157 \setproblem{1}
158
159 % \problem[15]{This is a Problem Worth 15 Points}
160 % Here I have to 'fake' this title
161 % because I do not want it to ruin the ToC.
162 \problempts{15}
163 \section*{Problem 1:\hspace{0.33em}This is a Problem Worth 15 Points}
164 Note that if the point is an empty string, the point information will not be shown.
165
166 \subproblem{Long Title Compatibility}
167 There is also no problem if the section title is too long.\footnote{This title is also faked.}\vspace{-8mm}
168
169 % Here I have to 'fake' this title again
170 % because I do not want it to ruin the ToC.
171 \setproblem{2}
172 \problempts{20}
173 \section*{Problem 2:\hspace{0.33em}I Don't Think that Anyone Will Enjoy Themselves Seeing a Very\\\hspace{5.2em}Very Long Problem That is Worth Twenty Points in this Machine\\\hspace{5.2em}Learning Course}
174
175 \renewcommand{\sectionheadname}{Section}
176 \setproblem{4}
177
178 \subproblem{Section Title Name}
179 The name of the section (default name as \texttt{problem}) can be changed by using \verb|\renewcommand{\sectionheadname}{Name}|.
180
181 \subproblem{Section Number}
182 The number of the section can be changed, for example \verb|\texttt{\setproblem{4}}| will make the next section number be \texttt{5}.
183 For experienced \LaTeX{} users to understand, this command actually change the section counter.
184
185 \subproblem{Solution Declaration}
186 You can use \verb|\startsolution| to declare you start writing the solution.
187 This will reset the section number and it is especially useful when your document contains problems and solutions as two separate parts.
188 There is an option \texttt{print} and if you use \verb|\startsolution[print]| you will get:
189 \vspace{-\baselineskip}
190
191 \startsolution[print]
192 and the word \textsc{Solution} can be changed using command \verb|\renewcommand{\solutionname}{Other Name}|.
193
194
195 \setproblem{4}
196 \problem{Subsection Title (Sub Problem) Settings}
197
198 \subproblem{Normal Title} This is a normal title using command \verb|\subproblem{Normal Title}| or alternatively the command \verb|\subsection{Normal Title}|.
199 There is a slight difference between these two commands which is similar to the case stated in \S\ref{subsec:section_normal_title}.
200 The command
201 \verb|\subproblem{}| adds the sub problem number in ToC and bookmarks.
202 \verb|\subsection[(\arbic{subsection}) <Title>]{<Title>}|
203 is equivalent to \verb|\subproblem{<Title>}|.
204
205 \subproblem{} Use \verb|\subproblem{}| or \verb|\subsection{}| if only the sub problem number is required (like this line).
206
207 \subproblem{Subsection Number} Similar to \verb|\setproblem{}|, there is also \verb|\setsubproblem{}|.
208
209 \subproblem{Subsubsection (Sub Sub Problem)} For completeness,
210 \verb|\subsubsection{}| and \verb|\subsubproblem{}| are provided.
211 One example is \S\ref{subsubsec:hint}, where
212 \verb|\subsubsection[\arbic{subsubsection}. <Title>]{<Title>}|
213 is equivalent to \verb|\subsubproblem{<Title>}|.
214
215 \problem{Other Tools}
216
217 \subproblem{Equation Numbering} The equation number is within the section (problem), for example
218 \begin{equation}\label{eq:eq_num_example}
219 \mathrm{det}(\mathbf{A})=1\times\begin{vNiceArray}{rr}
220 -5&3\\-6&4
221 \end{vNiceArray}-(-3)\times\begin{vNiceArray}{rr}
222 3&3\\6&4
223 \end{vNiceArray}+3\times\begin{vNiceArray}{rr}
224 3&-5\\6&-6
225 \end{vNiceArray}=1\times(-2)+3\times(-6)+3\times 12=16,
226 \end{equation}
227 which uses the \texttt{equation} environment and can be referenced using the command \verb|\eqref{eq:xxx}|
228 with a corresponding \verb|\label{eq:xxx}| in Eq.~\eqref{eq:eq_num_example}.
229
230 \subproblem{Maths Packages} Maths Package \texttt{mathtools}, \texttt{amssymb}, \texttt{amsthm}, \texttt{bm} and \texttt{nicematrix} are automatically loaded.
231 The \texttt{nicematrix} package is especially powerful in terms of writing a matrix.
232 You can find its documentation at \url{https://ctan.org/pkg/nicematrix}.
233 It is worth noting that \texttt{nccmath} can lead to potential subsection (sub problem) title indentation problem and therefore should not be loaded.
234
235 \subproblem{Theorem Environment} Environments \texttt{theorem}, \texttt{proposition}, \texttt{lemma}, \texttt{corollary} have been defined.
236 For example:
237 \begin{lemma}
238 This is a lemma. Its numbering is within the section.
239 You can create such environment using the code \verb|\begin{lemma} Your lemma contents here. \end{lemma}|.
240 % The same code pattern applies to \texttt{theorem}, \texttt{proposition} and \texttt{corollary}.
241 \end{lemma}
242
243 \subproblem{Additional Math Operator} The additional math operator is listed in the table below.
244 \begin{table}[htbp]
245 \begin{threeparttable}
246 \bgroup
247 \def\arraystretch{1.2}
248 \setlength{\tabcolsep}{1.5em}
249 \begin{tabular}{lll}
250 \toprule
251 \textbf{Command} & \textbf{Definition} & \textbf{Inline Example} \\
252 \midrule\midrule
253 \grayrow \verb|\argmin| & \verb|\DeclareMathOperator*{\argmin}{\arg\min}| & $\argmin_{x}(x-2)^2+1$ \\
254 \verb|\argmax| & \verb|\DeclareMathOperator*{\argmax}{\arg\max}| & $\argmax_{\mathbf{x}} f(\mathbf{x})$ \\
255 \bottomrule
256 \end{tabular}%
257 \begin{tablenotes}\footnotesize
258 \item Operators defined with the \texttt{*} after \verb|\DeclareMathOperator| have their subscript under the operator in the \texttt{equation} mode, which can be suppressed by adding \verb|\nolimits| before the \verb|_|.
259 \end{tablenotes}
260 \egroup
261 \end{threeparttable}
262 \end{table}
263
264 Here is an example:
265 \begin{lstlisting}[language=tex,numbers=none,morekeywords={begin}]
266 \begin{equation}
267 \argmin_{x}(x-2)^2+1,\quad \argmax_{\mathbf{x}} f(\mathbf{x}),\quad \argmin\nolimits_{\alpha}g(\alpha)
268 \end{equation}
269 \end{lstlisting}
270 \begin{equation}
271 \argmin_{x}(x-2)^2+1,\quad \argmax_{\mathbf{x}} f(\mathbf{x}),\quad \argmin\nolimits_{\alpha}g(\alpha)
272 \end{equation}
273
274 \subproblem{Shortcuts} Some shortcuts commands have been defined in this class.
275
276 \subsubproblem{Hint}\label{subsubsec:hint}
277 You can easily use command \verb|\hint{}| to show a hint to a problem.
278 This is especially useful in the \texttt{problem} mode.
279 \hint{You can use \texttt{\string\renewcommand\{\string\hintstyle\}\{<Your Style>\}} to change the default one.}
280
281 \subproblem{Code Block} You can use code blocks in this class which is implemented by the \texttt{lstlisting} environment.
282 Their default styles have been set and you can make changes by passing optional arguments when using the environment.
283 For more information, please refer to \url{https://ctan.org/pkg/listings}.
284
285 \subproblem{Fancy Box} A fancy box has been defined.
286 \begin{fancybox}{This is a Fancy Box}
287 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin viverra massa rutrum felis vulputate, ac faucibus velit accumsan. Vivamus aliquet felis nec interdum sollicitudin. Nullam ornare eu velit id cursus. Maecenas a sodales velit, vel cursus magna. Cras lobortis venenatis.
288 \end{fancybox}
289
290 You can use the following code to generate it.
291 \begin{lstlisting}[language=tex,numbers=none,morekeywords={begin}]
292 \begin{fancybox}{This is a Fancy Box}
293 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin viverra massa rutrum felis vulputate, ac faucibus velit accumsan. Vivamus aliquet felis nec interdum sollicitudin. Nullam ornare eu velit id cursus. Maecenas a sodales velit, vel cursus magna. Cras lobortis venenatis.
294 \end{fancybox}
295 \end{lstlisting}
296
297 There is also a \texttt{notice} box:
298 \begin{notice}{This is a Notice Box}
299 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin viverra massa rutrum felis vulputate, ac faucibus velit accumsan. Vivamus aliquet felis nec interdum sollicitudin. Nullam ornare eu velit id cursus. Maecenas a sodales velit, vel cursus magna. Cras lobortis venenatis.
300 \end{notice}
301
302 You can use the following code to generate it.
303 \begin{lstlisting}[language=tex,numbers=none,morekeywords={begin}]
304 \begin{notice}{This is a Notice Box}
305 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin viverra massa rutrum felis vulputate, ac faucibus velit accumsan. Vivamus aliquet felis nec interdum sollicitudin. Nullam ornare eu velit id cursus. Maecenas a sodales velit, vel cursus magna. Cras lobortis venenatis.
306 \end{notice}
307 \end{lstlisting}
308
309 \appendix
310 \renewcommand{\sectionheadname}{Appendix}
311
312 \problem{Known Issues}\label{sec:known_issues}
313
314 \begin{itemize}
315 \item The section title background height may not be accurate;
316 \end{itemize}
317
318 If you find more issues, please report them on \url{https://tvj.one/ml-tex/issues}.
319
320 \problem{Change Log}
321
322 \begin{multicols}{2}
323 \begin{itemize}
324 \item [\textbf{v1.1}] 2022/03/28 -- Bug Fix and Enhancement
325 \begin{enumerate}
326 \item Add \verb|\mainproblem{}| command;
327 \item Add \verb|\subsubproblem{}| command;
328 \item Add \verb|\hint{}| shortcut;
329 \item Support for \verb|\section*{}|, \verb|\problem*{}|, \verb|\subsection*{}| and \verb|\subproblem*{}|;
330 \item Fix ToC/Bookmarks problem;
331 \item Set footnote line style;
332 \item Add the \texttt{twoside} option.
333 \end{enumerate}
334 \item [\textbf{v1.0}] 2022/03/19 -- Initial Version
335 \begin{enumerate}
336 \item Initial \texttt{cls} file in addition to a sample file and documentation;
337 \item Publish at GitHub and CTAN.
338 \end{enumerate}
339 \end{itemize}
340 \end{multicols}
341
342 \problem{Source Code}
343
344 The source code of \texttt{seu-ml-assign.cls} is listed below.
345
346 \lstinputlisting[language=tex,linerange={15-1000},firstnumber=15,morekeywords={begin}]{seu-ml-assign.cls}
347
348 \end{document}