Ask Your Question
1

Can I get a matrix to show with brackets instead of parentheses?

asked 2014-09-09 17:28:54 +0200

mathochist gravatar image

I'm using Sage and SageTeX to make worksheets and quizzes for my Linear Algebra course. I'd like my presentation to match the book's, and the book uses brackets around its matrices instead of parentheses. Is that doable? Is there a way, for example, to get latex(A) to generate

\left[\begin{array}{rrr} 6 & 6 & 1 \\ 7 & 0 & 6 \\ 4 & -7 & -7 \end{array}\right]

instead of

\left(\begin{array}{rrr} 6 & 6 & 1 \\ 7 & 0 & 6 \\ 4 & -7 & -7 \end{array}\right)

for some matrix A.

edit retag flag offensive close merge delete

Comments

I found some discussion of the matter [on google](https://groups.google.com/forum/#!topic/sage-support/pP_DjwoYUGs), but I don't think I'm savvy enough to edit latex.py, especially since a search of my computer shows 9 seperate files called latex.py.

mathochist gravatar imagemathochist ( 2014-09-09 17:32:00 +0200 )edit
1

By the way, awesome to use SageTeX for this - a very good use of it.

kcrisman gravatar imagekcrisman ( 2014-09-09 18:14:06 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-09-09 18:13:18 +0200

kcrisman gravatar image

Luckily, this is probably easier than that, though it is a little hard to find that out because this is in an "underscore" method which is probably not in the reference manual. In fact, it was fixed shortly after a closely related discussion from six years ago.

sage: A = matrix([[6,6,1],[7,0,6],[4,-7,7]])
sage: latex(A)

this actually calls

sage: A._latex_()

which points out that one can customize matrix delimiters. So hopefully just doing

sage: latex.matrix_delimiters("[", "]")

will solve this for you!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-09-09 17:28:54 +0200

Seen: 942 times

Last updated: Sep 09 '14