Skip to content

Snippets

Jerome Lelong edited this page Dec 25, 2018 · 39 revisions

Snippets and shortcuts

All commands are listed as ctrl+some key. If you're on Mac, don't worry we have written equivalents, so every time you see ctrl just imagine it's .

To have intellisense automatically triggered inside snippets, set editor.suggest.snippetsPreventQuickSuggestions to false. This is useful for instance if you want to enter \frac{x_{1}}{2} using @/+ x + __ + 1+ 2 using TAB to move from one tabstop to the next.

Environments

Some environments have a dedicated snippet in the form BXY where XY are the two first letters of the environment name. The starred versions use the prefix BSXY.

Prefix Environment name
BEQ equation
BSEQ equation*
BAL align
BSAL align*
BIT itemize
BEN enumerate
BSPL split
BCAS cases
BFR frame

Inserting Greek letters

Greek Letters can be inserted using the LaTeX command, which will autocomplete or using @ + letter

Prefix Letter
@a \alpha
@b \beta
@c \chi
@d \delta
@e \epsilon
@f \phi
@g \gamma
@h \eta
@i \iota
@k \kappa
@l \lambda
@m \mu
@n \nu
@p \pi
@q \theta
@r \rho
@s \sigma
@t \tau
@u \upsilon
@s \sigma
@o \omega
@& \wedge
@x \xi
@y \psi
@z \zeta
@D \Delta
@F \Phi
@G \Gamma
@Q \Theta
@L \Lambda
@X \Xi
@Y \Psi
@S \Sigma
@U \Upsilon
@W \Omega
@ve \varepsilon
@vf \varphi
@vs \varsigma
@vq \vartheta

Handy mathematical snippets

Some common mathematical symbols or commands have a dedicated snippet.

Prefix Command
@( \left( $1 \right)
@{ \left\{ $1 \right\}
@[ \left[ $1 \right]
__ _{$1}
** ^{$1}
... \dots
@. \cdot
@8 \infty
@6 \partial
@/ \frac{$1}{$2}
@% \frac{$1}{$2}
@^ \Hat{$1}
@_ \bar{$1}
@@ \circ
@0 ^\circ
@; \dot{$1}
@: \ddot{$1}
@= \equiv
@* \times
@< \leq
@> \geq
@2 \sqrt{$1}
@I \int_{$1}^{$2}
@| \Big |
@\ \setminus
@+ \bigcup
@- \bigcap
@, \nonumber

Font commands

Prefix Shortcut Command
fontsize Opens font size select
FNO \textnormal{${1}}
FRM ctrl+l, ctrl+r \textrm{${1}}
FEM ctrl+l, ctrl+e \emph{${1}}
FSF \textsf{${1}}
FTT ctrl+l, ctrl+t \texttt{${1}}
FIT ctrl+l, ctrl+i \textit{${1}}
FSL ctrl+l, ctrl+s \textsl{${1}}
FSC ctrl+l, ctrl+c \textsc{${1}}
FUL ctrl+l, ctrl+u \underline{${1}}
FUC ctrl+l, ctrl+u \uppercase{${1}}
FLC ctrl+l, ctrl+l \lowercase{${1}}
FBF ctrl+l, ctrl+b \textbf{${1}}
FSS ctrl+l, ctrl+6 \textsuperscript{${1}}
FBS ctrl+l, ctrl+minus \textsubscript{${1}}

Mathematical font commands

Prefix Shortcut Command
MRM ctrl+m, ctrl+r \mathrm{${1}}
MBF ctrl+m, ctrl+S+b \mathbf{${1}}
MBB ctrl+m, ctrl+b \mathbb{${1}}
MCA ctrl+m, ctrl+c \mathcal{${1}}
MIT ctrl+m, ctrl+i \mathit{${1}}
MTT ctrl+m, ctrl+t \mathtt{${1}}

Miscellaneous Actions

Shortcut Action
ctrl+l, ctrl+Enter Insert newline + \item

Surrounding text

with a command

To surround text with a command, just select some text and use ctrl+l, ctrl+w (+l, +w on Mac). A new menu pops up to select the command. This works with multi selections.

wrap demo

With an environment

To surround some selected text with an environment, call LaTeX Workshop: Surround/wrap selection with \begin{}...\end{} from the Command Palette (command latex-workshop.wrap-env). A multi-cursor is added inside the braces, to insert the environment name.

Surround with environment demo

Table of Contents

Clone this wiki locally