# Revision history [back]

### How to Latex-print matrices as a bold uppercase letter?

Hello Sage users!

I was reading the documentation and trying to find a solution for my personal chimera of LaTeX usage: if I define $\mathbf A$ to be a matrix at some scope (document, chapter or section for example), why do I have to explictly write \mathbf every time?

So my question for Sage is this: say I have a simple 2x2 matrix

$$\mathbf A = \left[ \begin{array}{rr} a & b \ c & d \end{array} \right]$$

I want to, at times, do symbolic manipulations with the letter representation of this matrix, then use the latex(...) command to print it as a bold upcase letter, and to use the full matrix form at other times (with its corresponding LaTeX form)

Is it possible to do this in Sage? And how?

### How to Latex-print matrices as a bold uppercase letter?

Hello Sage users!

I was reading the documentation and trying to find a solution for my personal chimera of LaTeX usage: if I define $\mathbf A$ to be a matrix at some scope (document, chapter or section for example), why do I have to explictly write \mathbf every time?

So my question for Sage is this: say I have a simple 2x2 matrix

$$\mathbf A = \left[ \begin{array}{rr} a & b \ \\ c & d \end{array} \right]$$

I want to, at times, do symbolic manipulations with the letter representation of this matrix, then use the latex(...) command to print it as a bold upcase letter, and to use the full matrix form at other times (with its corresponding LaTeX form)

form).

Example of what I want:

sage: A = matrix(2,2,var('a', 'b', 'c', 'd'))
sage: latex(A)
\left(\begin{array}{rr}
a & b \\
c & d
\end{array}\right)
sage: latex(A.as_symbol())
\Bold{A}


Similarly, I would like it very much to perform symbolic calculations with A in sage defined as an "abstract matrix", i.e., a symbol of type matrix, that will render as a bold uppercase A (because is of type matrix) but will be used as a symbol in computations. Example.

sage: var('A', 'B', 'c')
sage: A,B :: AbstractMatrix
sage: latex(A)
\Bold{A}
sage: A*B
A*B
sage: (A+B)*c
A*c + B*c
sage: latex(A*B)
\Bold{A}\Bold{B}
sage: latex((A+B)*c)
\Bold{A}*c +  \Bold{B}*c


Is it possible to do this in Sage? And how?

 3 retagged tmonteil 22963 ●25 ●162 ●420 http://wiki.sagemath.o...

### How to Latex-print matrices as a bold uppercase letter?

Hello Sage users!

I was reading the documentation and trying to find a solution for my personal chimera of LaTeX usage: if I define $\mathbf A$ to be a matrix at some scope (document, chapter or section for example), why do I have to explictly write \mathbf every time?

So my question for Sage is this: say I have a simple 2x2 matrix

$$\mathbf A = \left[ \begin{array}{rr} a & b \\ c & d \end{array} \right]$$

I want to, at times, do symbolic manipulations with the letter representation of this matrix, then use the latex(...) command to print it as a bold upcase letter, and to use the full matrix form at other times (with its corresponding LaTeX form).

Example of what I want:

sage: A = matrix(2,2,var('a', 'b', 'c', 'd'))
sage: latex(A)
\left(\begin{array}{rr}
a & b \\
c & d
\end{array}\right)
sage: latex(A.as_symbol())
\Bold{A}


Similarly, I would like it very much to perform symbolic calculations with A in sage defined as an "abstract matrix", i.e., a symbol of type matrix, that will render as a bold uppercase A (because is of type matrix) but will be used as a symbol in computations. Example.

sage: var('A', 'B', 'c')
sage: A,B :: AbstractMatrix
sage: latex(A)
\Bold{A}
sage: A*B
A*B
sage: (A+B)*c
A*c + B*c
sage: latex(A*B)
\Bold{A}\Bold{B}
sage: latex((A+B)*c)
\Bold{A}*c +  \Bold{B}*c


Is it possible to do this in Sage? And how?