bootstrap vimtex + ultisnips, with (mostly) sane defaults
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!?")
First, make sure you have
For Arch Linux and its derivatives ( Arch
pacman -S texlive-basic texlive-bin texlive-fontsrecommended texlive-mathscience texlive-binextra --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?
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)!
Sometimes you just want to write the letters that trigger a snippet, and you end up fighting the auto complete.
Note that not all of these may render correctly, since the Github latex rendering doesn't include the amsmath package.
| Trigger | Name | LaTeX | Flags | Context |
|---|---|---|---|---|
| beg | begin{} / end{} | \begin{ } \end{ } |
bA | None |
| \beg | begin{} / end{} | \begin{ } \end{ } |
bA | None |
| enum | enumerate | \begin{enumerate}\item \end{enumerate} |
bA | None |
| item | itemize | \begin{itemize}\item \end{itemize} |
bA | None |
| sec | section | \section{ } | bA | None |
| ssec | subsection | \subsection{ } | bA | None |
| sssec | subsubsection | \subsubsection{ } | bA | None |
| foot | footnote | \footnote{ } | None | None |
| theorem | theorem | \begin{theorem}[ ] \end{theorem} |
bA | None |
| pf | proof | \begin{proof}[ ] \end{proof} |
bA | None |
| def | definition | \begin{definition}[ ] \end{definition} |
bA | None |
| claim | claim | \begin{claim} \end{claim} |
bA | None |
| marg | margin note | \marginpar{ } | None | None |
| mm | Math | $${1}$!pif t[2] and t[2][0] not in [',', '.', '?', '-', ' ']:snip.rv = ' 'else:snip.rv = ''
|
wA | None |
| dm | Math | [${1:${VISUAL}}] | wA | None |
| ali | Align | \begin{align*}${1:${VISUAL}}\end{align*} |
bA | None |
| gath | Gather | \begin{gather*}${1:${VISUAL}}\end{gather*} |
bA | None |
| ff | fraction | Ai | "math()" | |
| ceil | ceil | i | "math()" | |
| floor | floor | i | "math()" | |
| le | <= | A | "math()" | |
| ge | >= | A | "math()" | |
| ne | != | A | "math()" | |
| ee | β | iiA | "math()" | |
| aa | β | iA | "math()" | |
| in | β | A | "math()" | |
| nin | β | A | "math()" | |
| xx | cross | A | "math()" | |
| cd | cdot | \cdot | A | None |
| spaceing | A | "math()" | ||
| to | -> | A | "math()" | |
| imp | => | A | "math()" | |
| xr | => | A | "math()" | |
| iff | iff | Ai | "math()" | |
| f0 | f(x_0) | iA | "math()" | |
| fx | f(x) | iA | "math()" | |
| f'x | f(x) | iA | "math()" | |
| ab | (a,b) | iA | "math()" | |
| ... | ... | A | "math()" | |
| inf | β | Ai | "math()" | |
| x0 | x_0 | Ai | "math()" | |
| nn | β© | A | "math()" | |
| uu | βͺ | A | "math()" | |
| cc | β | A | "math()" | |
| st | such that | A | "math()" | |
| st | such that | such that | None | None |
| Trigger | Name | LaTeX | Flags | Context |
|---|---|---|---|---|
| N | Naturals | A | "math()" | |
| Z | Integers | A | "math()" | |
| Q | Rationals | A | "math()" | |
| R | Reals | A | "math()" | |
| C | Complex | None | "math()" | |
| F | Field | None | "math()" | |
| bb | blackboard bold | i | "math()" | |
| bb | blackboard bold | i | None | |
| tt | text, AMS | A | "math()" | |
| lr( | left( right) | \left( ${1:${VISUAL}} \right) | i | None |
| lr | left | right | ||
| lr{ | left{ right} | \left\{ ${1:${VISUAL}} \right\} | i | None |
| lr[ | left[ right] | \left[ ${1:${VISUAL}} \right] | i | None |
| {{ | { } | iA | "math()" | |
| ub | underbrace | A | "math()" | |
| sum | sum | $$\sum_{k=${1:1}}^{${2:\infty}} |
w | "math()" |
| \int | integral | $$\int_{${1:a}}^{${2:b}} |
w | "math()" |
| taylor | taylor | \sum_{${1:k}=${2:0}}^{${3:\infty}} ${4:c_ } (x-a)^ | w | None |
| lim | limit | \lim_{${1:n} \to ${2:\infty}} | w | None |
| sr | ^2 | iA | "math()" | |
| cb | ^3 | iA | "math()" | |
| __ | subscript | _{ } | iA | None |
| ^^ | superscript | ^{ } | iA | None |
| rt | n-root | $$\sqrt[${1:2}]{ }$$ | iA | "math()" |
| log | log | A | "math()" | |
| cos | cos | A | "math()" | |
| sin | sin | A | "math()" | |
| cvec | column vector | \begin{pmatrix} ${1:x}_${2:1}\\\\ \vdots\\\\ _${2:n} \end{pmatrix} |
iA | None |
| "(small | [bBpvV])?mat(rix)?(\d+)x(\d+)" | (small | [bBpvV])?mat(rix)?(\d+)x(\d+) | |
| plot | Plot | \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} |
w | None |
| '(?<!\)(arcsin | arccos | arctan | arccot | arccsc |
| '(?<!\)(sin | cos | tan | cot | csc |
| Trigger | Name | LaTeX | Flags | Context |
|---|---|---|---|---|
| la | Ξ» | A | "math()" | |
| phi | Ο | None | "math()" | |
| be | Ξ² | None | "math()" | |
| ep | Ξ΅ | A | "math()" | |
| de | Ξ΄ | A | "math()" | |
| om | Ο | None | "math()" | |
| pi | Ο | None | "math()" | |
| al | Ξ± | None | "math()" |
Cooked up with parsnip.py, a tool for parsing snippets into markdown tables.