first LaTeX document

Published on 20 Apr 2019

I enjoyed writing a document in LaTeX. I guess I have turned into a monster now.

The friction to start writing a LaTeX document was not too bad since I am used to writing documents in Markdown. I would like to say thanks to whoever created the 30 minutes tutorial on Overleaf. Honestly I spent like 5 minutes reading about the declarations in preamble and then I embarked my own adventure fixing what’s not broken in my document.

Here is how my current preamble looks like, and most likely to stay like that.

\documentclass[9pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[letterpaper, left=0.7in, right=0.7in, top=0.5in, bottom=0.5in]{geometry}
\usepackage{parskip} % disable the new paragraph indent
\usepackage{enumitem} % somehow fixes the linespacing for numbering
\usepackage[dvipsnames]{xcolor} % enable color
\usepackage[none]{hyphenat} % disable hyphenation, might clash with other package
\usepackage[document]{ragged2e} % don't justify text

\renewcommand{\familydefault}{\sfdefault} % Sans Serif as the default font-family
\renewcommand{\baselinestretch}{1.25} % use 1.25 line-spacing
\pagenumbering{gobble} % turn off page numbering

Without me realizing it, I declared 7 packages already in my preamble. Other than this preamble, there are couple more TeX commands that I would like to highlight here.

First is the use of built-in mathematical notation, e.g. the multiplication symbol “×” or the micro symbol “µ”. This can be achieved by using the \times and \mu commands, respectively. However when using this outside the math mode, these commands must be encapsulated by the $ symbol, i.e. $\times$, otherwise LaTeX will throw error when compiling.

To manually define vertical space (i.e. say, spacing between section), I am doing this manually by using the \vspace command, for example, \vspace{2.5mm} to define 2.5 mm space. For horizontal space, this can be done similarly with the \hspace command.

For adding colors to the text or to highlight text, I am using the xcolor package with the dvipsnames option (see my preamble above). This allows me to use more color, like Fuchsia, SeaGreen, etc. See this LaTeX Wiki for more information.

LaTeX has a steep learning curve. My strategy for now is learning what are the default behaviors and how to alter them. For example, LaTeX justifies text and hyphenates by default. Also, it uses CMU Serif as the default font-family. All these can be changed in the preamble section.

One thing to note that the full LaTeX package suite is obscenely huge. Like, I had to download 2GB packages and it used up around 4 GB of disk space. Before I first started writing a LaTeX document, I installed TeX Works. Its UI just did not click well with me, so I transitioned to Sublime Text 3.

In the middle of transitioning, I decided to give ShareLaTeX a try. I downloaded the official docker-compose.yml, spun the containers (ShareLaTeX, Mongo, and Redis), then tried it myself. It was okay. Then I read that I had to download the full LaTeX suite. I gasped at the amount of packages: 3664 LaTeX-related packages, took me more than half an hour to complete the download.

After using ShareLaTeX for like, 5 minutes, I decided to not use it because I felt like it is better to learn the hard way (e.g. using text editor instead of an IDE). Then on my Ubuntu machine, I installed the full LaTeX suite by installing the texlive-full package. So far I am happy with the solution I am using (Sublime Text 3 with texlive-full). My Sublime has LaTeXTools package installed for syntax highlighting.

first LaTeX document

So, what comes next?

I am just going to write a few more documents with LaTeX, learn how to make tables, write a separate style .sty document for managing styles to make my preamble a little less messy, and possibly transition to LaTeX as my daily driver for writing documents whenever possible.