\chapter{Tips and examples}
\label{c2}

This chapter presents some basic tips and a few examples on how to use \LaTeX.

\section{\TeX\ engines}
\label{c2:s:latex-engines}

There are several \TeX\ engines. In short, these are used to compile the (La)TeX source code to generate the output file (for example, a \as{pdf}). To know more about these, I encourage you to check these articles:

\begin{itemize}
\item
The TeX family tree: LaTeX, pdfTeX, XeTeX, LuaTeX and ConTeXt.\\
\url{https://www.overleaf.com/learn/latex/Articles/The_TeX_family_tree:_LaTeX,_pdfTeX,_XeTeX,_LuaTeX_and_ConTeXt}

\item
Choosing a LaTeX Compiler.\\
\url{https://www.overleaf.com/learn/latex/Choosing_a_LaTeX_Compiler}

\item
Are there benefits to use XeTeX or LuaTeX if one is to write documents mainly in English?\\
\url{https://tex.stackexchange.com/questions/548467/are-there-benefits-to-use-xetex-or-luatex-if-one-is-to-write-documents-mainly-in}

\item
Why choose LuaLaTeX over XeLaTeX.\\
\url{https://tex.stackexchange.com/questions/126206/why-choose-lualatex-over-xelatex}

\item
Differences between LuaTeX, ConTeXt and XeTeX.\\
\url{https://tex.stackexchange.com/questions/36/differences-between-luatex-context-and-xetex}

\end{itemize}

In this template, support for both pdf\TeX\ and Lua\TeX\ engines has been guaranteed, but I encourage you to use the latter because it is more powerful for typefaces: it supports TrueType and OpenType standards.

\subsection{Compiler automatic detection}

\ifPDFTeX
{\color{red} pdf\TeX\ is being used.}

Consider changing to Lua\TeX, which is the recommended compiler for this template.
\fi

\ifLuaTeX
{\color{Green4} Lua\TeX\ is being used.}

You are using the recommended compiler.
\fi

\section{Basic tips}
\label{c2:s:basic-tips}

\begin{itemize}
\item
The \verb+\\+ command has the same effect as \verb+\newline+.
\item
The \verb+\cleardoublepage+ command forces the next content to start in an odd page.
\item
The tilde character (\verb+~+) inserts a non-breaking space. Use it before citing a reference to avoid breaking the line: \verb+an example~\cite{label}+.
\item
The current font size is \myfontsize.
\item
Use the \verb+longtable+ environment for tables spanning multiple pages.
\item
The grave accent \`{} and the apostrophe \textquotesingle\ are the correct symbols to make quotations: ``this is an example''.
\end{itemize}

\section{Font styles}
\label{c2:s:font-styles}

\begin{itemize}
\item
\verb+\textnormal{}+ --- \textnormal{document font family}.
\item
\verb+\textrm{}+ --- \textrm{roman font family}.
\item
\verb+\textsf{}+ --- \textsf{sans serif font family }.
\item
\verb+\texttt{}+ --- \texttt{teletypefont family}.
\item
\verb+\textit{}+ --- \textit{italic shape}.
\item
\verb+\textsl{}+ --- \textsl{slanted shape}.
\item
\verb+\textsc{}+ --- \textsc{small capitals}.
\item
\verb+\textbf{}+ --- \textbf{bold}.
\end{itemize}

\section{Colors}
\label{c2:s:colors}

{\color{red} Red colored text} from the \texttt{color} package.
{\color{Blue4} And Blue4 colored text} from the \texttt{xcolor} package.

\section{Footnotes}
\label{c2:s:footnotes}

This is a labeled footnote\cref{foot:example}. A footnote can be referenced multiple times\footnote{\label{foot:example}This is a footnote example.}. Again, the same footnote is referenced\cref{foot:example}.

\subsection{A table example}
\label{c2:ss:a-table-example}

A table example is shown in \Cref{tab:a-table-example}.

\input{tex/contents/tab/a-table-example.tex}

\section{Abbreviations}
\label{c2:s:abbreviations}

\verb+\gls{label}+ and \verb+\glslink{label}{text}+ are two possible commands for making use of abbreviations. For example, the commands \verb+\gls{afk}+ (first call), \verb+\gls{afk}+ (second call), and \verb+\glslink{afk}{insert specific text}+ produce respectively ``\gls{afk}'', ``\gls{afk}'' and ``\glslink{afk}{insert specific text}''.

A list of some commands follow.

\begin{itemize}
\item
\verb+\gls{afk}+ produces ``\gls{afk}''.
\item
\verb+\glslink{afk}{text}+ produces ``\glslink{afk}{text}''.
\item
\verb+\glsxtrshort{afk}+ and \verb+\as{afk}+ produce ``\glsxtrshort{afk}'' and ``\as{afk}'', respectively.
\item
\verb+\glsxtrlong{afk}+ and \verb+\al{afk}+ produce ``\glsxtrlong{afk}'' and ``\al{afk}'', respectively.
\end{itemize}

Note that the commands \verb+\ac+ and \verb+\al+ are shorter equivalent variants.

Other abbreviations include: good work (\as{gw}); have fun (\as{hf}); good work and have fun (\as{gwhf}). Note that the latter contains nested abbreviations.

\section{Equations}
\label{c2:s:equations}

\Cref{eq:example1} is a numbered equation.

\begin{equation}
\label{eq:example1}
x = 1 + y
\end{equation}

The following equation is not numbered, and thus cannot be referenced.

\begin{equation*}
y = \sum_{i=1}^{N}{x_i}
\end{equation*}

The \verb+\myscore+ pre-defined math function is used by the \Cref{eq:example2}.

\begin{equation}
\label{eq:example2}
\myscore(d) = \frac{1}{d^2}
\end{equation}

\section{Figures}
\label{c2:s:figures}

An example of a figure is shown in \Cref{fig:aveiro}. The \verb+\fbox+ command \fbox{draws a box} around its content.

\input{tex/contents/fig/aveiro.tex}

\section{Rotating pages}
\label{c2:s:rotating-pages}

Horizontal pages can be obtained using the \verb+landscape+ environment  from the \verb+pdflscape+ package:

\begin{verbatim}
\begin{landscape}
Add some text or figures.
\end{landscape}
\end{verbatim}

\section{A long table}
\label{c2:s:a-long-table}

\Cref{tab:a-long-table} presents a long table using the \verb+longtable+ package. This table can span multiple pages. The \verb+\afterpage+ command forces the table to start at the top of a page.

\afterpage{\input{tex/contents/tab/a-long-table.tex}}
