MathGroup Archive 2010

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

Search the Archive

Re: About TeXForm

  • 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
>headings:

>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
>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
>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}
     }, 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"}}] //
     TeXForm;

In[17]:= xyz

Out[17]//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[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]],=
Rule[TableHeadings,List[List["1\[Rule]2","2\[Rule]3","1\[Rule]3"],List["q",=
"w"]]]]]

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