Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am not sure how to explain it, but whenever I compute something in Mathematica, the output always spits back the result in a Mathematica language as opposed to easy-to-read equations.

It's troublesome if my answer contains multiplies of parentheses and if my matrix is large.

Is there a way to make Mathematica display answers in "$\LaTeX$" form? So for instance, if i compute

RowReduce[{{1, 0}, {0, 1}}]

How do I make it spit out a square matrix instead of giving me back {{1, 0}, {0, 1}}?

share|improve this question
    
Try: {{1,0},{0,1}}//MatrixForm –  kale Sep 22 '12 at 23:05
2  
There is also TeXForm. TeXForm[{{1, 0}, {0, 1}}] gives: $\left( \begin{array}{cc} 1 & 0 \\ 0 & 1 \\ \end{array} \right)$ –  Oleksandr R. Sep 22 '12 at 23:08
    
By the way, welcome to the site. Your question displays a bit more nicely now, too. ;) For future reference, here's the guide to formatting your posts. –  Oleksandr R. Sep 22 '12 at 23:20

1 Answer 1

up vote 12 down vote accepted

Two possible answers.

  1. TexForm converts a Mathematica expression into something you can use to paste it in TeX:

    TeXForm[x/Sqrt[5]]
    ==> \frac{x}{\sqrt{5}}
    

    A usually more convenient way of achieving this is right-clicking output, and selecting Copy as | LaTeX.

  2. If all you're looking for is a neater display form inside Mathematica, then have a look at MatrixForm and TraditionalForm.

    m = {{1, 2}, {3, 4}};
    TraditionalForm[m]
    MatrixForm[m]
    

    enter image description here

    Be careful only to use these commands to display already existing values. For example, when you're writing something like

    m = TraditionalForm[{{1, 2}, {3, 4}}];
    Eigenvalues[m]
    

    then m is not assigned the matrix, but its TraditionalForm representation, which does not behave like a matrix anymore. The output of the above is simply a silly line:

    enter image description here

share|improve this answer
    
Thanks, but I am not solely interested in just displaying matrices, but also simplifying integrals, expressions, etc... –  jip Sep 23 '12 at 0:37
5  
@jak Then use a more illustrative example... You can't make matrices the focus of your question and expect us to divine that you actually wanted to simplify integrals –  rm -rf Sep 23 '12 at 0:59
1  
Actually I just found the solution. Under "preference" and "evaluation" in Mathematica, we can switch the output cells to TraditionalForm –  jip Sep 23 '12 at 2:05
    
Good to see you posting again, David. –  Mr.Wizard Sep 23 '12 at 2:44
    
@Mr.Wizard My activity on SE highly depends on what I'm currently using. Blame Haskell for my inactivity :-) –  David Sep 23 '12 at 19:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.