Re: About TeXForm
- To: mathgroup at smc.vnet.net
- Subject: [mg115085] Re: About TeXForm
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Thu, 30 Dec 2010 04:13:38 -0500 (EST)
First input XYZ = TableForm[...]: In Mathematica 8.0, the output now
differs from what you obtained in Mathematica 7.0:
\begin{array}{ccc}
& \text{q} & \text{w} \\
\text{1$\to $2} & 1 & 2 \\
\text{2$\to $3} & 3 & 4 \\
\text{1$\to $3} & 4 & 6
\end{array}
Second input XYZ and then %/TeXForm: I'm not sure what's going on there.
Third input XYZ // TeXForm: That makes sense and is unsurprising. The
value of XYZ is _not_ the original Mathematica list {{1,2}, ...} but
rather a TableForm object, the very same output you see from the first
input, and so TeXForm of that is giving a TeX rendering of an entirely
different object.
On 12/29/2010 5:59 AM, Themis Matsoukas wrote:
> Can someone explain the difference between the variations below? I am still on Mathematica 7.0 (mac).
>
> The following produces proper latex code for a table including its headings:
>
> XYZ = TableForm[
> {
> {1, 2},
> {3, 4},
> {4, 6}
> }, TableHeadings -> {{"1\[Rule]2", "2\[Rule]3", "1\[Rule]3"}, {"q", "w"}}
> ] // TeXForm
>
>
> \begin{array}{lll}
> & q& w \\
> \text{1$\to $2}& 1& 2 \\
> \text{2$\to $3}& 3& 4 \\
> \text{1$\to $3}& 4& 6
> \end{array}
>
>
> The following produces the latex code for the table without the table headings:
>
> XYZ
> % // TeXForm
>
> \left(
> \begin{array}{cc}
> 1& 2 \\
> 3& 4 \\
> 4& 6
> \end{array}
> \right)
>
>
> The following produces output similar to the verbatim environment with all the latex commands turned into latex text:
>
> XYZ // TeXForm
>
> \text{
> $\backslash $begin$\{$array$\}\{$lll$\}$
> $\&$ q $\&$ w $\backslash \backslash $
> $\backslash $text$\{$1$\$\backslash $to $\$$2$\}$ $\&$ 1 $\&$ 2
> $\backslash \backslash $
> $\backslash $text$\{$2$\$\backslash $to $\$$3$\}$ $\&$ 3 $\&$ 4
> $\backslash \backslash $
> $\backslash $text$\{$1$\$\backslash $to $\$$3$\}$ $\&$ 4 $\&$ 6
> $\backslash $end$\{$array$\}$
> }
>
> I would have expected all three variations to produce the same output.
>
> Thanks
>
> Themis
>
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305