'Is there a way to add vertical line in a matrix using pylatex command?
This is the code I currently have
import numpy as np
from pylatex import Document, Section, Subsection,Command, Matrix,VectorName,Math
from pylatex.utils import NoEscape,bold
def randomizer(n = 3,a = 0 ,b = 20):
a = np.random.randint(a,b,size=(n, n+1))
# return augmented matrix
return n,a
def latexMiddle(doc):
n,a = mc.randomizer()
vec = Matrix(a, mtype='b')
vec_name = VectorName('a')
doc.append(NoEscape(r'\left['))
math = Math(data=[vec_name, '=', vec])
doc.append(math)
doc.append(NoEscape(r'\right]'))
doc.generate_tex()
doc.generate_pdf(clean=True, clean_tex=False,compiler='pdflatex')
I want it to output a matrix as latex code. I expect the output to look like this:
%
\[%
\mathbf{a} =
\left[
\begin{array}{ccc|c}%
0&6&7&6\\%
12&19&1&12\\%
9&5&3&17%
\end{array}%
\right]
\]%
%
But it does not work the full code is in this link : https://pastebin.com/76JEPN9A
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
