# Getting Started With LaTeX

LaTeX is, according to Wikipedia, a "document preparation system." This is mostly in opposition to the WYSIWYG ("What You See Is What You Get") editing system in most modern word processors, because in LaTeX you edit plain text and decorate it with the LaTeX mark-up language. Each piece of text (such as a heading) is tagged logically, rather than marked with a different font and size dependent on the whim of the creator. This leads to much more consistent document layout. A single command is then issued to generate the final document in any of several formats (commonly PDF these days and occasionally HTML, although previously DVI and PostScript). While not well known outside academia, it continues to fill a niche there for its excellent typesetting of mathematical formulae.

LaTeX has a very stylized logo emphasizing its text-setting capabilities - and also making it tricky to reproduce in HTML without including an image file. This is even harder to do in the RST files I use to generate my blog, so I'm going to output it properly once and then we can get on with our lives:

LaTeX

Did you catch that? LaTex is a mark-up language. I've been using mark-up languages for more than 20 years, starting with HTML, then XML, multiple Wikis, Markdown, and even RST (Python's ReStructured Text). LaTeX looks a bit different, but if you're familiar with another mark-up language it looks like it's surprisingly easy to learn. The main problem is simply becoming familiar with the large selection of packages and styles that are available. (I say this so easily without creating any documents of any actual value: I may change my tune once I've tried that.)

Installing it is very simple on Fedora Linux: dnf install texlive . Simple, but not small: that's about 300M of space gone. I use NeoVim to edit the files since they're plain text.

Here's an example document showing many of the features I'm most interested in right now:

\documentclass[11pt]{article}
% First created: 2018-07-27 18:56
% I don't like the default indenting of paragraphs, prefering unindented
% and separated by a line.  This package provides that:
\usepackage{parskip}
% For code, this is the package we need:
\usepackage{listings}
\begin{document}
\title{Basic \LaTeX Document}
\author{Giles Orr}
\date{2018-07-27}
\maketitle
%\section{Section Title Here}

\LaTeX\ is a "document preparation system" -- practically speaking, a
mark-up language.  Those familiar with other mark-up languages will find
the basics fairly straight-forward.  There are special characters, the
backslash being first and foremost among them.  The \% is another example:
it's used to start a comment, so it has to be backslash-escaped to display
normally.

Blocks of text can be \textit{delimited} in at least a couple ways: the
italicized text is prefaced by a backslashed descriptor and enclosed in
braces.

\begin{quote}
Quotes can be surrounded by a backslashed "begin\{quote\}" tag, and end
with a backslashed "end\{quote\}" tag.
\end{quote}

\{verbatim\} tags are good for teletype/monospace text, where the
formatting and all strange characters are repeated exactly as given:

\begin{verbatim}
#!/bin/bash
for i in $(seq 0 3 27) do echo "${i}"
done
\end{verbatim}

But for programming, the "listings" package and the \{lstlisting\} tags are
better: if you specify the (optional, in square brackets) language, some
syntax highlighting is done:

\begin{lstlisting}[language=Python]
#!/usr/bin/env python3
for i in range(0,27,3):
print(i)
\end{lstlisting}

\LaTeX\ makes it possible to colour-syntax-highlight your code, and to fancy
everything up - but this is a good start.

\end{document}


You can then run pdflatex filename.tex to generate a PDF file (click the link to see the file generated by the source above). If you're not familiar with LaTeX, something you'll get familiar with very quickly is their standard font, "Computer Modern." It's quite readable, but also a bit ugly and rather distinctive. I'm happy to know it's fairly easy to change.