RPGM 2.0 Docs

LaTeX Documentation

This is the documentation about LaTeX. This is not a complete documentation as only the basics and useful functions for reports will be covered in this page.

Why a LaTeX Documentation?

The report can be created without a single line of LaTeX code. However, the Simple Text Element can contain LaTeX code. This documentation explains how to put some text in bold or in italic and other font changes but also formulas or references.

Document formatting

This covers the main aspect of the document.

The header is the part of the document which appears on the top of each page. The footer is the same but at the bottom. In order to add one of them, an extra package is needed: \usepackage{fancyhdr}.

Adding a header or a footer is easy with the following functions added by the package:

  • \lhead{My header} for adding a header aligned on the left
  • \chead{My header} for adding a centered header
  • \rhead{My header} for adding a header aligned on the right
  • \lfooter{My footer} for adding a footer aligned on the left
  • \cfooter{My footer} for adding a centered footer
  • \rfooter{My footer} for adding a footer aligned on the right
Several header functions can be called in the same document (for example with \lhead{My left header} and \rhead{My right header}). Images can also be inserted with \includegraphics.

Title styles

The font of all titles in the document can be changed with a required titlesec: \usepackage{titlesec}.

The most common change is the color. See the examples below for changing the color of each level of title, please note that only the color is changed here, but everything is customizable.

  • For defining a new color: \definecolor{c_title}{rgb}{0.18, 0.35, 0.47}
  • For the section: \titleformat*{\section}{\normalfont\Large\bfseries\color{c_title}}
  • For the subsection: \titleformat*{\subsection}{\normalfont\large\bfseries\color{c_title}}
  • For the subsubsection: \titleformat*{\subsubsection}{\normalfont\normalsize\bfseries\color{c_title}}
  • For the paragraph: \titleformat*{\paragraph}{\normalfont\normalsize\bfseries\color{c_title}}
  • For the subparagraph: \titleformat*{\subparagraph}{\normalfont\normalsize\bfseries\color{c_title}}

Text formatting

This is a list of the functions which change the appearance of the text written in LaTeX:

  • \textbf{My bold text} for having a weighted text,
  • \textit{My italic text} for having an italic text,
  • \texttt{My code text} for having a code text,
  • \textsc{My text} for adding a text in small capital.

Size formatting

These functions change the size of the text, from the smallest to the largest:

\tiny{Text}, \scriptsize{Text}, \footnotesize{Text}, \small{Text}, \normalsize{Text}, \large{Text}, \Large{Text}, \LARGE{Text} and \HUGE{Text}.

Color definition and application

Define a new color with: \definecolor{c_title}{MyColor}{0.18, 0.35, 0.47}. This color is then available for changing the appearance of the text with commands like \textcolor{MyColor}{My Colored text} which outputs: My Colored text.

Try to always define the color with a name before using it, your document will be easier to read.

Text alignment

The \begin command is used to align the text. See the example below:

\begin{flushleft}
    My text on the left.
\end{flushleft}

\begin{center}
    My centred text.
\end{center}

\begin{flushright}
    My text on the right.
\end{flushright}

Formulas

LaTeX has two modes, the text one and the math (formula) one. The command used in the text mode cannot be used in the math mode and reciprocally.

The $ makes the entrance in the math mode and another $ represents the exit, as it toggles the mode.

On the widget Equation, the math mode is already activated. Do not add an extra $!

For testing the code and seeing the result, use an “Equation editor”, like hostmath.com or this other editor.

Formulas: Greeks letters

Adding a Greek letter is easy, just paste a \ with the name of the Greek letter, for example \gamma. If the first letter is in capital, the Greek letter is in capital as well when it differs from our alphabet.

This is a list of the Greek letters:

Code Render
\alpha α
\beta β
\gamma γ \Gamma Γ
\delta δ \Delta Δ
\epsilon ε
\zeta ζ
\eta η
\theta θ \Theta Θ
\iota ι
\kappa κ
\lambda λ \Lambda Λ
\mu μ
\nu ν
\xi ξ \Xi Ξ
\omicron ο
\pi π \Pi Π
\sigma σ \Sigma Σ
\tau τ
\upsilon υ \Upsilon Υ
\phi φ \Phi Φ
\chi χ
\psi ψ \Psi Ψ

Formulas: Set symbols

There are two classes for the set symbols. The first one represents the letters written in a decorative hand like, the LaTeX function is \mathcal. For invoking the normal distribution with mean μ and variance σ2, there is the following code:

\mathcal{N}(\mu, \sigma^{2})

The second one represents some standard sets, like the set of the real numbers, or the P of probabilities and the expected value operator. The LaTeX function is \mathbb. Here is an example:

\mathbb{E}^{\mathbb{Q}}(\widetilde{X}) = 1.457

Formulas: Usual symbols

Here is a list of the most useful symbols in math mode:

Code Render
\forall
\exists
\partial
\in
\emptyset
\infty
\leq
\geq
\propto

Formulas: Arrows and logic connectors

Here is the code for the arrows in LaTeX:

Code Render
\leftarrow
\rightarrow
\Leftarrow
\Rightarrow
\Leftrightarrow

Formulas: Sum and integral

The sum and the integral require something below and sometimes above placed with _ and ^. The function for the sum is \sum, for the integral it is \int. Here is an example:

\Gamma(z) = x^{z}e^{-x}\sum_{n=0}^{+\infty}\frac{x^{n}}{z(z+1)\ldots(z+n)} + \int_{x}^{+\infty}e^{-t}t^{z}\frac{dt}{t}

Which gives the LaTeX equation:

Result

In the same way, \prod can be use for the product, \bigcup for the union and \bigcap for the intersection.

References

The references concerns the call of Figures, Tables, Equations or another object. For example, a Figure can be represented by Figure 1: its category and its number. You can write “The Figure 1”, but if another figure is added before, it will be the Figure 2 and you will have to change all the “Figure 1” references to “Figure 2”, which is a waste of time and is prone to error. The references can manage those numbers dynamically.

References: Definition

This is possible from the Report Editor in RPGM. On a Figure, a Table or an Equation, the field ID will be the name of the object.

References: Calling a reference

The function for calling a reference is \ref. Only the number is called. Example:

The Figure \ref{Fig:ws} represents the evolution of the number of wind storms through the century.