MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: About TeXForm

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

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

<output snipped>

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

>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

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


while the third is equivalent to


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

(XYZ = TableForm[
     {1, 2},
     {3, 4},
     {4, 6}
     }, TableHeadings -> {{"1\[Rule]2", "2\[Rule]3",
"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[16]:= xyz = TableForm[{{1, 2}, {3, 4}, {4, 6}},
     TableHeadings -> {{"1\[Rule]2", "2\[Rule]3", "1\[Rule]3"},
{"q", "w"}}] //

In[17]:= xyz

   & \text{q} & \text{w} \\
  \text{1$\to $2} & 1 & 2 \\
  \text{2$\to $3} & 3 & 4 \\
  \text{1$\to $3} & 4 & 6

In[18]:= % // FullForm

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

In[19]:= xyz // FullForm

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

That is for the second variation, TeXForm acts on the output
saved on the stack which is clearly not the same as what was
assigne to xyz

  • Prev by Date: Re: About TeXForm
  • Next by Date: Re: About TeXForm
  • Previous by thread: Re: About TeXForm
  • Next by thread: Re: About TeXForm