Python for LaTeX matrices

This commit is contained in:
Tobias Manske 2018-05-05 00:52:10 +02:00
parent 063e684d62
commit af9cbaca9a
No known key found for this signature in database
GPG Key ID: 978D99F12D4E041F

View File

@ -36,8 +36,12 @@ snippet lim0
\lim\limits_{${1:n} \to 0} ${2} \lim\limits_{${1:n} \to 0} ${2}
snippet <=> snippet <=>
\Leftrightarrow \Leftrightarrow
snippet =>
\Rightarrow
snippet o= snippet o=
\overset{${1}}{=} \overset{${1}}{=}
snippet sqrt
\sqrt[${1:2}]{${2}}
snippet qfa snippet qfa
\quad (\forall ${1} \in \mathbb{${2}}) \quad (\forall ${1} \in \mathbb{${2}})
snippet qin snippet qin
@ -54,9 +58,9 @@ snippet (a
(a_{${1}}^{(${2})}) (a_{${1}}^{(${2})})
snippet $(a snippet $(a
$(a_{${1}}^{(${2})})$ $(a_{${1}}^{(${2})})$
snippet .< snippet <
\langle ${1} \rangle \langle ${1} \rangle
snippet ..< snippet .<
$\langle ${1} \rangle$ $\langle ${1} \rangle$
snippet frac snippet frac
\frac{${1}}{${2}} \frac{${1}}{${2}}
@ -77,6 +81,20 @@ snippet def
\begin{definition} \begin{definition}
${1} ${1}
\end{definition} \end{definition}
snippet rem
\begin{rem}
${1}
\end{rem}
snippet bsp
\begin{bsp}
${1}
\end{bsp}
snippet satz
\begin{satz}
${1}
\end{satz}
snippet align snippet align
\begin{align*} \begin{align*}
@ -103,3 +121,12 @@ snippet cases
${1}, falls ${2}\\\\ ${1}, falls ${2}\\\\
${3}, sonst ${3}, sonst
\end{cases} \end{cases}
snippet matrix
\`\`\`{python, echo=FALSE, results="asis"}
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
D = [${1:[1,2,3],[4,5,6],[7,8,9]}]
print("\\\\left(\\\\begin{array}{" + 'c'*len(D[0]) + "}")
for r in D: print(' & '.join(str(x) for x in r) + "\\\\\\\\")
print("\\\\end{array}\\\\right)")
\`\`\`