Yue Sun

A perfectionist’s guide to LaTeX

During my years in grad school, I’ve benefited from my advisor’s meticulous tips on LaTeX formatting. Below is a list of things I’ve learned from him that I believe are key in scientific writing (not about perfectionism). Items are not ranked by importance.

  1. Hyphen, en-dash, and em-dash…why bother?
    TL;DR. You should bother, especially for fluid--structure interaction, not fluid-structure interaction!
    • Hyphen (-), or single dash -, is used to connect words in a compound word. For example, physics-based simulation.
    • En-dash (–), or double dash --, is used to connect words of equal importance. For example, Navier–Stokes equations (because Claude-Louis Navier and George Gabriel Stokes both contributed). Fun fact, it’s called en-dash because its width is approximately the same as the letter “n” in typesetting.
    • Em-dash (—), or triple dash ---, is used as a punctuation mark for many purposes. For example, creating emphasis or indicating a break in thought. And yes its width is approximately the same as “m”.
  2. Typesetting SI units manually?
    I’ve done it before…it was very painful. Don’t do it.
    Simply add \usepackage{siunitx} in your permeable and follow the siunitx documentation.
    (Just learned that \SI{num}{unit} is deprecated and only used for backward compatibility. Guess I’ve always typed it wrong but hey.)
  3. Unbreakable tilda~
    There should always be a ~ between the text and referencing commands, like Figure~\ref{} or mywork~\cite{}.
    The ~ defines a non-breaking space. It ensures the Figure is kept together with its number without a linebreak in between. So they’ll always be on the same line for easy readability.
    (There is also the cleveref package that automatically generates the text and the number if you just pass the label to \cref{}. I’ve switched to it since I found it and it’s been great. However, it is still a good practice to keep doing ~\cite{} for citations.)
  4. Matrix transpose in math mode
    Whichever superscript you pick, just don’t do $^T$. It looks ugly and causes confusion.
    Unfortunately, there is no \trans command in LaTeX yet so you need to define your own transpose. The one that I inherited from Chris is \DeclareMathOperator{\trans}{\mathsf{T}}.
  5. Typesetting dimensionless numbers in math mode
    For example, if I want to say the Reynolds number is 100, I used to do $Re=100$ and Re would be automatically italicized.
    However, there is a subtle difference between the text in math mode and \textit{}. Texts in pure math mode actually have a wider spacing between each letter. In this case, where Re should be considered as one because it’s the abbreviation for the Reynolds number, we should do $\textit{Re}=100$ instead.
    (Re does not show the most difference between the two. Try Mach number Ma, it’s more obvious and shows \textit{} indeed looks nicer.)