Update UltiSnips LaTeX snippets

This commit is contained in:
foo-dogsquared 2019-09-22 02:05:31 +08:00
parent 962932184e
commit bd5dc75b51

View File

@ -225,7 +225,7 @@ $2
$0 $0
endsnippet endsnippet
snippet equation "Equation environment for mathematical typesetting" biw snippet eq "Equation environment for mathematical typesetting" biw
\begin{equation} \begin{equation}
\label{eq:$1} \label{eq:$1}
$2 $2
@ -233,6 +233,41 @@ $2
$0 $0
endsnippet endsnippet
snippet subeq "Subequation environment" biw
\begin{subequations}
\label{eq:$1}
$2
\end{subequations}
$0
endsnippet
snippet align "Align equations environment" biw
\begin{align}
$1
\end{align}
$0
endsnippet
snippet alignli "Quick align equation with label" biw
${1:<LHS>} &= ${2:<RHS>} \label{eq:$3} \\ $4
endsnippet
snippet gathered "Gathered environment which lets you gather a bunch of equations and assign them under one equation number" bi
\begin{gathered}
\label{eq:$1}
$2
\end{gathered}
$0
endsnippet
snippet proof "Proof" biw
\begin{proof}
\label{proof:$1}
$2
\end{proof}
$0
endsnippet
snippet figure "Figure environment" biw snippet figure "Figure environment" biw
\begin{figure} \begin{figure}
\centering \centering
@ -290,11 +325,37 @@ snippet agraph "Quickly plot a graph without considering integers" bi
$0 $0
endsnippet endsnippet
snippet plot "Add a plot line" i snippet graph3 "3D graph from pgfplots package" bi
\addplot[domain=$1:$2, samples=${3:`!p snip.rv=add_variable_numbers(t[1], t[2], 1, absolute=true)`}]`!p snip.rv=smart_space(t[4], ", ")`$4{${5: x}} \begin{figure}[${1:ht}]
\centering
\begin{tikzpicture}
\begin{axis}[
xlabel=${2:$x$},
ylabel=${3:$y$},
grid=major,
axis equal=false,
tick style={very thick},
major tick style=thick,
domain=${4:-10}:${5:10},`!p snip.rv = smart_space(t[6], "\n\t", loose=True)`$6
]
\addplot3[samples=${7:`!p snip.rv = add_variable_numbers(t[4], t[5], 1, absolute=True)`},$8]{${9:x}};
\end{axis}
\end{tikzpicture}
\caption{$10}
\label{fig:${11:$10}}
\end{figure}
$0 $0
endsnippet endsnippet
snippet plot "Add a plot line" i
\addplot[domain=$1:$2, samples=${3:`!p snip.rv=add_variable_numbers(t[1], t[2], 1, absolute=True)`}]`!p snip.rv=smart_space(t[4], ", ")`$4{${5: x}}
$0
endsnippet
snippet plot3 "Add a 3D plot" i
\addplot3[domain=$1:$2, samples=${3:`!p snip.rv=add_variable_numbers(t[1], t[2], 1, absolute=True)`}]`!p snip.rv=smart_space(t[4], ", ")`$4{${5:x}}
$0
endsnippet
# Common mathematical functions and symbols # Common mathematical functions and symbols
# Also take note that most expressions are prepended with 'M' to mean mathematical usage # Also take note that most expressions are prepended with 'M' to mean mathematical usage
@ -318,7 +379,7 @@ snippet != "Not equal" iw
\neq \neq
endsnippet endsnippet
snippet <= "Greater than or equal to" iw snippet >= "Greater than or equal to" iw
\geq \geq
endsnippet endsnippet
@ -326,7 +387,7 @@ snippet !> "Not greater than" iw
\ngtr \ngtr
endsnippet endsnippet
snippet >= "Less than or equal to" iw snippet <= "Less than or equal to" iw
\leq \leq
endsnippet endsnippet
@ -392,16 +453,16 @@ snippet -cb "Cube superscript" iw
endsnippet endsnippet
context "math()" context "math()"
snippet -- "Superscript" iwA snippet -- "Superscript" iA
^{$1}$0 ^{$1}$0
endsnippet endsnippet
context "math()" context "math()"
snippet __ "Subscript" iwA snippet __ "Subscript" iA
_{$1}$0 _{$1}$0
endsnippet endsnippet
snippet ... "Ellipsis" iw snippet ... "Ellipsis" iA
\ldots \ldots
endsnippet endsnippet
@ -450,6 +511,11 @@ snippet "-(\d+|\w+) / (\d+|\w+)-" "Quick fraction" riwA
$0 $0
endsnippet endsnippet
context "math()"
snippet "\*" "Quick multiplication binary operator" riA
\cdot
endsnippet
context "math()" context "math()"
snippet mod "Mod operator (as binary operator)" iw snippet mod "Mod operator (as binary operator)" iw
\bmod $0 \bmod $0
@ -869,10 +935,16 @@ snippet li "List item for the OL/UL lists" iw
$0 $0
endsnippet endsnippet
context "not math()"
snippet a "URL links (with description)" iw snippet a "URL links (with description)" iw
\href{${1:<url>}}{${2:<description>}} $0 \href{${1:<url>}}{${2:<description>}} $0
endsnippet endsnippet
context "not math()"
snippet url "Raw URL link" iw
\url{${1:<url>}} $0
endsnippet
snippet al "Reference links with label" iw snippet al "Reference links with label" iw
\autoref{${1:<label>}}$0 \autoref{${1:<label>}}$0
endsnippet endsnippet