LaTeX Resources

Common Requirements
\usepackage{xparse}
Algebra
alt-group
\DeclareDocumentCommand\altgroup{m}{\mathcal{A}_{#1}}
more
sym-group
\DeclareDocumentCommand\symgroup{m}{\mathcal{S}_{#1}}
more
Asymptotics
order-big-O
\DeclareDocumentCommand\orderO{m}{\mathcal{O}\left(#1\right)}
more
order-little-o
\DeclareDocumentCommand\ordero{m}{o\left(#1\right)}
more
order-omega
\DeclareDocumentCommand\orderOmega{m}{\Omega\left(#1\right)}
more
order-poly
\DeclareDocumentCommand\orderPoly{m}{\operatorname{poly}\left(#1\right)}
more
order-small-omega
\DeclareDocumentCommand\orderomega{m}{\omega\left(#1\right)}
more
order-theta
\DeclareDocumentCommand\orderTheta{m}{\Theta\left(#1\right)}
more
Basics
bincoeff
\DeclareDocumentCommand\bincoeff{mm}{\genfrac{(}{)}{0pt}{}{#1}{#2}}
more
card
\DeclareDocumentCommand\card{m}{\left|#1\right|}
more
disjoint-union
\DeclareDocumentCommand\dcup{}{\cupdot}
more
encoding-length
\DeclareDocumentCommand\enclen{m}{\left<#1\right>}
more
encoding
\DeclareDocumentCommand\encoding{m}{\llcorner#1\lrcorner}
more
set
\DeclareDocumentCommand\setdef{mo}{\left\{#1\IfNoValueTF{#2}{}{ : #2}\right\}}
more
Calculus
gradient
\DeclareDocumentCommand\grad{mm}{\operatorname{grad}_{#1}\left(#2\right)}
more
Complexity
complexity-MAXSNP
\DeclareDocumentCommand\cplxMAXSNP{}{\mathsf{MAXSNP}}
more
complexity-NP
\DeclareDocumentCommand\cplxNP{}{\mathsf{NP}}
more
complexity-P
\DeclareDocumentCommand\cplxP{}{\mathsf{P}}
more
complexity-coNP
\DeclareDocumentCommand\cplxcoNP{}{\mathsf{coNP}}
more
karp-reduction
\DeclareDocumentCommand\leqkarp{}{\mathop{\preceq_{\mathsf{P}}}}
more
Environments
tag-block
\DeclareDocumentEnvironment{tagblock}{mmo}{
  \newlength{\tagblockwidth} \newlength{\tagblocksep} \settowidth{\tagblockwidth}{(#1)}
  \IfValueTF{#3}{\setlength{\tagblocksep}{#3}}{\setlength{\tagblocksep}{0mm}}
  \par\noindent \parbox{\tagblockwidth}{\begin{align}\tag{#1}#2\end{align}}
  \hfill \begin{minipage}{\linewidth-\tagblockwidth-\tagblocksep-5mm}
}{\end{minipage} \vspace{1em}}
more
Graphs
in-arcs
\DeclareDocumentCommand\inarcs{m}{\delta^-\left(#1\right)}
more
in-neighbors
\DeclareDocumentCommand\inneigh{m}{\operatorname{N}^-\left(#1\right)}
more
neighbors
\DeclareDocumentCommand\neigh{m}{\operatorname{N}\left(#1\right)}
more
out-arcs
\DeclareDocumentCommand\outarcs{m}{\delta^+\left(#1\right)}
more
out-neighbors
\DeclareDocumentCommand\outneigh{m}{\operatorname{N}^+\left(#1\right)}
more
star-edges
\DeclareDocumentCommand\staredges{m}{\delta\left(#1\right)}
more
Linear Algebra
affine-hull
\DeclareDocumentCommand\aff{o}{\operatorname{aff}\IfValueTF{#1}{\left(#1\right)}{}}
more
boundary
\DeclareDocumentCommand\bd{o}{\operatorname{bd}\IfValueTF{#1}{\left(#1\right)}{}}
more
closure
\DeclareDocumentCommand\cl{o}{\operatorname{cl}\IfValueTF{#1}{\left(#1\right)}{}}
more
columns
\DeclareDocumentCommand\cols{o}{\operatorname{cols}\IfValueTF{#1}{\left(#1\right)}{}}
more
conic-hull
\DeclareDocumentCommand\cone{o}{\operatorname{cone}\IfValueTF{#1}{\left(#1\right)}{}}
more
convex-conic-hull
\DeclareDocumentCommand\ccone{o}{\operatorname{ccone}\IfValueTF{#1}{\left(#1\right)}{}}
more
convex-hull
\DeclareDocumentCommand\conv{o}{\operatorname{conv}\IfValueTF{#1}{\left(#1\right)}{}}
more
dehomogenize
\DeclareDocumentCommand\dehomog{o}{\operatorname{dehomog}\IfValueTF{#1}{\left(#1\right)}{}}
more
determinant
\DeclareDocumentCommand\det{o}{\operatorname{det}\IfValueTF{#1}{\left(#1\right)}{}}
more
dimension
\DeclareDocumentCommand\dim{o}{\operatorname{dim}\IfValueTF{#1}{\left(#1\right)}{}}
more
direction-space
\DeclareDocumentCommand\dir{o}{\operatorname{dir}\IfValueTF{#1}{\left(#1\right)}{}}
more
equation-set
\DeclareDocumentCommand\eqnset{om}{\IfValueTF{#1}{\mathop{\text{Eq}}_{#1}}{\mathop{\text{Eq}}}\left(#2\right)}
more
homogenize
\DeclareDocumentCommand\homog{o}{\operatorname{homog}\IfValueTF{#1}{\left(#1\right)}{}}
more
identity-matrix
\DeclareDocumentCommand\idmat{o}{\IfNoValueTF{#1}{\mathbb{I}}{\mathbb{I}_{#1}}}
more
image
\DeclareDocumentCommand\im{o}{\operatorname{im}\IfValueTF{#1}{\left(#1\right)}{}}
more
interior
\DeclareDocumentCommand\int{o}{\operatorname{int}\IfValueTF{#1}{\left(#1\right)}{}}
more
kernel
\DeclareDocumentCommand\ker{o}{\operatorname{ker}\IfValueTF{#1}{\left(#1\right)}{}}
more
lineality-space
\DeclareDocumentCommand\lineal{o}{\operatorname{lineal}\IfValueTF{#1}{\left(#1\right)}{}}
more
linear-hull
\DeclareDocumentCommand\lin{o}{\operatorname{lin}\IfValueTF{#1}{\left(#1\right)}{}}
more
one-vector
\DeclareDocumentCommand\onevec{o}{\IfNoValueTF{#1}{\mathbbm{1}}{\mathbbm{1}_{#1}}}
more
polar
\DeclareDocumentCommand\polar{m}{#1^{\circ}}
more
projection
\DeclareDocumentCommand\proj{oo}{\IfValueTF{#1}{\operatorname{proj}{}_{#1}}{%
  \operatorname{proj}{}}\IfValueTF{#2}{\left(#2\right)}{}}
more
psd-matrices
\DeclareDocumentCommand\psdmat{m}{\mathbbm{S}^{#1}_+}
more
rank
\DeclareDocumentCommand\rank{o}{\operatorname{rank}\IfValueTF{#1}{\left(#1\right)}{}}
more
rows
\DeclareDocumentCommand\rows{o}{\operatorname{rows}\IfValueTF{#1}{\left(#1\right)}{}}
more
scalar-product
\DeclareDocumentCommand\scalprod{mm}{\left<#1,#2\right>}
more
sec-order-cone
\DeclareDocumentCommand\socone{m}{\mathbb{L}^{#1}}
more
sign
\DeclareDocumentCommand\sgn{o}{\operatorname{sgn}\IfValueTF{#1}{\left(#1\right)}{}}
more
support
\DeclareDocumentCommand\supp{o}{\operatorname{supp}\IfValueTF{#1}{\left(#1\right)}{}}
more
sym-matrices
\DeclareDocumentCommand\symmat{m}{\mathbbm{S}^{#1}}
more
trace
\DeclareDocumentCommand\tr{o}{\operatorname{tr}\IfValueTF{#1}{\left(#1\right)}{}}
more
transpose
\DeclareDocumentCommand\transpose{m}{#1^{\intercal}}
more
unit-vector
\DeclareDocumentCommand\unitvec{m}{\mathbbm{e}_{#1}}
more
zero-vector
\DeclareDocumentCommand\zerovec{o}{\IfNoValueTF{#1}{\mathbb{O}}{\mathbb{O}_{#1}}}
more
Polyhedra
ext-complexity
\DeclareDocumentCommand\xc{o}{\operatorname{xc}\IfValueTF{#1}{\left(#1\right)}{}}
more
normal-cone
\DeclareDocumentCommand\normalCone{mm}{\operatorname{N}_{#1}\left(#2\right)}
more
poly-faces
\DeclareDocumentCommand\polyFaces{o}{\mathop{\mathcal{F}}\IfValueTF{#1}{\left(#1\right)}{}}
more
poly-facets
\DeclareDocumentCommand\polyFacets{o}{\mathop{\widehat{\mathcal{F}}}\IfValueTF{#1}{\left(#1\right)}{}}
more
poly-lattice
\DeclareDocumentCommand\polyLattice{o}{\mathop{\mathcal{L}}\IfValueTF{#1}{\left(#1\right)}{}}
more
poly-vertices
\DeclareDocumentCommand\polyVerts{o}{\mathop{\mathcal{V}}\IfValueTF{#1}{\left(#1\right)}{}}
more
radial-cone
\DeclareDocumentCommand\radialCone{mm}{\operatorname{K}_{#1}\left(#2\right)}
more
Sets
complex
\DeclareDocumentCommand\C{}{\mathbb{C}}
more
integers
\DeclareDocumentCommand\Z{}{\mathbb{Z}}
more
naturals
\DeclareDocumentCommand\N{}{\mathbb{N}}
more
rationals
\DeclareDocumentCommand\Q{}{\mathbb{Q}}
more
reals
\DeclareDocumentCommand\R{}{\mathbb{R}}
more
Stochastics
expectation
\DeclareDocumentCommand\expect{mo}{\mathbb{E}\left[#1\IfValueTF{#2}{\,\middle|\,#2}{}\right]}
more
probability
\DeclareDocumentCommand\prob{mo}{\mathbb{P}\left[#1\IfValueTF{#2}{\,\middle|\,#2}{}\right]}
more
variance
\DeclareDocumentCommand\variance{o}{\operatorname{Var}\IfValueTF{#1}{\left(#1\right)}{}}
more
Technial Commands
input-options
\ProvideDocumentCommand\inputOptions{mo}{
  {\IfNoValueTF{#2}
  { \edef\keyValueParams{} }
  { \edef\keyValueParams{#2} }
  \def\pgfeqkeys [##1] %
    {\def\tikzPath{/options} \expandafter\pgfqkeys\expandafter{\expandafter\tikzPath\expandafter}\expandafter{##1}}
  \def\parseOptions {\expandafter\pgfeqkeys[\keyValueParams] }
  \input{#1}
}}
more