Reputation: 4715
I want to get this snippet to work :
"General matrix": {
"prefix": "general-matrix-n-n-with-a-elements",
"body": [
"\\begin{equation}",
"\t \\begin{bmatrix}",
"\t\t a_{11} & a_{12} & a_{13} & \\dots & a_{1n} \\\\ ",
"\t\t a_{21} & a_{22} & a_{23} & \\dots & a_{2n} \\\\ ",
"\t\t \\vdots & \\vdots & \\vdots & \\ddots & \\vdots \\\\ ",
"\t\t a_{n1} & a_{n2} & a_{n3} & \\dots & a_{nn}",
"\t \\end{bmatrix}",
"\\end{equation}",
],
"description": "General n by n matrix"
So that it formats to this
\begin{equation}
\begin{bmatrix}
a_{11} & a_{12} & a_{13} & \dots & a_{1n} \\
a_{21} & a_{22} & a_{23} & \dots & a_{2n} \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
a_{n1} & a_{n2} & a_{n3} & \dots & a_{nn}
\end{bmatrix}
\end{equation}
But the backslashes are formatting to this
\begin{equation}
\begin{bmatrix}
a_{11} & a_{12} & a_{13} & \dots & a_{1n} \
a_{21} & a_{22} & a_{23} & \dots & a_{2n} \
\vdots & \vdots & \vdots & \ddots & \vdots \
a_{n1} & a_{n2} & a_{n3} & \dots & a_{nn}
\end{bmatrix}
\end{equation}
Note that there's not a double \\
at the end of the lines but a single \
Upvotes: 0
Views: 2483
Reputation: 181916
Just add two more backslashes as in:
"General matrix": {
"prefix": "general-matrix-n-n-with-a-elements",
"body": [
"\\begin{equation}",
"\t \\begin{bmatrix}",
"\t\t a_{11} & a_{12} & a_{13} & \\dots & a_{1n} \\\\\\ ",
"\t\t a_{21} & a_{22} & a_{23} & \\dots & a_{2n} \\\\\\ ",
"\t\t \\vdots & \\vdots & \\vdots & \\ddots & \\vdots \\\\\\ ",
"\t\t a_{n1} & a_{n2} & a_{n3} & \\dots & a_{nn}",
"\t \\end{bmatrix}",
"\\end{equation}",
],
"description": "General n by n matrix"
}
Each backslash in a snippet that you want printed needs to be double-escaped, so that is 2 extra per each backslash for a total of 6 if you want 2 outputted.
Upvotes: 6