-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNoTeX Documentation.tex
320 lines (253 loc) Β· 14.1 KB
/
NoTeX Documentation.tex
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
\documentclass{notex}
\usepackage{notexmacros}
\usepackage{blindtext}
\input{doc/documentation_settings.tex}
\begin{document}
\input{notextitle}
\chapter{Introduction}
\noindent This is an attempt to transform the old project of NoTeX into an actual class, done in a proper way. The class is based out of the \texttt{report} class, and all the parameters are defined in the \texttt{notex.cls} class file. The class comes with a packet, called \texttt{notexmacros}. Such packet adds plenty of macros that can be used by the user, and that were pretty much useful to me while taking notes. This class aims also to reduce drastically the number of errors and thus increase the compile time. If it will be worth, it will be published also on the \texttt{CTAN} archive.
\chapter{The \texttt{notex} class}
The class file is organized in various structures: \textbf{declaration}, \textbf{packages importation}, \textbf{definition of colors}, \textbf{custom commands}, \textbf{loading of the class}.
\section{Declaration}
The declaration of the class simply consists of the following lines of command:
\begin{tcolorbox}
\begin{verbatim}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{notex}[2024 ElBi21 LaTeX class for taking notes]\end{verbatim}
\end{tcolorbox}
\section{Importing the packages needed}
The following packages are imported into the \texttt{notex.cls} class file:
\begin{tcolorbox}
\begin{verbatim}
\RequirePackage{xcolor} % Package for colors
\RequirePackage{tcolorbox} % Package for boxes
\RequirePackage[a4paper]{geometry} % Package for the geometry
% of the file
\RequirePackage{listings} % Package for code
\RequirePackage[T1]{fontenc} % Package for font encoding
\RequirePackage{fouriernc} % Package with the font
\RequirePackage{sourcecodepro}
\RequirePackage{notexmacros} % Package with macros
\end{verbatim}
\end{tcolorbox}
\pagebreak
\section{Custom colors}
There are some colors that are added from the class. This list reports all of them, alongside a quick preview:
\begin{center}
\begin{tabular}{c l}
\textbf{Color Preview} & \textbf{Name of the color} \\
\hline
\littlebox{maindoccol} & \makecell[l]{\texttt{maindoccol}} \\
\hline
\littlebox{theoryLINE} & \makecell[l]{\texttt{theoryLINE}} \\
\littlebox{practiceLINE} & \makecell[l]{\texttt{practiceLINE}} \\
\littlebox{curiosityLINE} & \makecell[l]{\texttt{curiosityLINE}} \\
\littlebox{remarkLINE} & \makecell[l]{\texttt{remarkLINE}} \\
\hline
\littlebox{lemmaBG} & \makecell[l]{\texttt{lemmaBG}} \\
\littlebox{lemmaTitleBG} & \makecell[l]{\texttt{lemmaTitleBG}} \\
\littlebox{definitionBG} & \makecell[l]{\texttt{definitionBG}} \\
\littlebox{definitionTitleBG} & \makecell[l]{\texttt{definitionTitleBG}} \\
\littlebox{corollaryBG} & \makecell[l]{\texttt{corollaryBG}} \\
\littlebox{corollaryTitleBG} & \makecell[l]{\texttt{corollaryTitleBG}} \\
\littlebox{proofBG} & \makecell[l]{\texttt{proofBG}} \\
\end{tabular}
\begin{tabular}{c l}
\textbf{Color Preview} & \textbf{Name of the color} \\
\hline
\littlebox{theoremBG} & \makecell[l]{\texttt{theoremBG}} \\
\littlebox{theoremTitleBG} & \makecell[l]{\texttt{theoremTitleBG}} \\
\littlebox{exerciseBG} & \makecell[l]{\texttt{exerciseBG}} \\
\littlebox{exerciseTitleBG} & \makecell[l]{\texttt{exerciseTitleBG}} \\
\littlebox{exampleBG} & \makecell[l]{\texttt{exampleBG}} \\
\littlebox{exampleTitleBG} & \makecell[l]{\texttt{exampleTitleBG}} \\
\littlebox{solutionBG} & \makecell[l]{\texttt{solutionBG}} \\
\littlebox{solutionTitleBG} & \makecell[l]{\texttt{solutionTitleBG}} \\
\hline
\littlebox{remarkBG} & \makecell[l]{\texttt{remarkBG}} \\
\littlebox{remarkTitleBG} & \makecell[l]{\texttt{remarkTitleBG}} \\
\hline
\littlebox{curiosityBG} & \makecell[l]{\texttt{curiosityBG}} \\
\littlebox{curiosityTitleBG} & \makecell[l]{\texttt{curiosityTitleBG}} \\
% Space adder
%\littlebox{white} & \\
\end{tabular}
\end{center}
\section{Commands of the class}
This class provides various commands, which allow to customize to your liking the template. Here is a list of all the supported (and provided) commands:
\begin{tcolorbox}
\verb|\maincol{format}{code}|
\tcblower
\begin{tabular}{r l}
\textbf{Examples}: & \verb|\maincol{HTML}{303342}| \\
& \verb|\maincol{RGB}{30, 25, 76}|
\end{tabular}
\end{tcolorbox}
\noindent Sets the main color for the document.
\begin{itemize}
\item [\texttt{format}] specifies the format of the color. Supports all the formats of the \texttt{xcolor} package;
\item [\texttt{code}] is the code of the color. Must match the format given by the previous parameter
\end{itemize}
\section{Loading of the class}
\section{Custom boxes}
The NoTeX class adds also some custom boxes, which are helpful when there is the need to mark some important parts of the text, such as definitions, theorems, proofs, code, etc... Here is a showcase of all the boxes and how they can interact with each other.
\begin{definition}{Uniform Resource Identifier (URI)}
A \textbf{Uniform Resource Identifier} (\textbf{URI} for short) is a unique sequence of characters which identifies a logical or physical resource. An example of URI might be:
\medskip
\texttt{https://thisisanexample.com/usernames}
\end{definition}
\begin{theorem}{Spectral Theorem}
Given a matrix $A$ which is \textbf{squared} ($A \in \mathbb{R}^{d \times d}$) and \textbf{symmetric} ($A \eq A^\top$), then \textbf{all the eigenvalues} $\lambda_i$ take \textbf{real values} and \textbf{all the eigenvectors} are \textbf{orthogonal}
\begin{proof}
This can be easily proved as follows:\\
\noindent The $\nabla$ is equal to 1\\
\noindent The matrices are equal
\end{proof}
\end{theorem}
\begin{lemma}{Running time of the algorithm}
If the algorithm receives as an input an ordered list of items, then its running time will be at most $O(n)$. If the list isn't ordered, then it will take at most $O(n \log(n))$
\begin{proof}
In order to prove this algorithm, we must first consider the running time of the sub-algorithm. Indeed, we'll obtain that:
\[ \text{runtime} \eq O(n \log(n)) + O(n) \]
\end{proof}
\end{lemma}
\begin{corollary}{Sum of internal angles of triangles}
Given any triangle, the sum of its internal angles will always be equal to $180\degree$. Moreover, if the triangle is equilateral, then all its angles will be equal to $60\degree$
\end{corollary}
\medskip
\noindent The \textbf{definition}, \textbf{theorem}, \textbf{lemma} and \textbf{corollary} boxes can be called with:
\begin{tcolorbox}
\begin{verbatim}
\begin{<box_type>}{<term>}
Your text...
\end{<box_type>}\end{verbatim}
\noindent where \verb|<box_type>| can be one between \texttt{definition}, \texttt{theorem}, \texttt{lemma} and \texttt{corollary}, while instead \verb|<term>| denotes the title of the box
\end{tcolorbox}
\noindent It is instead possible to invoke the \textbf{proof} box by using the following command:
\begin{tcolorbox}
\begin{verbatim}
\begin{proof}
Your proof...
\end{proof}\end{verbatim}
\end{tcolorbox}
\noindent The proof box can be used anywhere, it is however thought for the \textbf{theorem} and \textbf{lemma} boxes (since definitions and corollary should not need proofs).
\begin{exercise}
Solve the following equation:
\[ x^2 + \sin(3x-4) - 7 \eq 6 \]
\end{exercise}
\begin{example}
An example of limit is the following:
\[ \lim_{x \to 0} \log_{10}(x+1) \eq +\infty \]
\end{example}
\pagebreak
\begin{codeblock}{TestCode.py}
\begin{lstlisting}[language = Python]
def main():
for i in range(40):
print(i)
return None\end{lstlisting}
\end{codeblock}
\begin{terminal}
\begin{lstlisting}[style = notexterm]
$ mpicc 01-mpi-collectives.c -o 01-mpi-collectives.o\end{lstlisting}
\end{terminal}
\chapter{The title page}
NoTeX also offers the possibility of having a custom title page. Clearly, you are free to edit it to your liking. The template comes with some pre-defined values, and has the following structure:
\begin{center}
\begin{tikzpicture}
\node [inner sep=0pt] at (centerpoint) {
\setlength{\fboxsep}{0pt}
\setlength{\fboxrule}{0.5pt}
\fbox{\includegraphics[width=0.5\linewidth]{assets/title-page.pdf}}
};
\draw[red!60, thick, <-] (6.25, 8.15) -- (2.5, 8.15) node[anchor=east]{Header};
\draw[red!60, thick, <-] (4.5, 4.5) -- (2.5, 4.5) node[anchor=east]{Cover};
\draw[red!60, thick, <-] (6, 1.14) -- (2.5, 1.14) node[anchor=east]{Subtitle};
\draw[red!60, thick, <-] (9, 6.65) -- (12.75, 6.65) node[anchor=west]{Title};
\draw[red!60, thick, <-] (9, 1.35) -- (12.75, 1.35) node[anchor=west]{Author};
\draw[red!60, thick, <-] (8.5, -0.05) -- (12.75, -0.05) node[anchor=west]{Footer};
\end{tikzpicture}
\end{center}
You can edit the following parts by renewing the commands with the \verb|\renewcommand| command:
\begin{itemize}
\item \textbf{header}: renew \verb|\titleheader| with what you want to put into the header. You can put anything you'd like, images included;
\item \textbf{title}: renew \verb|\titlecourse| with the name of the course that would go on the title. Only text is allowed, any other item will result in unknown behaviour;
\item \textbf{cover}: renew \verb|\titlecover| with the path of the image you want to replace. Only paths are allowed, any other item will result in unknown behaviour;
\item \textbf{author}: renew \verb|\titleauthor| with your name. Only text is allowed, any other item will result in unknown behaviour;
\item \textbf{subtitle}: renew \verb|\titlesubtitle| with the subtitle that you desire. Only text is allowed, any other item will result in unknown behaviour;
\item \textbf{footer}: renew \verb|\titlefooter| with anything you want to put into the footer. You can put anything you'd like, images included.
\end{itemize}
If you don't like the title page, you are free to edit it or to add your own version. If you want a more "classic" title page, you can use the \verb|\title|, \verb|\author| and all the other standard commands provided by \LaTeX.
\begin{example}
The following example will produce the screenshot attached in the previous page:
\begin{codeblock}{main.tex}
\begin{lstlisting}[language = tex]
\renewcommand{\titleheader}{
{\Large \textbf{\textsc{Your University}}}
\linebreak
{\large \textsc{Your Course}}
\vspace{0.05cm}
{\normal \textsc{Xth Year, Xth Semester}}
}
\renewcommand{\titlecourse}{Course Title}
\renewcommand{\titlecover}{COURSE-bg.jpg}
\renewcommand{\titleauthor}{Your Name}
\renewcommand{\titlesubtitle}{Course taught by prof. X X}
\renewcommand{\titlefooter}{Your footer}\end{lstlisting}
\end{codeblock}
\end{example}
\chapter{The \texttt{notexmacros} package}
\noindent In this chapter the \texttt{notexmacro} package will be explained. Such package contains a collection of macros which can turn to be useful while using the class. The package is automatically required by the class, so you don't have to install anything else.
\\
\indent The macros are divided into two groups: the \textbf{math} macros and the \textbf{text} macros. The \textbf{math} macros are used within a math environment, while the text macros are not. There are some \textbf{general purpose} macros which can be used both inside and outside a \textbf{math} environment.
\section{The \texttt{math} macros}
\begin{tcolorbox}
\verb|\eq|
\end{tcolorbox}
\noindent Adds space around a $=$. An example follows:
\begin{center}
\verb|a \eq b| \becomes{20pt} $a \eq b$
\end{center}
\begin{tcolorbox}
\verb|\thus|
\end{tcolorbox}
\noindent Adds substantial space around a $\Longrightarrow$, and it can be used to define a logical implication (\textit{we have $A$, thus we can get $B$}). An example follows:
\begin{center}
\verb|a \thus b| \becomes{20pt} $a \thus b$
\end{center}
\begin{tcolorbox}
\verb|\nextline| and \verb|\prevline|
\end{tcolorbox}
\noindent Adds a $\Longrightarrow$ which can be used at the end (with \verb|\nextline|) or at the beginning (with \verb|\prevline|) of an equation. This can be used while passing from one line to the other of an equation which would usually need more than one line. An example follows:
\begin{center}
\verb|ax + b \nextline| \becomes{20pt} $ax + b \nextline$ \\
\verb|\prevline ax + c| \becomes{20pt} $\prevline ax + c$
\end{center}
\subsection{Specific macros for statistical distributions}
\begin{tcolorbox}
\verb|\cov|, \verb|\bino|, \verb|\berno|, \verb|\unif|, \verb|\geom|, \verb|\poiss| and \verb|\multin|
\end{tcolorbox}
\noindent Adds the function of the covariance and the following distributions: the binomial distribution, the Bernoulli distribution, the uniform distribution, the geometric distribution, the Poisson distribution and the multinomial distribution. An example follows:
\begin{center}
\begin{tabular}{c c c}
\verb|\cov(X)| & \becomes{20pt} & $\cov(X)$ \\ & & \\
\verb|X \sim \bino \sim \berno \sim \unif| & \becomes{20pt} & $X \sim \bino \sim \berno \sim \unif$ \\
\verb|\sim \geom \sim \poiss \sim \multin| & & $\sim \geom \sim \poiss \sim \multin$
\end{tabular}
\end{center}
\section{The \texttt{text} macros}
\begin{tcolorbox}
\verb|\angbrack{}|
\end{tcolorbox}
\noindent Wraps the content between two angle brackets. Works both in a \texttt{math} and in a non-\texttt{math} environment. An example follows:
\begin{center}
\verb|\angbrack{10}| \becomes{20pt} \angbrack{10}
\end{center}
\begin{tcolorbox}
\verb|\st|, \verb|\nd|, \verb|\rd| and \verb|\nth|
\end{tcolorbox}
\noindent Adds respectively the \textit{st}, the \textit{nd}, the \textit{rd} and the \textit{th} after a number. Works both in a \texttt{math} and in a non-\texttt{math} environment. An example follows:
\begin{center}
\verb|1\st, 2\nd, 3\rd, 4\nth| \becomes{20pt} 1\st, 2\nd, 3\rd, 4\nth
\end{center}
\end{document}