As far as I can see TeXForm of a matrix produces LaTeX arrays, which assume LaTeX is in math mode. However, Mathematica can be used to produce whole tables programmatically. Therefore I was wondering if there is a way to tell TeXForm to spit out LaTeX in a tabular environment, including the annoying dollar-signs needed for each cell that is in math mode. I cannot see any option for TeXForm to do this.

Of course one could program this, but that would be tedious, because one has to figure out what is math and what is not. And one also has to do the necessary substitutions. So I was wondering if this wheel has already been invented, or do I have to be the inventor? In any case, I invite suggestions.

  • 2
    $\begingroup$ I haven't tried it myself, but the Cells to TeX package might do a better job. (I found it by looking at the LaTeX tag on packagedata.net) $\endgroup$
    – C. E.
    Apr 4, 2016 at 13:52

1 Answer 1


Have a look at TeXTableForm.m: Converting Mathematica Lists to LaTeX Tables it is working quite well:

t = Table[i, {i, 1, 22}]

{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, \ 20, 21, 22}

TeXTableForm[t, 5, "tab1.tab"]



enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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