LaTeX
Resources
The texfaq!
Installing
Use Tex Workshop extension with VS Code. You’ll need to install the full TexLive to get the Perl script that makes things easy. It is recommended to NOT use apt to install TeX Live as it is not up to date. But if you’re lazy or going simple, it will work fine.
sudo apt install texlive-full
If you want to install it correctly, you need to use tlmgr. More reading can be done here.
CJK Fonts
If you need to use Chinese, Japanese, or Korean characters, you need to install a font first:
sudo apt update
sudo apt install fonts-noto-cjk
This will install the Google Noto font package which has a few fonts. All fonts have all characters. The only difference between each font in the package is regional styling (How would a Chinese person write a Korean Hangul character, for example). Here’s the options for serif fonts:
Noto Serif CJK JP-> JapaneseNoto Serif CJK KR-> KoreanNoto Serif CJK SC-> Simplified ChineseNoto Serif CJK TC-> Traditional ChineseNoto Serif CJK HK-> Hong Kong
To enable them, add this to the preamble of your document:
% Enable Chinese, Japanese, and Korean characters
\usepackage{luatexja-fontspec}
\setmainjfont{Noto Serif CJK JP}
Finally you must compile with lualatex.
Tricks
Font
You can set the font to Times New Roman with
\renewcommand{\familydefault}{ptm}
I wouldn’t recommend it; Times was designed for tight spaces. The default, called Computer Modern, is better. Garamond is another nice choice. For sans-serif, Helvetica is popular.
Package Installing
Here’s a good guide. If installing manually (a tds.zip file called a TDS or “Tex Directory Structure” file), you need to find your install location:
# system-wide
kpsewhich -var-value TEXMFLOCAL
# your own user access only
kpsewhich -var-value TEXMFHOME
Then, you unzip the file to it’s proper location.
sudo unzip -o texdef.tds.zip -d `kpsexpand '$TEXMFLOCAL'`
The resulting file location will look something like /usr/local/share/texmf/tex/generic/<package>/<package>.tex
Finally, you must update the indices for all available packages using the following command
sudo texhash
If the package contains a font, the map must be updated
sudo updmap --sys --enable Map new-font.map
Templates
Formal Letter
\documentclass[11pt]{letter}
\usepackage[left=1in, right=1in, top=1in, bottom=1in]{geometry}
\longindentation=25em
\signature{Rick Gray \\ Member}
\address{123 MyAddress \\ Houston, TX \\ 77777}
\begin{document}
\begin{letter}{Friend \\ 123 Main \\ Houston, TX \\ 77777}
\opening{Dear Friend,}
How are you?
\closing{Sincerely,}
\end{letter}
\end{document}
Two Column Scientific Article with Abstract
\title{Title of Report}
\author{
Gray, Rick\cite{Author1}
\and
Smith, John\cite{Author2}
}
\newcommand{\abstractText}{\noindent
This is an abstract.
}
\documentclass[11pt, twocolumn]{article}
\usepackage{graphicx}
\usepackage{xurl}
\usepackage[super, comma, sort&compress]{natbib}
\usepackage{abstract}
\usepackage{amsmath}
\renewcommand{\abstractnamefont}{\normalfont\bfseries}
\renewcommand{\abstracttextfont}{\normalfont\small\itshape}
\begin{filecontents}{citations.bib}
@misc{Author1,
author = "Gray, Rick",
howpublished = "\url{mailto:rickdgray@utexas.edu}"
}
@misc{Author2,
author = "Smith, John",
howpublished = "\url{mailto:rickdgray@utexas.edu}"
}
\end{filecontents}
\usepackage{hyperref}
\hypersetup{colorlinks=true, urlcolor=blue, linkcolor=blue, citecolor=blue}
\begin{document}
\twocolumn[
\begin{@twocolumnfalse}
\maketitle
\begin{abstract}
\abstractText
\newline
\newline
\end{abstract}
\end{@twocolumnfalse}
]
\section{Introduction}
\begin{table*}
\centering
\begin{tabular}{lll}
1 & 2 & 5 \\
3 & 4 & 6
\end{tabular}
\caption{Floating table} \label{tab:hresult}
\end{table*}
\subsection{Section I}
This is an intro.
\subsubsection{Inline Table}
This is an inline table.
\begin{center}
\begin{tabular}{|l|l|}
\hline
1 & 2 \\ \hline
3 & 4 \\ \hline
5 & 6 \\ \hline
\end{tabular}
\end{center}
\section{Conclusion}
This is a conclusion.
\nocite{*}
\bibliographystyle{plain}
\bibliography{citations}
\end{document}