sagemath / sagetex

Embed code, results of computations, and plots from the Sage mathematics software suite (https://www.sagemath.org) into LaTeX documents. Source repository for https://pypi.org/project/sagetex/ and https://ctan.org/pkg/sagetex
https://ctan.org/pkg/sagetex
Other
58 stars 22 forks source link

Are pmatrix, bmatrix, vmatrix, etc. available in sagetex? #46

Closed A1exN closed 4 years ago

A1exN commented 4 years ago

When I type something like: sage: m=matrix([[1,2],[3,4]]) and use \sage(m) in my latex document, it returns (not explicitly) the following text:

\left(\begin{array}{rr} 1 & 2 \ 3 & 4 \end{array}\right)

But there is a way it can return instead of that a text (depending of the type matrix I choose) like this:

\begin{pmatrix} 1 & 2 \ 3 & 4 \end{pmatrix}

or simply this:

\begin{array}{rr} 1 & 2 \ 3 & 4 \end{array}

In other words, are different types of matrices available in sagetex?

dimpase commented 4 years ago

I think sagetex takes the LaTeX representaton from Sage itself, namely, from here

E.g.

sage: m=matrix([[1,2,3],[4,5,6]])
sage: m._latex_??

will show docs and code - and array is hardcoded there. One can certainly improve this, but this ought to be done in Sage, not here.