1
$\begingroup$

I have the following final expression which is a table (I am posting only a subsection of the table to illustrate the problem). I am pasting it from Mathematica without table formatting (to the bottom of the post) directly and it looks ugly, however, in table form looks as in the picture:

Subsection of table

Now, I would love to have this in $\LaTeX$. It is a very simple table from the visual point of view, however, Mathematica, upon using copy as $\LaTeX$, gives bunch of errors:

Errors

Is there a way to get the table in $\LaTeX$ or do I just have to generate the $\LaTeX$ output with Mathematica directly?

    {{" ", "C2ung(\!\(\*FormBox[\(1\),
TraditionalForm]\))", "CM1(\!\(\*FormBox[\(2\),
TraditionalForm]\))"}, {"Olivine", 
  "\!\(\*FormBox[TemplateBox[{TagBox[\nInterpretationBox[\"\\\"14.8\\\
\"\", 14.799999999999999`, AutoDelete -> True], NumberForm[#, {3, \
1}]& ],TagBox[\nInterpretationBox[\"\\\"14.8\\\"\", \
14.799999999999999`, AutoDelete -> True], NumberForm[#, {3, \
1}]& ],TagBox[\nInterpretationBox[\"\\\"14.8\\\"\", \
14.799999999999999`, AutoDelete -> True], NumberForm[#, {3, 1}]& ]},\n\
\"Subsuperscript\"],
TraditionalForm]\)", 
  "\!\(\*FormBox[TemplateBox[{TagBox[\n\
InterpretationBox[\"\\\"7.0\\\"\", 7.000000000000001, \
AutoDelete -> True], NumberForm[#, {3, 1}]& ],TagBox[\n\
InterpretationBox[\"\\\"6.3\\\"\", 6.3, AutoDelete -> True], \
NumberForm[#, {3, 1}]& ],TagBox[\nInterpretationBox[\"\\\"7.7\\\"\", \
7.7, AutoDelete -> True], NumberForm[#, {3, 1}]& ]},\n\
\"Subsuperscript\"],
TraditionalForm]\)"}, {"Pyroxene", 
  "\!\(\*FormBox[TemplateBox[{TagBox[\n\
InterpretationBox[\"\\\"1.4\\\"\", 1.4000000000000001`, \
AutoDelete -> True], NumberForm[#, {3, 1}]& ],TagBox[\n\
InterpretationBox[\"\\\"1.4\\\"\", 1.4000000000000001`, \
AutoDelete -> True], NumberForm[#, {3, 1}]& ],TagBox[\n\
InterpretationBox[\"\\\"1.4\\\"\", 1.4000000000000001`, \
AutoDelete -> True], NumberForm[#, {3, 1}]& ]},\n\"Subsuperscript\"],
TraditionalForm]\)", 
  "\!\(\*FormBox[TemplateBox[{TagBox[\n\
InterpretationBox[\"\\\"0.0\\\"\", 0., AutoDelete -> True], \
NumberForm[#, {3, 1}]& ],TagBox[\nInterpretationBox[\"\\\"0.0\\\"\", \
0., AutoDelete -> True], NumberForm[#, {3, 1}]& ],TagBox[\n\
InterpretationBox[\"\\\"0.0\\\"\", 0., AutoDelete -> True], \
NumberForm[#, {3, 1}]& ]},\n\"Subsuperscript\"],
TraditionalForm]\)"}}
$\endgroup$
  • 1
    $\begingroup$ Please include your actual Mathematica code in the question, not images of it. $\endgroup$ – bbgodfrey Nov 25 '15 at 5:55
  • $\begingroup$ The code for the table is included at the end of the post. Unfortunately, I do not know how to paste it better. $\endgroup$ – leosenko Nov 25 '15 at 6:36
7
$\begingroup$

Errors of the sort described by the OP can be reproduced by copying the lengthy block of code in the question to a notebook, prefixing TeXForm@TableForm, and executing it. (Be prepared to abort the execution.)

However, the same table shown near the top of the question can be produced from

TableForm@{{"", "C2ung(1)", "CM1(2)"},
           {"Olivine", Subscript[14.8, 14.8]^14.8, Subscript["7.0", 6.3]^7.7},
           {"Pyroxene", Subscript[1.4, 1.4]^1.4, Subscript["0.0", "0.0"]^"0.0"}} 

(I enclosed numbers with trailing zeroes in quotation marks to prevent Mathematica from deleting those zeros in the display. In fact, all numbers could be enclosed with quotation marks, if desired.)

Then, prefixing TeXForm gives the desired result

\left(
\begin{array}{ccc}
     \text{} & \text{C2ung(1)} & \text{CM1(2)} \\
     \text{Olivine} & 14.8_{14.8}^{14.8} & 7.0_{6.3}^{7.7} \\
     \text{Pyroxene} & 1.4_{1.4}^{1.4} & 0.0_{0.0}^{0.0} \\
    \end{array}
\right)

i.e.,

$\left( \begin{array}{ccc} \text{} & \text{C2ung(1)} & \text{CM1(2)} \\ \text{Olivine} & 14.8_{14.8}^{14.8} & 7.0_{6.3}^{7.7} \\ \text{Pyroxene} & 1.4_{1.4}^{1.4} & 0.0_{0.0}^{0.0} \\ \end{array} \right)$

Incidentally, replacing Subscript[14.8, 14.8]^14.8 by the more natural choice Subsuperscript[14.8, 14.8, 14.8] does not work well, because TeXForm cannot translate it to TeX.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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