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.

Is it possible to export a matrix to $\LaTeX$ with style?

For example this code will create a matrix with equal spacing matrix and with background colors in some cell, is it possible to export that to $\LaTeX$ ?

tb = Table[RandomInteger[{0, 10}], {10}, {10}];
Grid[tb, Dividers -> {{{{True, False}}, {-1 -> False, 
     1 -> False}}, {{{True, False}}, {-1 -> False, 1 -> False}}}, 
 ItemSize -> {4.5, 4}, Spacings -> {0, 0}, 
 Background -> {Automatic, Automatic, 
   Flatten@{Table[{{2 i + 1, 2 i + 2}, {2 i + 1, 2 i + 2}} -> 
       Green, {i, 0, 4}], 
     Table[{{2 i + 1, 2 i + 2}, {2 i - 1, 2 i}} -> Pink, {i, 1, 4}], 
     Table[{{2 i - 1, 2 i}, {2 i + 1, 2 i + 2}} -> Pink, {i, 1, 4}]}}] 

enter image description here

I tried to copy as $\LaTeX$ and Export["~/1.tex",%], both only give the matrix content without any formattings.

share|improve this question
5  
A general-purpose way of getting useable $\LaTeX$ code is to Export as PDF, then import into Inkscape and from there choose Save As > LaTeX with PSTricks Macros. That produces a .tex fragment which can go into the body of a host file as long as the latter calls \usepackage{pstricks} first. This isn't specific to tables, it works for anything that can be exported as PDF. For specific things like tables, it's also possible to generate the $\LaTeX$, but only by hand-coding it. –  Jens Apr 29 '13 at 0:54
1  
Please take a look at this post. –  Rod Apr 29 '13 at 2:01
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.