# Latex math commands I have newly learned or consistently forget

latex publications

This post is mainly written for me – I’m in the flow of writing something, and … have to look up how to typeset an equation. Uggh. So here’s some of the math commands I either learned for the first time, or always forget.

First, a good guide is the “short Math Guide for Latex” from the American Mathematical Society:

### Approximately

\approx $$\quad \approx$$

### Big slashes for division

Use the left-middle-right construct. Relevant StackOverflow answer.

\left. \frac{a}{b} \middle/ \frac{c}{d} \right. $$\quad \left. \frac{a}{b} \middle/ \frac{c}{d} \right.$$

### Labeling matrix rows and columns

I needed something that would work with MathJax. A simple version of the below – and how I got it working!- is due to this blog post. If you’re working with modern latex (versus MathJax), Shanto Roy’s post on this topic has a lot of options and detail.

\begin{array}{c c c c c} &
\begin{array}{c c c c} n & m_1 & m_2 \\
\end{array}
\\
\begin{array}{c}
n \\
m_1\\
m_2
\end{array}
&
\left[
\begin{array}{c c c}
0 & A^T & B^T \\
A & I & 0 \\
B & 0 & 0
\end{array}
\right]
&
\left[
\begin{array}{c}
x \\
r\\
\lambda
\end{array}
\right]
&
=
&
\left[
\begin{array}{c}
0\\
b\\
d
\end{array}
\right]
\end{array}


to

$\begin{array}{c c c c c} & \begin{array}{c c c c} n & m_1 & m_2 \\ \end{array} \\ \begin{array}{c} n \\ m_1\\ m_2 \end{array} & \left[ \begin{array}{c c c} 0 & A^T & B^T \\ A & I & 0 \\ B & 0 & 0 \end{array} \right] & \left[ \begin{array}{c} x \\ r\\ \lambda \end{array} \right] & = & \left[ \begin{array}{c} 0\\ b\\ d \end{array} \right] \end{array}$

A simpler version – from the blog post above – is

\begin{array}{c c} &
\begin{array}{c c c} a & b &c \\
\end{array}
\\
\begin{array}{c c c}
p \\
q\\
r
\end{array}
&
\left[
\begin{array}{c c c}
.1 & .1 & 0 \\
.4 & 1 & 0 \\
.8 & 0 & .4
\end{array}
\right]
\end{array}

$\begin{array}{c c} & \begin{array}{c c c} a & b &c \\ \end{array} \\ \begin{array}{c c c} p \\ q\\ r \end{array} & \left[ \begin{array}{c c c} .1 & .1 & 0 \\ .4 & 1 & 0 \\ .8 & 0 & .4 \end{array} \right] \end{array}$

### Argmin

To get something like this,

$\DeclareMathOperator*{\argmin}{arg\,min} SVDO(A) = \argmin_{\mathbf{R} \in O(n)} \| \mathbf{R} - \mathbf{A} \|_F^2 \label{SVDO}$

Do something like this in your .tex file.

\DeclareMathOperator*{\argmin}{arg\,min}
SVDO(A) = \argmin_{\mathbf{R} \in O(n)} \| \mathbf{R} - \mathbf{A} \|_F^2 \label{SVDO}


### Input versus Include

I was using \include{file} and that didn’t work. To import everything from a file, I need to use \input{file}.

More details from this SE answer.

### Defining long expressions in the preamble

I always use boldface for vectors and matrices. That means a WHOLE LOTTA \mathbf{A}, missing brackets, etc.

\DeclareMathOperator{\A}{\mathbf{A}}
...

$\A$


To get $$\DeclareMathOperator{\A}{\mathbf{A}} \A$$.

A detail: On page 13 of the AMS short math guide, pdf, there is an explanation of when to use and asterisk versus not:

The star form \DeclareMathOperator* creates an operator that takes limits in a displayed formula, such as sup or max.

So if the expression does not have limits, use \DeclareMathOperator{\A}{\mathbf{A}}, otherwise \DeclareMathOperator*{\argmin}{arg\,min}.

### Local font size changes

\Huge
\huge
\LARGE
\Large
\large
\normalsize
\small
\footnotesize
\scriptsize
\tiny


### Norm marks that are sized to the content

In LaTeXese, this is responsive sizing.

You can do

\left\lVert Thing to be normed \right\rVert


Or as Jidan at physicsread.com suggests, you can create a command

\newcommand\norm{\left\lVert#1\right\rVert}

...
$\norm{Thing to be normed}$


I linked to the particular section about responsive resizing from the post above, but the whole page is all about how to do norms in latex and was useful to me.

### Dagger or cross symbol

\mathbf{X}^{\dagger}


looks like $$\mathbf{X}^{\dagger}$$.

I was looking up ‘cross symbol’, but the name for this symbol is dagger.

## Share or discuss.

© Amy Tabb 2018 - 2023. All rights reserved. The contents of this site reflect my personal perspectives and not those of any other entity.