LATEX

installing pdflatex on a mac:
brew install --cask mactex


Put .sty files here:

  /Users/ethrane/Library/texlive/2020basic/texmf-var/tex/latex

Install essential fonts:

  sudo tlmgr update --self                     
  sudo tlmgr install collection-fontsrecommended

Install your favourite emacs-based spell-check:

  brew install ispell 
pdflatex compiles latex to pdf, but figures must be pdf's

To get nice units: \usepackage{units} ... \unit[1.6]{GeV}
make a long equation in the middle of a two-column document:
\begin{widetext}
\begin{equation*}
...
\end{equation*}
\end{widetext}

Include a tilde between "Equation" and "\ref" so that they are never broken up by a line break.
to create a subscript: m_{1}
to denote an estimator: \widehat{x}
to denote a unit vector: \hat{n}
to comment something out: %commented out
to comment out a lot of lines at once:
\iffalse
...
\fi
to define something that you're going to use again and again:
\newcommand{\bra}[1]{\langle #1|}
\newcommand{\ket}[1]{|#1\rangle}
\newcommand{\braket}[2]{\langle #1|#2\rangle} \braket{e}{\mu}

To force vertical space at the beginning of an article use an astericks: \vspace*{9.5pc}

To anchor a figure: \begin{figure} [hb]

To left justify a table: \begin{table}
\begin{center}
\begin{array}{lll}
To create a table with fixed column width (where overflow text continues on the next line): \begin{tabular}{p{3in}cc}

To create a table with lines: \begin{array}{|l|l|l|}
\hline

to add a .jpeg/.tiff/etc. image to your LaTeX file: use "convert": convert -quality 100 image.jpeg image.eps
or download jpeg2eps to convert it to .eps

To add a sun symbol (e.g., for solar mass):
\usepackage{wasysym}
$M_{\astrosun}$

To get pretty captions:
\usepackage[small, bf]{caption} \setlength{\captionmargin}{0.5in}

To display just one bracket (e.g., for a piecewise definition):
$$
x=\left\{
\begin{array}{lr}
  0 & x<0 \\
  1 & x\ge0
\end{array}
\right .
$$

To separate one latex file into smaller files: \input{file}   (to input file.tex)

To include a figure spanning two columns: \begin{figure*} ... \end{figure*}
To stack images on top of each other or in panels:
\begin{figure}
  \begin{tabular}{c}
  \psfig{file=none_dirty_map_L5.eps,width=3in} \\
  \psfig{file=none_dirty_map_L10.eps,width=3in} \\
  \psfig{file=none_dirty_map_L15.eps,width=3in} \\
  \psfig{file=none_dirty_map_L20.eps,width=3in} \\
  \psfig{file=none_radiometer.eps,width=3in}
  \end{tabular}
  \caption{caption \label{fig:example}}
\end{figure}
learntex.pdf by Julie Mitchell

to make a greater than or equal to sign: $\geq$
to make a less than or equal to sign: $\leq$
greater than or similar to: \gtrsim
less than or similar to: \ltsim


I want to state a long number, e.g., 400,000. If I don't add a comma, it's hard to see how many digits there are, and if I do, the spacing looks funny. Is there a solution?
use this: \usepackage{icomma}
Then commas in your latex equations will look OK.

Making a glossary:
\section{Glossary}
\begin{description}
  \item[viola:] Unpopular orchestra instrument.
\end{description}
Cropping a figure:
\includegraphics[trim={2cm 6cm 2cm 7cm},clip,width=2.5in]{monash.pdf}

bibtex

To include a bibliography: bibtex file
You will need file.bib.
Bibtex can do convenient things like:
convert "author = E. Thrane and others" into "E. Thrane et al.
eprint = "astro-ph/0008102"
There are special bibliography style files (.bst) you can download that are especially made for physics publications.


To force the author field to include unabbreviated information--like "S. Fukuda et al. (The Super Kamiokande Collaboration)":
author = "{S. Fukuda, {\it et al.} (The Super-Kamiokande Collaboration)}"

natbib citations


(for more details, see Thrane et al., 2009b) <-> \citep[for more details, see][]{stamp}
(see 2009a; The LIGO and Virgo Collaborations, 2011) <-> \citep[see][]{sph,sph_results}

Back to Resources