I've been doing 3 problem sets/week in LaTeX for the last several weeks; here are some more tips to follow up on my
previous post:
Making your own functions:
\newcommand{\norm}[1]{\left\Vert #1 \right\Vert}
\DeclareMathOperator*{\argmin}{arg\,min}
The * puts the subscript below the operator. To stack subscripts:
\min_{\substack{ X>0 \\ Z \\ W=W^* }}
Different vector formats
Underline, with the line crossing descenders (as in gjpqy):
\usepackage{soul}
\setuldepth{abcdef} % sets ul depth based on letters w/o descenders
\newcommand{\vecu}[1]{\text{\ul{$#1$}}\xspace}
Bold:
\newcommand{\vecb}[1]{\ensuremath{\boldsymbol{#1}}\xspace}
And one more layer of shortcut/indirection (overwrites the caron diacritic)
\renewcommand{\v}[1]{\vect{#1}}
Shortcuts that I've found useful:
\newcommand{\reals}{\ensuremath{\mathbb{R}}\xspace}
\def \ba#1\ea{\begin{align*}#1\end{align*}}
\newcommand{\ii}{^{-1}}
\newcommand{\intii}{\int_{-\infty}^{\infty}}
Matrix formatting
check out
these posts from Stefan Kottwitz's excellent TeXblog
A cool trick to turn + - = into alignment marks (e.g. for systems of linear equations)
http://tex.stackexchange.com/questions/6965/multicol-layout-for-systems-of-linear-equations
Cool stuff with figures
http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions
MATLAB code
Get the
mcode package, which configures the listings package use with MATLAB. The demo is pretty self-explanatory, and the package works great!
Miscellaneous:
Accent marks:
http://en.wikibooks.org/wiki/LaTeX/Accents
Found this while researching this post and learned a bunch of new things:
http://www.math.uiuc.edu/~hildebr/tex/basics.html
For example, use
\eqref to put parentheses around the equation number.
To reduce vertical spacing around section headings:
\usepackage[compact]{titlesec}
Cursive lowercase l, as in l
2:
\ell