Debian Codegraph @

texmf-dist/doc/latex/hebdomon/HebdomonGuide.tex

raw
1 % Load the base class
2 \documentclass[minted, draw]{../tex/hebdomon}
3
4 \begin{document}
5
6 \title{Hebdomon \\ Report and Documentation Standard}
7 \author{v0.1 - Angry Avocado}
8 \StudentName{D. T. McGuiness}
9 \date{[email protected]}
10
11 \publishers{
12 \begin{tabular}[!b]{rl}
13 \textbf{Student Name} & xxxxx \\[3pt]
14 \textbf{Student Number} & xxxxx \\[3pt]
15 \textbf{Module Name} & xxxxx
16 \end{tabular}\\[20pt]
17 }
18
19 \maketitle
20 \dominitoc
21 \tableofcontents
22 \newpage
23
24 \Chapter{The Hebdomon Template}
25 \Section{Introduction}
26
27 This document is designed to abstract a significant portion of the
28 commands and MACROs to hide away the programming aspect and ease into
29 LaTeX programming. While some commands are have been changed \hlight{NO}
30 command has been overwritten so feel free to use the original ones
31 if you wish.
32
33 \begin{warning}
34 As to the best of the authors knowledge, the original commands should work
35 but the aesthetics may be compromised.
36 \end{warning}
37
38 \Section{Title Formatting}
39
40 To begin a new content, always start the content with a chapter heading. To
41 insert the chapter with an additional \lstinline[columns=fixed]{minitoc}
42 use \lstinline[columns=fixed]{\Chapter}, which produces an heading as
43 you see at the beginning of this page, to have a heading without
44 a \lstinline[columns=fixed]{minitoc} use the standard
45 \lstinline[columns=fixed]{\chapter}.
46
47 The document relies on the user to use the \hlight{correct} title commands to
48 keep the formatting consistent. The commands that starting with a
49 capital letter are the overloaded commands of the standard ones.
50 The following are the current ones:
51 %
52 \begin{code}{python}
53 \Chapter{...}
54 \Section{...}
55 \Subsection{...}
56 \Subsubsection{...}
57 \end{code}
58 %
59 \begin{warning}
60 Unless there is a specific reason, it is suggested to use the aforementioned
61 commands. However, original LaTeX command should work as well if you want to use.
62 \end{warning}
63
64 \Subsection{Page Geometry}
65
66 The page geometry is set to the following settings. This is done using the
67 standard package \pcode{\usepackage{geometry}} which is defined in the
68 \pcode{Hebdomon.cls}.
69 %
70 \begin{itemize}[leftmargin=!,labelindent=-29.2pt]
71 \item[\textbf{top}] 2.5cm,
72 \item[\textbf{right}] 2.0cm,
73 \item[\textbf{bottom}] 2.5cm,
74 \item[\textbf{left}] 3.0cm.
75 \end{itemize}
76 %
77 \Section{Image Positioning}
78 %
79 The image positioning could be done with the following code snippet:
80 %
81 \begin{code}{latex}
82 \begin{figure}[ht]
83 \centering
84 \includegraphics[options]{figures/path.pdf}
85 \caption{\label{fig:label} }
86 \end{figure}
87 \end{code}
88 %
89 Here there are a few options worth mentioning:
90 %
91 \begin{hgitemize}
92 \item[\pcode{figures/path}] The place where the image is kept. If the
93 image is in the same folder where the main.tex file resides, it is as
94 simple as writing the files name. If the file is in a folder called
95 image, just write \pcode{image/innsbruck.jpg}. Finally if the image is
96 in a higher directory (i.e., image is in folderA/innsbruck.jpg and the
97 main tex is in folderA/document/main.tex then the path becomes \pcode{../innsbruck.jpg}
98 \item[\pcode{\caption{..}}] Where you write the caption of the image.
99 For consistency make sure every image has a caption as if the image does not
100 need a caption, maybe it not be present to begin with.
101 \item[\pcode{label{}}] This is an identifier for you to use when you need
102 to cite this Figure in a place somewhere. For example if you were to have
103 and image with the following:
104 \end{hgitemize}
105 %
106 \begin{code}{latex}
107 \begin{figure}[ht]
108 \centering
109 \includegraphics[width=\textwidth]{figures/path.pdf}
110 \caption{A photo I found on the web.}\label{fig:innsbruck}
111 \end{figure}
112 \end{code}
113 %
114 \begin{hgitemize}
115 \item[] Now this image is referenced as \pcode{fig:innsbruck}, which
116 means if we write the following:
117 \end{hgitemize}
118 %
119 \begin{code}{text}
120 To see the image, have a look at Figure \ref{fig:innsbruck}
121 \end{code}
122 %
123 This line of command will be presented as
124 %
125 \begin{excerpt}
126 To see the image, have a look at Figure 1.1.
127 \end{excerpt}
128 %
129 Finally you can see the image here as well.
130 %
131 \begin{figure}[ht]
132 \centering
133 \includegraphics[width=\linewidth]{figures/innsbruck.jpg}
134 \caption{The famous Innsbruck houses near the river Inn. This image is
135 placed with a width value of \pcode{width=\linewidth}. This is also
136 a good opportunity to showcase the hanging behaviour of the figure
137 caption.}
138 \end{figure}
139 %
140 \Section{Defined Environments}
141 %
142 \begin{hgitemize}
143 \item[\pcode{excerpt}] The template relies on the excellent \lstinline[columns=fixed]{tcolorbox}
144 package for formatting the boxes within the document and for that end different styles were created.
145 \item[] Sometimes one needs to quote either a proverb or to create drama, for this use
146 the \lstinline[columns=fixed]{excerpt} environment with the following notation and effect.
147 \end{hgitemize}
148 %
149 \begin{code}{latex}
150 \begin{excerpt}
151 To be, or not to be...
152 \end{excerpt}
153 \end{code}
154 %
155 \begin{hgitemize}
156 \item[] Compiling this code snippet would show as in the document
157 \end{hgitemize}
158 %
159 \begin{excerpt}
160 To be, or not to be...
161 \end{excerpt}
162 %
163 \begin{itemize}[leftmargin=!,labelindent=-29.2pt]
164 \item[\pcode{code}] During the preparation of your document, it is useful to showcase
165 some code either in the shape of all the document or a snippet of it.
166 There are two (\hlight{2}) ways of doing this where the first one will be discussed here.
167 \item[] For example to print out a hello world in python, please use the following environment
168 \end{itemize}
169 %
170 \begin{verbatim}
171 \begin{code}{python}
172 print("Hello, World!")
173 \end{code}
174 \end{verbatim}
175 %
176 Producing the following:
177 %
178 \begin{code}{python}
179 print("Hello, World!")
180 \end{code}
181 %
182 The class also come with some predefined environments to modify the behaviour/aesthetics of the document.
183 %
184 Highlighting text is \hlight{very easy}, here is an example on how to write one.
185
186 \begin{code}{latex}
187 Highlighting text is \hlight{very easy}, here is an example:
188 \end{code}
189
190 \begin{itemize}[leftmargin=!,labelindent=-29.2pt]
191 \item[\pcode{example}] Sometimes you need to showcase an example or
192 need to highlight a certain idea.
193 For these things the environment Example could be useful.
194 \item[] For example to show as simple example or give a slight attention to a topic you can do the following.
195 \end{itemize}
196
197 \begin{example}
198 This is an example. This could be anything which you would like to have a certain amount of
199 attention but not too much as to distract from the flow of the document.
200 \end{example}
201
202 \begin{itemize}[leftmargin=!,labelindent=-29.2pt]
203 \item[\pcode{highlight}] Or sometimes you need to give a clear break to the flow of the
204 document and ask the reader to look at your banner. For that use highlight.
205 \end{itemize}
206
207 \begin{highlight}
208 Hey! Pay attention as this is a highlight box.
209 \end{highlight}
210
211 \Subsection{Writing Equations}
212 %
213 One of the strong suits of LaTeX compared to other editors and programs is
214 it simplicity and ease of use methods of writing equations. Consider the
215 following equation:
216 %
217 \begin{equation*}
218 f(x) = x^2 + 2x + 1
219 \end{equation*}
220 %
221 In code form this would be written as:
222 %
223 \begin{code}{latex}
224 \begin{equation*}
225 f(x) = x^2 + 2x + 1
226 \end{equation*}
227 \end{code}
228 %
229 All equations that has their newline and centre staged are mostly written
230 in an environment where it has a \pcode{begin} and an \pcode{end}. You may
231 have noticed the asterisks sign just after the equation. This implies the
232 environment is \hlight{not numbered}, meaning you won't be able to
233 reference it. This is used to limit the numbering of equations to just the
234 essential parts in the document and not reach 3 digits by the time you are
235 in page 8. For a numbered equation like the following
236 %
237 \begin{equation}
238 f(x) = x^2 + 2x + 1
239 \end{equation}
240 %
241 You only need to do:
242 %
243 \begin{code}{latex}
244 \begin{equation}\label{eq:quad}
245 f(x) = x^2 + 2x + 1
246 \end{equation}
247 \end{code}
248 %
249 where \pcode{\label{eq:quad}} is the equation reference label.
250 %
251 You could also make matrices as well as \pcode{amsmath} is preloaded into this template.
252 %
253 \Subsection{Designing a Table}
254 %
255 Finally, no template is done without someone telling you how a table should be designed.
256 %
257 Below is a standard table
258 %
259 \begin{table}[!ht]
260 \begin{NiceTabular}{rX}[rules/color=[gray]{0.9},rules/width=1pt]
261 \CodeBefore
262 \rowcolors{1}{black!5}{}
263 \rowcolors{3}{blue!5}{}
264 \Body
265 \toprule
266 \textbf{Section} & \textbf{Scientific Method Step} \\
267 \midrule
268 \textbf{Introduction} & states your hypothesis \\
269 \textbf{Methods} & details how you tested your hypothesis \\
270 \textbf{Results} & provides raw (i.e., uninterpreted) data collected \\
271 \textbf{Discussion} & considers whether the data you obtained support the hypothesis \\
272 \bottomrule
273 \end{NiceTabular}
274 \caption{A Detailed look into the scientific method.}
275 \end{table}
276 %
277 And the code used to generate it:
278 %
279 \begin{code}{latex}
280 \begin{table}[!ht]
281 \begin{NiceTabular}{rX}[rules/color=[gray]{0.9},rules/width=1pt]
282 \CodeBefore
283 \rowcolors{1}{black!5}{}
284 \rowcolors{3}{blue!5}{}
285 \Body
286 \toprule
287 \textbf{Section} & \textbf{Scientific Method Step} \\
288 \midrule
289 \textbf{Introduction} & states hypothesis \\
290 \textbf{Methods} & how you tested hypothesis \\
291 \textbf{Results} & provides raw data collected \\
292 \textbf{Discussion} & whether it support the hypothesis \\
293 \bottomrule
294 \end{NiceTabular}
295 \caption{A Detailed look into the scientific method.}
296 \end{table}
297 \end{code}
298
299 \Chapter{Plotting your data using PGF/TikZ}
300
301 \Section{Introduction}
302
303 PGFplots and Tikz are powerful scripting languages allowing you to draw high-quality diagrams
304 using only a programming language. PGFplots are generally used for plotting data from a wide
305 variety of representations from simple 2D plots to complex 3D geometries.
306 \\
307 But wikipedia description put it best:
308
309 \begin{excerpt}
310 PGF/TikZ is a pair of languages for producing vector graphics
311 (e.g., technical illustrations and drawings) from a geometric/algebraic description, with
312 standard features including the drawing of points, lines, arrows, paths, circles,
313 ellipses and polygons. PGF is a lower-level language, while TikZ is a set of higher-level
314 macros that use PGF. The top-level PGF and TikZ commands are invoked as TeX macros,
315 but in contrast with PSTricks, the PGF/TikZ graphics themselves are described in a
316 language that resembles MetaPost.
317 \end{excerpt}
318
319 For more info please look at the documentation \href{https://tikz.dev/pgfplots/}{here}.
320 It is of course up to the user to select which graphical software to produce the necessary
321 visual components but unless it requires complex functions/processing, it would be be easier
322 to have it in PGF/TikZ format for easy editing/maintenance.
323
324 For this manual we will be looking at the three (\hlight{3}) plot types you may
325 encounter in your studies.
326 %
327 \Subsection{A Simple 2D Plot}
328 %
329 2D plots are simple yet powerful to show the relation of a single parameters
330 and its related function.
331 Below is an example of a simple comparison of two (\hlight{2}) functions.
332 %
333 \begin{figure}[!ht]
334 \centering
335 \begin{tikzpicture}
336 \begin{axis}[hebdomon, xlabel = \(x\), ylabel = {\(f(x)\)}]
337 %
338 \addplot [domain=-10:10, samples=100,red]{x^3 - 7*x - 1};
339 \addlegendentry{\(x^2 - 2x - 1\)}
340 %
341 \addplot [domain=-10:10, samples=100, blue]{x^2 + 6*x + 8};
342 %
343 \addlegendentry{\(x^2 + 2x + 1\)}
344 %
345 \end{axis}
346 \end{tikzpicture}
347 \caption{This is an example of a 2D PGF plot comparing
348 two functions where these functions are calculated using
349 PGF itself rather than entering/reading from data.}
350 \end{figure}
351 %
352 The image above is generated using the following code:
353
354 \begin{code}{latex}
355 \begin{figure}[!ht]
356 \centering
357 \begin{tikzpicture}
358 \begin{axis}[hebdomon, xlabel = \(x\), ylabel = {\(f(x)\)}]
359 %
360 \addplot [domain=-10:10, samples=100,red]{x^3 - 7*x - 1};
361 \addlegendentry{\(x^2 - 2x - 1\)}
362 %
363 \addplot [domain=-10:10, samples=100, blue]{x^2 + 6*x + 8};
364 %
365 \addlegendentry{\(x^2 + 2x + 1\)}
366 %
367 \end{axis}
368 \end{tikzpicture}
369 \caption{This is an example of a 2D PGF plot comparing
370 two functions where these functions are calculated using
371 PGF itself rather than entering/reading from data.}
372 \end{figure}
373 \end{code}
374
375 As can be seen it is relatively standard to create plots. Some aspect
376 which need mentioning.
377
378 \begin{hgitemize}
379 \item[\pcode{\addplot}] You invoke this command when you want to
380 create a plot. In the square brackets (i.e., []) you insert your
381 \hlight{configuration} of your plot. The most important ones are
382 \begin{itemize}
383 \item[\pcode{domain}] the range in which the function will be
384 calculated
385 \item[\pcode{sample}] the number of calculations will be done
386 within the defined domain.
387 \end{itemize}
388 \end{hgitemize}
389
390 \Subsection{Plotting 3D plots}
391
392 Plotting data with PGFplots is also quite possible and will generate
393 great plot (as long as it is not massively complicated). For more
394 information on the precautions on designing 3D plots, please have a look
395 at \href{https://tikz.dev/pgfplots/reference-3dplots}{here}.
396
397 Below is the prototypical plot to showcase the 3D capabilities of PGF:
398
399 \begin{figure}[!ht]
400 \centering
401 \begin{tikzpicture}
402 \begin{axis}[view={25}{30},mark layer=like plot]
403 \addplot3 [
404 surf,
405 shader=faceted,
406 fill opacity=0.75,
407 samples=25,
408 domain=-4:4,
409 y domain=-4:4,
410 on layer=main,
411 ] {x^2-y^2};
412 \end{axis}
413 \end{tikzpicture}
414 \caption{An example 3D plot done wit PGFplots.}
415 \end{figure}
416
417 And, of course the code for generating the plot is given as follows:
418
419 \begin{code}{latex}
420 \begin{figure}[!ht]
421 \centering
422 \begin{tikzpicture}
423 \begin{axis}[view={25}{30},mark layer=like plot]
424 \addplot3 [
425 surf,
426 shader=faceted,
427 fill opacity=0.75,
428 samples=25,
429 domain=-4:4,
430 y domain=-4:4,
431 on layer=main,
432 ] {x^2-y^2};
433 \end{axis}
434 \end{tikzpicture}
435 \caption{An example 3D plot done wit PGFplots.}
436 \end{figure}
437 \end{code}
438
439 Some options worth mentioning are as follows:
440
441 \begin{hgitemize}
442 \item[\pcode{surf}] Generates a \hlight{surface} based on the 2D
443 data it was given (in this case these are $x$ and $y$.
444 \item[\pcode{shader}] Describes, basically how each segment should be
445 filled.
446 \item[\pcode{samples}] Similar to 2D plots, tells how many data points will
447 be measured. However, make a note that 3D is significantly more taxing
448 on the TeX memory than 2D and making this sampling high may result in
449 exceeding the memory limit.
450 \end{hgitemize}
451
452 \end{document}
453
454 %%% Local Variables:
455 %%% coding: utf-8
456 %%% mode: latex
457 %%% TeX-command-extra-options: "-shell-escape"
458 %%% TeX-master: t
459 %%% TeX-engine: luatex
460 %%% End:
461