Skip to main content

ready, set, vimtex!

The following is the README from my personal LaTeX setup:

ready-set-vimtex
#

bootstrap vimtex + ultisnips, with (mostly) sane defaults

But First!
#

Read Elijan Mastnak’s series, and Gilles Castel’s original article.

This is for those who want a starting point that “just works” (and also for those who look over my shoulder and ask “what’s that!?”)

For the Impatient
#

First, make sure you have $\LaTeX$ properly installed:

For Arch Linux and its derivatives ( Arch $\frac{dy}{dx}$):

pacman -S texlive-basic texlive-bin texlive-fontsrecommended texlive-mathscience --needed

Now, the vim plugins. Note that vimtex and delimitmate are in the AUR. You can alternatively use a vim plugin manager, but I don’t bother.

yay -S vim-vimtex vim-ultisnips vim-delimitmate

Last, but not least, place the config files in ~/.vim. Here’s a handy script to expedite that, and backup your current vimrc:

sh <(curl -s https://raw.githubusercontent.com/gsobell/ready-set-vimtex/main/setup.sh)

Good job! All done! That was quick, right?

Exciting Features!
#

Generate matrices with ease! pmat3x3 with just a tab becomes:

\begin{pmatrix}
         &  &  \\
         &  &  \\
         &  &  \\
\end{pmatrix}

With tab stops (just like typing a matrix on Wolfram Alpha)!

Idiosyncrasies
#

Sometimes you just want to write the letters that trigger a snippet, and you end up fighting the auto complete.

Table of Snippets
#

Note that not all of these may render correctly, since the Github latex rendering doesn’t include the amsmath package.

LaTex Structure
#

TriggerNameLaTeXFlagsContext
begbegin{} / end{}\begin{ } \end{ }bANone
\begbegin{} / end{}\begin{ } \end{ }bANone
enumenumerate\begin{enumerate}\item \end{enumerate}bANone
itemitemize\begin{itemize}\item \end{itemize}bANone
secsection\section{ }bANone
ssecsubsection\subsection{ }bANone
sssecsubsubsection\subsubsection{ }bANone
footfootnote\footnote{ }NoneNone
theoremtheorem\begin{theorem} \end{theorem}bANone
defdefinition\begin{definition} \end{definition}bANone
claimclaim\begin{claim} \end{claim}bANone
margmargin note\marginpar{ }NoneNone
mmMath$${1}$!pif t[2] and t[2][0] not in [',', '.', '?', '-', ' ']:snip.rv = ' 'else:snip.rv = ''wANone
dmMath[${1:${VISUAL}}]wANone
aliAlign\begin{align*}${1:${VISUAL}}\end{align*}bANone

Logic and Operators
#

TriggerNameLaTeXFlagsContext
fffraction$$\frac{ }{ } $$A“math()”
ceilceil$$\left\lceil \right\rceil $$iA“math()”
floorfloor$$\left\lfloor \right\rfloor $$iA“math()”
le<=$$\leqslant$$A“math()”
ge>=$$\geqslant$$A“math()”
ne!=$$\neq$$A“math()”
ee$$\exists ;$$iiA“math()”
aa$$\forall ;$$iA“math()”
in$$\in$$A“math()”
nin$$\notin$$A“math()”
xxcross$$\times$$A“math()”
cdcdot\cdotANone
qqspaceing$$\qquad$$A“math()”
to->$$\to$$A“math()”
=>=>$$\implies$$None“math()”
iffiff$$\iff$$Ai“math()”
f0f(x_0)$$f(x_0) $$iA“math()”
fxf(x)$$f(x) $$iA“math()”
f’xf(x)$$f’(x) $$iA“math()”
ab(a,b)$$a, b$$iA“math()”
$$\ldots$$A“math()”
ooo$$\infty$$Ai“math()”
x0x_0$$x_{0}$$Ai“math()”
nn$$\cap$$A“math()”
uu$$\cup$$A“math()”
cc$$\subseteq$$A“math()”
stsuch that$$\text{ such that }$$A“math()”
stsuch thatsuch thatNoneNone

Math Typesetting
#

TriggerNameLaTeXFlagsContext
NNaturals$$\mathbb{N}$$A“math()”
ZIntegers$$\mathbb{Z}$$A“math()”
QRationals$$\mathbb{Q}$$A“math()”
RReals$$\mathbb{R}$$A“math()”
CComplex$$\mathbb{C}$$None“math()”
FField$$\mathbb{F}$$None“math()”
bbblackboard bold$$\mathbb{ }$$i“math()”
bbblackboard bold$\mathbb{ }$iNone
tttext, AMS$$\text{ } $$A“math()”
lr(left( right)\left( ${1:${VISUAL}} \right)iNone
lrleftright
lr{left{ right}\left\{ ${1:${VISUAL}} \right\}iNone
lr[left[ right]\left[ ${1:${VISUAL}} \right]iNone
ubunderbrace$$\underbrace{ }_{ }$$A“math()”
sumsum$$\sum_{k=${1:1}}^{${2:\infty}} ${3:a_k z^n}$$w“math()”
\intintegral$$\int_{${1:a}}^{${2:b}} ${3:f(x)}, dx$$wA“math()”
taylortaylor\sum_{${1:k}=${2:0}}^{${3:\infty}} ${4:c_ } (x-a)^wNone
limlimit\lim_{${1:n} \to ${2:\infty}}wNone
sr^2$$^2$$iA“math()”
cb^3$$^3$$iA“math()”
__subscript_{ }iANone
^^superscript^{ }iANone
rtn-root$$\sqrt[${1:2}]{ }$$iA“math()”
loglog$$\log$$A“math()”
coscos$$\cos$$A“math()”
sinsin$$\sin$$A“math()”
cveccolumn vector\begin{pmatrix} ${1:x}_${2:1}\\\\ \vdots\\\\ _${2:n} \end{pmatrix}iANone
“(small[bBpvV])?mat(rix)?(\d+)x(\d+)”(small[bBpvV])?mat(rix)?(\d+)x(\d+)
plotPlot\begin{figure}[ ]\centering\begin{tikzpicture}\begin{axis}[xmin= ${2:-10}, xmax= ${3:10},ymin= ${4:-10}, ymax = ${5:10},axis lines = middle,]\addplot[domain= : , samples=${6:100}]{ };\end{axis}\end{tikzpicture}\caption{ }\label{${9: }}\end{figure}wNone
‘(?<!\)(arcsinarccosarctanarccotarccsc
‘(?<!\)(sincostancotcsc

Greek
#

TriggerNameLaTeXFlagsContext
laλ$$\lambda$$i“math()”
epε$$\varepsilon$$i“math()”
deδ$$\delta$$i“math()”
omω$$\omega$$i“math()”
piπ$$\pi$$i“math()”
alα$$\alpha$$i“math()”

Cooked up with parsnip.py, a tool for parsing snippets into markdown tables.

gsobell/ready-set-vimtex

bootstrap vimtex + ultisnips, with (mostly) sane defaults 🚀

Vim Snippet
1
0