319 lines
18 KiB
TeX
319 lines
18 KiB
TeX
%% intro.tex
|
|
%% Copyright (C) 2014-2020 by Thomas Auzinger <thomas@auzinger.name>
|
|
%
|
|
% This work may be distributed and/or modified under the
|
|
% conditions of the LaTeX Project Public License, either version 1.3
|
|
% of this license or (at your option) any later version.
|
|
% The latest version of this license is in
|
|
% http://www.latex-project.org/lppl.txt
|
|
% and version 1.3 or later is part of all distributions of LaTeX
|
|
% version 2005/12/01 or later.
|
|
%
|
|
% This work has the LPPL maintenance status `maintained'.
|
|
%
|
|
% The Current Maintainer of this work is Thomas Auzinger.
|
|
%
|
|
% This work consists of the files vutinfth.dtx and vutinfth.ins
|
|
% and the derived file vutinfth.cls.
|
|
% This work also consists of the file intro.tex.
|
|
|
|
|
|
\newacronym{ctan}{CTAN}{Comprehensive TeX Archive Network}
|
|
\newacronym{faq}{FAQ}{Frequently Asked Questions}
|
|
\newacronym{pdf}{PDF}{Portable Document Format}
|
|
\newacronym{svn}{SVN}{Subversion}
|
|
\newacronym{wysiwyg}{WYSIWYG}{What You See Is What You Get}
|
|
|
|
\newglossaryentry{texteditor}
|
|
{
|
|
name={editor},
|
|
description={A text editor is a type of program used for editing plain text files.}
|
|
}
|
|
|
|
\chapter{Introduction to \LaTeX}
|
|
|
|
Since \LaTeX\ is widely used in academia and industry, there exists a plethora of freely accessible introductions to the language.
|
|
Reading through the guide at \url{https://en.wikibooks.org/wiki/LaTeX} serves as a comprehensive overview for most of the functionality and is highly recommended before starting with a thesis in \LaTeX.
|
|
|
|
\section{Installation}
|
|
|
|
A full \LaTeX\ distribution\index{distribution} consists not only of the binaries that convert the source files to the typeset documents, but also of a wide range of packages and their documentation.
|
|
Depending on the operating system, different implementations are available as shown in Table~\ref{tab:distrib}.
|
|
\textbf{Due to the large amount of packages that are in everyday use and due to their high interdependence, it is paramount to keep the installed distribution\index{distribution} up to date.}
|
|
Otherwise, obscure errors and tedious debugging ensue.
|
|
|
|
\begin{table}
|
|
\centering
|
|
\begin{tabular}{cccc}
|
|
\toprule
|
|
Distribution & Unix & Windows & MacOS \\
|
|
\midrule
|
|
TeX Live & \textbf{yes} & yes & (yes) \\
|
|
MacTeX & no & no & \textbf{yes} \\
|
|
MikTeX & (yes) & \textbf{yes} & yes \\
|
|
\bottomrule
|
|
\end{tabular}
|
|
\caption{\TeX/\LaTeX\ distributions for different operating systems. Recomended choice in \textbf{bold}.}
|
|
\label{tab:distrib} % \label has to be placed AFTER \caption to produce correct cross-references.
|
|
\end{table}
|
|
|
|
\section{Editors}
|
|
|
|
A multitude of \TeX\ \glspl{texteditor} are available differing in their editing models, their supported operating systems and their feature sets.
|
|
A comprehensive overview of \glspl{texteditor} can be found at the Wikipedia page \url{https://en.wikipedia.org/wiki/Comparison_of_TeX_editors}.
|
|
TeXstudio (\url{http://texstudio.sourceforge.net/}) is recommended.
|
|
Most editors support a synchronization of the generated document and the \LaTeX\ source by \verb|Ctrl| clicking either on the source document or the generated document.
|
|
|
|
\section{Compilation}
|
|
|
|
Modern editors usually provide the compilation programs to generate \gls{pdf} documents and for most \LaTeX\ source files, this is sufficient.
|
|
More advanced \LaTeX\ functionality, such as glossaries and bibliographies, needs additional compilation steps, however.
|
|
It is also possible that errors in the compilation process invalidate intermediate files and force subsequent compilation runs to fail.
|
|
It is advisable to delete intermediate files (\verb|.aux|, \verb|.bbl|, etc.), if errors occur and persist.
|
|
All files that are not generated by the user are automatically regenerated.
|
|
To compile the current document, the steps as shown in Table~\ref{tab:compile} have to be taken.
|
|
|
|
|
|
\begin{table}
|
|
\centering
|
|
\begin{tabular}{rl}
|
|
\toprule
|
|
& Description \\
|
|
\midrule
|
|
1 & Scan for refs, toc/lof/lot/loa items and cites \\
|
|
2 & Build the bibliography \\
|
|
3 & Link refs and build the toc/lof/lot/loa \\
|
|
4 & Link the bibliography \\
|
|
5 & Build the glossary \\
|
|
6 & Build the acronyms \\
|
|
7 & Build the index \\
|
|
8 & Link the glossary, acronyms, and the index \\
|
|
9 & Link the bookmarks \\
|
|
\midrule
|
|
& Command \\
|
|
\midrule
|
|
1 & \verb|pdflatex.exe example| \\
|
|
2 & \verb|bibtex.exe example| \\
|
|
3 & \verb|pdflatex.exe example| \\
|
|
4 & \verb|pdflatex.exe example| \\
|
|
5 & \verb|makeindex.exe -t example.glg -s example.ist| \\
|
|
& \verb| -o example.gls example.glo| \\
|
|
6 & \verb|makeindex.exe -t example.alg -s example.ist| \\
|
|
& \verb| -o example.acr example.acn| \\
|
|
7 & \verb|makeindex.exe -t example.ilg -o example.ind example.idx| \\
|
|
8 & \verb|pdflatex.exe example| \\
|
|
9 & \verb|pdflatex.exe example| \\
|
|
\bottomrule
|
|
\end{tabular}
|
|
\caption{Compilation steps for this document. The following abbreviations were used: table of contents (toc), list of figures (lof), list of tables (lot), list of algorithms (loa).}
|
|
\label{tab:compile} % \label has to be placed AFTER \caption to produce correct cross-references.
|
|
\end{table}
|
|
|
|
|
|
\section{Basic Functionality}
|
|
|
|
In this section, various examples are given of the fundamental building blocks used in a thesis.
|
|
Many \LaTeX\ commands have a rich set of options that can be supplied as optional arguments.
|
|
The documentation of each command should be consulted to get an impression of the full spectrum of its functionality.
|
|
|
|
\subsection{Floats}
|
|
|
|
Two main categories of page elements can be differentiated in the usual \LaTeX\ workflow: \textit{(i)} the main stream of text and \textit{(ii)} floating containers that are positioned at convenient positions throughout the document.
|
|
In most cases, tables, plots, and images are put into such containers since they are usually positioned at the top or bottom of pages.
|
|
These are realized by the two environments \verb|figure| and \verb|table|, which also provide functionality for cross-referencing (see Table~\ref{tab:intro} and Figure~\ref{fig:intro}) and the generation of corresponding entries in the list of figures and the list of tables.
|
|
Note that these environments solely act as containers and can be assigned arbitrary content.
|
|
|
|
\subsection{Tables}
|
|
|
|
A table in \LaTeX\ is created by using a \verb|tabular| environment or any of its extensions, e.g., \verb|tabularx|.
|
|
The commands \verb|\multirow| and \verb|\multicolumn| allow table elements to span multiple rows and columns.
|
|
|
|
\begin{table}[h] % placement specifier
|
|
\centering
|
|
\begin{tabular}{lll}
|
|
\toprule
|
|
\multicolumn{2}{c}{Position} \\
|
|
\cmidrule{1-2} % partial horizontal rule
|
|
Group & Abbrev & Name \\
|
|
\midrule
|
|
Goalkeeper & GK & Paul Robinson \\
|
|
\midrule
|
|
\multirow{4}{*}{Defenders} & LB & Lucus Radebe \\
|
|
& DC & Michael Duburry \\
|
|
& DC & Dominic Matteo \\
|
|
& RB & Didier Domi \\
|
|
\midrule
|
|
\multirow{3}{*}{Midfielders} & MC & David Batty \\
|
|
& MC & Eirik Bakke \\
|
|
& MC & Jody Morris \\
|
|
\midrule
|
|
Forward & FW & Jamie McMaster \\
|
|
\midrule
|
|
\multirow{2}{*}{Strikers} & ST & Alan Smith \\
|
|
& ST & Mark Viduka \\
|
|
\bottomrule
|
|
\end{tabular}
|
|
\caption{Adapted example from the \LaTeX guide at \url{https://en.wikibooks.org/wiki/LaTeX/Tables}. This example uses rules specific to the \texttt{booktabs} package and employs the multi-row functionality of the \texttt{multirow} package.}
|
|
\label{tab:intro} % \label has to be placed AFTER \caption to produce correct cross-references.
|
|
\end{table}
|
|
|
|
\subsection{Images}
|
|
|
|
An image is added to a document via the \verb|\includegraphics| command as shown in Figure~\ref{fig:intro}.
|
|
The \verb|\subcaption| command can be used to reference subfigures, such as Figure~\ref{fig:intro:full width} and~\ref{fig:intro:half width}.
|
|
|
|
\begin{figure}[h]
|
|
\centering
|
|
\begin{subfigure}[b]{0.45\columnwidth}
|
|
\centering
|
|
\includegraphics[width=\textwidth]{Logo-schwarz.pdf}
|
|
\subcaption{The header logo at text width.}
|
|
\label{fig:intro:full width}
|
|
\end{subfigure}
|
|
\begin{subfigure}[b]{0.45\columnwidth}
|
|
\centering
|
|
\includegraphics[width=0.5\textwidth]{Logo-schwarz.pdf}
|
|
\subcaption{The header logo at half the text width.}
|
|
\label{fig:intro:half width}
|
|
\end{subfigure}
|
|
\caption[Optional caption for the figure list (often used to abbreviate long captions)]{The header logo at different sizes.} % Remove the [...] argument if the original caption should be used in the figure list.
|
|
\label{fig:intro} % \label has to be placed AFTER \caption (or \subcaption) to produce correct cross-references.
|
|
\end{figure}
|
|
|
|
\subsection{Mathematical Expressions}
|
|
|
|
One of the original motivation to create the \TeX\ system was the need for mathematical typesetting.
|
|
To this day, \LaTeX\ is the preferred system to write math-heavy documents and a wide variety of functions aids the author in this task.
|
|
A mathematical expression can be inserted inline as $\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}$ outside of the text stream as \[ \sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6} \] or as numbered equation with
|
|
\begin{equation}
|
|
\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}.
|
|
\end{equation}
|
|
|
|
\subsection{Pseudo Code}
|
|
|
|
The presentation of algorithms can be achieved with various packages; the most popular are \verb|algorithmic|, \verb|algorithm2e|, \verb|algorithmicx|, or \verb|algpseudocode|.
|
|
An overview is given at \url{https://tex.stackexchange.com/questions/229355}.
|
|
An example of the use of the \verb|alogrithm2e| package is given with Algorithm~\ref{alg:gauss-seidel}.
|
|
|
|
\begin{algorithm}
|
|
\SetKw{BreakFor}{break for}
|
|
\KwIn{A scalar~$\epsilon$, a matrix $\mathbf{A} = (a_{ij})$, a vector $\vec{b}$, and an initial vector $\vec{x}^{(0)}$}
|
|
\KwOut{$\vec{x}^{(n)}$ with $\mathbf{A} \vec{x}^{(n)} \approx \vec{b}$}
|
|
\For{$k\leftarrow 1$ \KwTo maximum iterations}
|
|
{
|
|
\For{$i\leftarrow 1$ \KwTo $n$}
|
|
{
|
|
$x_i^{(k)} = \frac{1}{a_{ii}} \left(b_i-\sum_{j<i} a_{ij} x_j^{(k)} - \sum_{j>i} a_{ij} x_j^{(k-1)} \right)$\;
|
|
}
|
|
\If{$\lvert\vec{x}^{(k)}-\vec{x}^{(k-1)}\rvert < \epsilon$}
|
|
{\BreakFor\;}
|
|
}
|
|
\Return{$\vec{x}^{(k)}$\;}
|
|
\caption{Gauss-Seidel}
|
|
\label{alg:gauss-seidel} % \label has to be placed AFTER \caption to produce correct cross-references.
|
|
\end{algorithm}
|
|
|
|
\section{Bibliography}
|
|
|
|
The referencing of prior work is a fundamental requirement of academic writing and well supported by \LaTeX.
|
|
The \textsc{Bib}\TeX\ reference management software is the most commonly used system for this purpose.
|
|
Using the \verb|\cite| command, it is possible to reference entries in a \verb|.bib| file out of the text stream, e.g., as~\cite{Turing1936}.
|
|
The generation of the formatted bibliography needs a separate execution of \verb|bibtex.exe| (see Table~\ref{tab:compile}).
|
|
|
|
\section{Table of Contents}
|
|
|
|
The table of contents is automatically built by successive runs of the compilation, e.g., of \verb|pdflatex.exe|.
|
|
The command \verb|\setsecnumdepth| allows the specification of the depth of the table of contents and additional entries can be added to the table of contents using \verb|\addcontentsline|.
|
|
The starred versions of the sectioning commands, i.e., \verb|\chapter*|, \verb|\section*|, etc., remove the corresponding entry from the table of contents.
|
|
|
|
\section{Acronyms / Glossary / Index}
|
|
|
|
The list of acronyms, the glossary, and the index need to be built with a separate execution of \verb|makeindex| (see Table~\ref{tab:compile}).
|
|
Acronyms have to be specified with \verb|\newacronym| while glossary entries use \verb|\newglossaryentry|.
|
|
Both are then used in the document content with one of the variants of \verb|\gls|, such as \verb|\Gls|, \verb|\glspl|, or \verb|\Glspl|.
|
|
Index items are simply generated by placing \verb|\index|\marg{entry} next to all the words that correspond to the index entry \meta{entry}.
|
|
Note that many enhancements exist for these functionalities and the documentation of the \verb|makeindex| and the \verb|glossaries| packages should be consulted.
|
|
|
|
\section{Tips}
|
|
|
|
Since \TeX\ and its successors do not employ a \gls{wysiwyg} editing scheme, several guidelines improve the readability of the source content:
|
|
\begin{itemize}
|
|
\item Each sentence in the source text should start with a new line.
|
|
This helps not only the user navigation through the text, but also enables revision control systems (e.g. \gls{svn}, Git) to show the exact changes authored by different users.
|
|
Paragraphs are separated by one (or more) empty lines.
|
|
\item Environments, which are defined by a matching pair of \verb|\begin{name}| and \verb|\end{name}|, can be indented by whitespace to show their hierarchical structure.
|
|
\item In most cases, the explicit use of whitespace (e.g. by adding \verb|\hspace{4em}| or \verb|\vspace{1.5cm}|) violates typographic guidelines and rules.
|
|
Explicit formatting should only be employed as a last resort and, most likely, better ways to achieve the desired layout can be found by a quick web search.
|
|
\item The use of bold or italic text is generally not supported by typographic considerations and the semantically meaningful \verb|\emph{|\texttt{$\dots$}\verb|}| should be used.
|
|
\end{itemize}
|
|
|
|
The predominant application of the \LaTeX\ system is the generation of \gls{pdf} files via the \textsc{Pdf}\LaTeX\ binaries.
|
|
In the current version of \textsc{Pdf}\LaTeX, it is possible that absolute file paths and user account names are embedded in the final \gls{pdf} document.
|
|
While this poses only a minor security issue for all documents, it is highly problematic for double blind reviews.
|
|
The process shown in Table~\ref{tab:ps2pdf} can be employed to strip all private information from the final \gls{pdf} document.
|
|
|
|
\begin{table}[h]
|
|
\centering
|
|
\begin{tabular}{rl}
|
|
\toprule
|
|
& Command \\
|
|
\midrule
|
|
1 & Rename the \gls{pdf} document \verb|final.pdf| to \verb|final.ps|. \\
|
|
2 & Execute the following command: \\
|
|
& \verb|ps2pdf -dPDFSETTINGS#/prepress ^| \\
|
|
& \verb| -dCompatibilityLevel#1.4 ^| \\
|
|
& \verb| -dAutoFilterColorImages#false ^| \\
|
|
& \verb| -dAutoFilterGrayImages#false ^| \\
|
|
& \verb| -dColorImageFilter#/FlateEncode ^| \\
|
|
& \verb| -dGrayImageFilter#/FlateEncode ^| \\
|
|
& \verb| -dMonoImageFilter#/FlateEncode ^| \\
|
|
& \verb| -dDownsampleColorImages#false ^| \\
|
|
& \verb| -dDownsampleGrayImages#false ^| \\
|
|
& \verb| final.ps final.pdf| \\
|
|
\bottomrule
|
|
\end{tabular}
|
|
|
|
On Unix-based systems, replace \verb|#| with \verb|=| and \verb|^| with \verb|\|.
|
|
\caption{Anonymization of \gls{pdf} documents.}
|
|
\label{tab:ps2pdf}
|
|
\end{table}
|
|
|
|
\section{Resources}
|
|
|
|
\subsection{Useful Links}
|
|
|
|
In the following, a listing of useful web resources is given.
|
|
\begin{description}
|
|
\item[\url{https://en.wikibooks.org/wiki/LaTeX}] An extensive wiki-based guide to \LaTeX.
|
|
\item[\url{http://www.tex.ac.uk/faq}] A (huge) set of \gls{faq} about \TeX\ and \LaTeX.
|
|
\item[\url{https://tex.stackexchange.com/}] The definitive user forum for non-trivial \LaTeX-related questions and answers.
|
|
\end{description}
|
|
|
|
\subsection[Comprehensive TeX Archive Network]{\gls{ctan}}
|
|
|
|
The \gls{ctan} is the official repository for all \TeX\ related material.
|
|
It can be accessed via \url{https://www.ctan.org/} and hosts (among other things) a huge variety of packages that provide extended functionality for \TeX\ and its successors.
|
|
Note that most packages contain \gls{pdf} documentation that can be directly accessed via \gls{ctan}.
|
|
|
|
In the following, a short, non-exhaustive list of relevant \gls{ctan}-hosted packages is given together with their relative path.
|
|
\begin{description}[itemsep=0ex]
|
|
\item[\href{https://www.ctan.org/pkg/algorithm2e}{algorithm2e}] Functionality for writing pseudo code.
|
|
\item[\href{https://www.ctan.org/pkg/amsmath}{amsmath}] Enhanced functionality for typesetting mathematical expressions.
|
|
\item[\href{https://www.ctan.org/pkg/amsfonts}{amssymb}] Provides a multitude of mathematical symbols.
|
|
\item[\href{https://www.ctan.org/pkg/booktabs}{booktabs}] Improved typesetting of tables.
|
|
\item[\href{https://www.ctan.org/pkg/enumitem}{enumitem}] Control over the layout of lists (\verb|itemize|, \verb|enumerate|, \verb|description|).
|
|
\item[\href{https://www.ctan.org/pkg/fontenc}{fontenc}] Determines font encoding of the output.
|
|
\item[\href{https://www.ctan.org/pkg/glossaries}{glossaries}] Create glossaries and list of acronyms.
|
|
\item[\href{https://www.ctan.org/pkg/graphicx}{graphicx}] Insert images into the document.
|
|
\item[\href{https://www.ctan.org/pkg/inputenc}{inputenc}] Determines encoding of the input.
|
|
\item[\href{https://www.ctan.org/pkg/l2tabu}{l2tabu}] A description of bad practices when using \LaTeX.
|
|
\item[\href{https://www.ctan.org/pkg/mathtools}{mathtools}] Further extension of mathematical typesetting.
|
|
\item[\href{https://www.ctan.org/pkg/memoir}{memoir}] The document class on upon which the \verb|vutinfth| document class is based.
|
|
\item[\href{https://www.ctan.org/pkg/multirow}{multirow}] Allows table elements to span several rows.
|
|
\item[\href{https://www.ctan.org/pkg/pgfplots}{pgfplots}] Function plot drawings.
|
|
\item[\href{https://www.ctan.org/pkg/pgf}{pgf/TikZ}] Creating graphics inside \LaTeX\ documents.
|
|
\item[\href{https://www.ctan.org/pkg/subcaption}{subcaption}] Allows the use of subfigures and enables their referencing.
|
|
\item[\href{https://www.ctan.org/tex-archive/info/symbols/comprehensive/}{symbols/comprehensive}] A listing of around 5000 symbols that can be used with \LaTeX.
|
|
\item[\href{https://www.ctan.org/pkg/voss-mathmode}{voss-mathmode}] A comprehensive overview of typesetting mathematics in \LaTeX.
|
|
\item[\href{https://www.ctan.org/pkg/xcolor}{xcolor}] Allows the definition and use of colors.
|
|
\end{description} |