My notes about LaTeX

For those who don’t know what I am talking about LaTeX is a tool suitable for writing scientific papers, books, manuals and more. It supports a wide variety of document standards like APA or IEEE.

In traditional typesetting systems like Microsoft Office or Google Docs, you can easily change the font or the layout of your text on any part of your document. LaTeX, by contrast force you to follow a layout on the entire document, this is great because your attention will be focused on the contents of the document rather than its appearance.

Where to start.

You can use an online LaTeX editor like Overleaf or install a TeX distribution with an editor like TeXmaker or TeXstudio, if you use Vim or Vs code there are some plugins out there, I personally use Vim with VimTeX and Coc plugins.

Writing your first article

Every LaTeX document follows the same structure:

\documentclass{article}
% LaTeX extensions
% Document Information

\begin{document}
% Document contents

\end{document}

\documentclass tells LaTeX what kind of document will be written, for example if instead of article we put apa7, LaTeX will follow APA rules to style the document. Now with the format specified you have to provide some information about the document, for example what is the title or who is the author of the article. To do that you must write within \documentclass{article} and begin{document} the \title{}, \author{} and \date{} commands to specify the title, the author and the date of the article, there are more commands you can use but these three are the most common ones.

\documentclass{article}
% LaTeX extensions
\usepackage{verbatim}
% Document Information
\title{This is the title of the document}
\author{You can put your name here}
\date{Aug, 06 2022}

\begin{document}
% Document contents

\end{document}

Now we can start writing a document, as you might expect the content goes in between \begin{document} and \end{document}, the example below illustrates how it works:

\documentclass{article}
% LaTeX extensions
% Document Information
\title{This is the title of the document}
\author{You can put your name here}
\date{Aug, 06 2022}

\begin{document}
% Document contents

\maketitle
\tableofcontents

\section{This is a section}
Contents of an article in LaTeX are divided by \emph{parts, chapters, sections,
subsections} and \emph{subsubsections}, you will use one ore another depending
of the size and the format of your documents.

In the article document class section is the biggest structural element, from
there you can make subsections and subsubsections.\par

To end paragraphs let an empty line or write the \emph{par} command, every
commands or environment start with a backslash.

\subsection{Commands}

They are just rules that change the behaviour of the text or are used to add a
special symbol for example we can write \LaTeX, or make \emph{emphasis} in some
words or sentences to express their \textbf{importance}.

\subsection{Environments}

Commands are useful but they get short when writing a document, it is impossible
to write long essays just with small declarations, here is where the
\emph{environments} complete the puzzle, it can be seen as a block or container
that give us a context for a specific situation like writing equations, adding
pictures or making a table. Here are some of their advantages:

\begin{itemize}
    \item Different environments allow to encapsulate commands for different
        contexts.
    \item They focus you on the job, it's easier to write equations or lists
        once the appropriate context is defined.
    \item Environments extend the availability of documents you can write.
\end{itemize}

With environments is possible to write complex equations like:

\begin{eqnarray*}
    X(j\omega) = \int_{-\infty}^{\infty} x(t) e^{- j \omega t} dt \\
    x(t) = \frac{1}{2 \pi} \int_{-\infty}^{\infty} X(jw) e^{j\omega t} dw
\end{eqnarray*}

and making tables:

\begin{center}
\begin{tabular}{| c | c |}
    \hline
    time (sec) & temperature ($^\circ C$) \\
    \hline
    0 & 40 \\
    1 & 41 \\
    2 & 42 \\
    3 & 37 \\
    4 & 43 \\
    5 & 46 \\
    \hline
\end{tabular}
\end{center}

without worrying about how to set the font or spaces to make it look great.
\end{document}

The example above will produce this document. Now Let’s say that instead of a standard article we want a manual, to do that we only have to change \documentclass{article} to \documentclass{hitec} and ta-dah, here is the result, or What about a scientific paper which needs to be submitted in APA format, well just put \documentclass{apa7} and impress your reviewers with your new publication. Compared with Google Docs or Office changing from one type of document to another is considerably easier in LaTeX, maybe the worst part is learning how to use the environments and which ones are used more often, but once you get used to it, LaTeX will save you from the headache of formatting your documents.

Where to Learn

If I managed to convince you to use LaTeX, let me show you some resources that will ease the process of learning how to use it: