Re: About TeXForm
- To: mathgroup at smc.vnet.net
- Subject: [mg115063] Re: About TeXForm
- From: Roland Franzius <roland.franzius at uos.de>
- Date: Thu, 30 Dec 2010 04:09:29 -0500 (EST)
- References: <iff4d2$rcj$1@smc.vnet.net>
Am 29.12.2010 12:00, schrieb Themis Matsoukas:
> 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.
Try
XYZ = TableForm[{{1, 2}, {3, 4}, {4, 6}},
TableHeadings -> {{"1\[Rule]2", "2\[Rule]3", "1\[Rule]3"}, {"q",
"w"}}];
XYZ//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}
XYZ // TeXForm // 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$\}$
}
As you see in your %-example the output Form is not stored in the
%-result list
TeXForm[XYZ]
...
%//FullForm
FullForm[{{1, 2}, {3, 4}, {4, 6}}]
after converting the output cell to input form.
--
Roland Franzius