       • To: mathgroup at smc.vnet.net
• Subject: [mg115065] Re: About TeXForm
• From: Bill Rowe <readnews at sbcglobal.net>
• Date: Thu, 30 Dec 2010 04:09:52 -0500 (EST)

On 12/29/10 at 5:59 AM, tmatsoukas at me.com (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

>XYZ = TableForm[
>{ {1, 2}, {3, 4}, {4, 6}
>}, TableHeadings -> {{"1\[Rule]2", "2\[Rule]3", "1\[Rule]3"}, {"q",
>}"w"}}
>]//TeXForm

<output snipped>

>The following produces the latex code for the table without the

>XYZ % // TeXForm

<output snipped>

>The following produces output similar to the verbatim environment
>with all the latex commands turned into latex text:

>XYZ // TeXForm

<output snipped>

>I would have expected all three variations to produce the same
>output.

i don't know why you were expecting this particularly for the
first and third variations. The first variation is equivalent to

expr//TeXForm

while the third is equivalent to

expr//TeXForm//TeXForm

why would you expect these to be the same? Perhaps you meant for
the first

(XYZ = TableForm[
{
{1, 2},
{3, 4},
{4, 6}
"1\[Rule]3"}, {"q", "w"}}
]) // TeXForm

that is forcing the assignment to occur *before* applying
TeXForm. This will cause the first and third to be the same.

The second is perhaps somewhat unexpected but can be explained
from the following:

In:= xyz = TableForm[{{1, 2}, {3, 4}, {4, 6}},
{"q", "w"}}] //
TeXForm;

In:= xyz

Out//TeXForm=
\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}

In:= % // FullForm

Out//FullForm= List[List[1,2],List[3,4],List[4,6]]

In:= xyz // FullForm

Out//FullForm= TeXForm[TableForm[List[List[1,2],List[3,4],List[4,6]],=