Created: 2020-12-03 Thu 09:17
\begin{theorem}
TAB
or ENTER
, then it
will insert the "body" of the snippet.\alpha
\left( \right)
\frac{}{}
\begin{itemize} ... \end{itemize}
\emph{}
\mathbf{}
CTRL+SPC
will show all snippets whose prefix contains
that letter.{...}
.Each snippet has the following structure.
"snippet name": { "prefix": "snippet key", "body": "snippet body" }
Consider the following snippet.
"vandermonde determinant": { "prefix": "vdm", "body": "\\prod_{1\\le i<j\\le n} (x_i - x_j)" }
This snippet will insert the following when you press TAP after typing vdm:
\prod_{1\le i<j\le n} (x_i - x_j)
\\
to insert a single slash \
.,
after each
snippet.So, for example, your latex.jason file should look something like this (notice the outermost pair of curly braces):
{ "vandermonde determinant": { "prefix": "vdm", "body": "\\prod_{1\\le i<j\\le n} (x_i - x_j)" }, "vandermonde determinant2": { "prefix": "vdm2", "body": "\\prod_{1\\le i<j\\le n} (y_i - y_j)" } }
$1
, $2
, etc., and $0
.$1
, $2
, etc. mean the first argument and the second argument etc.$0
means the final location of the cursor when all the arguments have
been typed.Consider the following snippet.
"vandermonde det": { "prefix": "vdm", "body": "\\prod_{1\\le i<j\\le $1} ($2_i - $2_j)" }
$1
and then $2
. You
can move to the next argument by pressing TAB
.
If you type m
TAB
z
TAB
, then the snippet will insert this:
\prod_{1\le i<j\le m} (z_i - z_j)
$2
only once and it will be inserted twice as
designed.${n:default}
.
For example, the following snippet has default values n
and x
for the
arguments $1
and $2
respectively.
"vandermonde det": { "prefix": "vdm", "body": "\\prod_{1\\le i<j\\le ${1:n} (${2:x}_i - $2_j)" }
Write a snippet that inserts the following and place the cursor in the middle.
\langle \rangle
Write a snippet that inserts the following and place the cursor in the
middle. (Hint: a new line can be created using \n
.)
\[ \]
Write a snippet that inserts the following, where x
and n
are
given as default but can be changed to anything.
(x_1,x_2,\dots,x_n)
LaTeX Workshop has the snippet BCAS
that inserts the following.
\begin{cases} \end{cases}
Write your own snippet with the same prefix BCAS
that inserts
\begin{cases} A & \mbox{if $B$},\\ C & \mbox{D}. \end{cases}
and asks you to fill A, B, C, D in this order, where D is set to be
otherwise
by default, and locate the cursor below the line containing
\end{cases}
.
BCAS
.