LaTeX
This page contains a variety of useful links and notes on the document preparation software LaTeX.
Links
Reading List/Resources
- LaTeX - Wikibooks
- Typefaces for Symbols in Scientific Manuscripts
- An essential guide to LATEX 2ε usage
- Best practices for LaTeX
- https://practicaltypography.com/
- SI Unit rules and style conventions
Manuals
- Customizing captions of floating environments
- The fancyhdr and extramarks packages
- The titlesec, titleps and titletoc Packages
- The titling package
- Customizing lists with the enumitem package
- Page size and margins (geometry) - Overleaf
Explanations
- The way LaTeX categorizes the different characteristics of printed material (encoding, family, size, shape, etc)
- Horizontal Spacing Commands - StackOverflow
Instructional Guides/Tips
- https://tex.stackexchange.com/questions/263676/modifying-maketitle-with-the-titling-package
- https://tex.stackexchange.com/questions/53338/reducing-spacing-after-headings
- https://stackoverflow.com/questions/23297422/org-mode-timestamp-format-when-exported
- How to create inner section like environment with sub-table of contents
- mostlymaths.net | How to create LaTeX booklets
Tools
Fonts
- https://tug.org/FontCatalogue/
- https://ctan.org/pkg/kpfonts
- https://www.cs.put.poznan.pl/csobaniec/software/latex/fonts.html
\usepackage{ebgaramond}
\usepackage{libertine}
\usepackage[bitstream-charter]{mathdesign}
(https://tug.org/FontCatalogue/charterbt/)\usepackage{cochineal}
(https://tug.org/FontCatalogue/)\usepackage{euler} \usepackage{concrete}
(Concrete Mathematics)\usepackage{OldStandard}
(https://tug.org/FontCatalogue/oldstandard/)
Design Inspiration
- The microtype manual
- Mishkan HaNefesh
- https://www.myfonts.com/fonts/wilton/werk/
- https://www.fontsmith.com/fonts/fs-brabo/styles/family
- Amazon Kindle Preview
- https://github.com/pelegs/maths_book
- https://github.com/proafxin/antique_book
- https://github.com/enhuiz/eisvogel
Layout Templates
Images/figures
Plain image with defined width
The [H] parameter requires \usepackage{float}
.
\begin{figure}[H]
\centering
\includegraphics[width=16cm]{Car Trial Data Tables.png}
\caption{The two datatables.}
\label{fig:Datatables}
\end{figure}
Two side-by-side figures with captions & a label
\begin{figure}[h] % the 'h' places it "here"
\centering
\subfloat[\centering Unweighted trials]{{\includegraphics[width=3.1in]{(Unweighted) x̄ Distance Travelled vs. Height.png} }}
\subfloat[\centering Weighted trials]{{\includegraphics[width=3.1in]{(Weighted) x̄ Distance Travelled vs. Height.png} }}
\caption{My two scatterplots.}
\label{fig:example}
\end{figure}
Customizing image export from orgmode
#+ATTR_LATEX: :height 4in :width 2in
Equations
Standard equation (with text)
\begin{equation}
\text{KE}_1 + \text{PE}_1 + \text{W}_\text{NC} = \text{KE}_2 + \text{PE}_2
\end{equation}
Multi-line equation aligned on =
\begin{equation}\setlength{\jot}{5pt}
\begin{split}
\text{KE}_1 + \text{PE}_1 - \text{W}_\text{friction} & = \text{KE}_2 + \text{PE}_2 \\
\frac{1}{2}mv^2_1 + mgy_1 + \text{F}_\text{fr}d \cdot \cos\theta & = \frac{1}{2}mv^2_2 + mgy_2 \\
\frac{1}{2}m \cdot 0 + mg\cdot h + \text{F}_\text{fr}d \cdot \cos 180^\circ & = \frac{1}{2}mv^2_2 + mg \cdot 0 \\
mgh - \text{F}_\text{fr}d & = \frac{1}{2}mv^2_2
\end{split}
\end{equation}
Side-by-side equation with minipage
Uses a minipage.
\noindent\begin{minipage}{.2\linewidth}
\begin{equation}\notag\setlength{\jot}{5pt}
\begin{split}
\large{\textbf{G:}} &\; g=9.81 m/s^2; m=0.0031\text{kg}; \textbf{h=0.57\text{m}}; d=0.504\text{m}\\
\large{\textbf{U:}} &\; \text{F}_\text{fr} \\
\large{\textbf{E:}} &\; mgh = 2\ffr \\
\large{\textbf{S:}} &\; 0.0031\text{kg} \cdot 9.81m/s^2 \cdot 0.57\text{m} = 0.504\text{m} \cdot 2 \cdot \ffr \\
\large{\textbf{S:}} &\; 0.01733 = 1.008 \cdot \ffr = \boxed{0.017\text{N}}
\end{split}
\end{equation}
\end{minipage}%
\begin{minipage}{1.2\linewidth}
\begin{equation}\notag\setlength{\jot}{5pt}
\begin{split}
\large{\textbf{G:}} &\; g=9.81 m/s^2; m=0.0031\text{kg}; \textbf{h=0.20\text{m}}; d=0.168\text{m}\\
\large{\textbf{U:}} &\; \text{F}_\text{fr} \\
\large{\textbf{E:}} &\; mgh = 2\ffr \\
\large{\textbf{S:}} &\; 0.0031\text{kg} \cdot 9.81m/s^2 \cdot 0.20\text{m} = 0.168\text{m} \cdot 2 \cdot \ffr \\
\large{\textbf{S:}} &\; 0.0061 = 0.336 \cdot \ffr = \boxed{0.0181\text{N}}
\end{split}
\end{equation}
\end{minipage}
The &
designates where to align. The \;
serves as a space (I think it is the
width of a space character, or slightly bigger).
Lists
- Enumitem package
- https://orgmode.org/manual/Plain-lists-in-LaTeX-export.html#Plain-lists-in-LaTeX-export
- https://tex.stackexchange.com/questions/12279/outline-of-style-i-a-i-a-1
XeLaTeX
\symbol{<code number>}
Alternative font simple
https://www.overleaf.com/learn/latex/XeLaTeX#Setting_fonts_for_different_LaTeX_elements
\usepackage{fontspec}
\setmainfont{Times New Roman}
\setsansfont{Public Sans}
\setmonofont[Color={0019D4}]{Courier New}
Alternative font complex
\usepackage{fontspec}
% Fonts - fontspec
\setromanfont[
BoldFont=EB Garamond Bold,
ItalicFont=EB Garamond Italic,
BoldItalicFont=EB Garamond Bold Italic,
]{EB Garamond Regular}
\setsansfont[
BoldFont=Public Sans Bold,
ItalicFont=Public Sans Italic,
BoldItalicFont=Public Sans Bold Italic ]{Public Sans Regular}
Misc
- Where to put .sty files on Mac:
~/Library/texmf/tex/latex