# [OS X TeX] TeX & Mathematica 5.2

Peter Breitfeld phbrf at t-online.de
Mon Nov 28 01:29:21 CET 2005

Am 27. Nov 2005 um 14:53 schrieb Themis Matsoukas:

> The support of TeX in Mathematica 5.2 has changed and now files are
> exported in article style rather than in custom-made documentstyles
> that try to match the look of the notebook. I have a couple of
> problems with this:
>
> 1. Mathematica first defines two new new commands: \newcommand
> {\unicode}{{}} and \newcommand{\mathsym}[1]{{}}, both of which seem
> to contain empty definitions. Later in the latex document I see
> things like \unicode{0009}. From my Mathematica notebook I deduce
> that this refers to a tab character but in the latex file this
> simply causes the string "0009" to be printed. (The command
> \mathsym does not appear in the body of the notebook so I don't
> know what it is supposed to do).  I can neutralize the unicode
> command by defining it as \newcommand{\unicode}[1]{}, but what's
> the purpose of it in the first place?
>
> Any idea on how to neutralize these commands?
>
> 2. The default output produced by Mathematica's latex file is quite
> ugly and requires clean-up. Anyone knows how to produce nice latex
> output from Mathematica?
>
> Themis
>

You are right. I tried a 150 pages Notebook to convert into TeX and
it looked really ugly.
But there is someting, that can be done: I wrote a small file (named
it MMaInput.tex) which looks like this

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{bm,parskip}
\newif\ifInMMaBold
\renewcommand{\pmb}[1]{\InMMaBoldtrue\bm{{#1}}\InMMaBoldfalse}
\let\urtext\text
\renewcommand{\text}[1]{%
\ifInMMaBold
\urtext{\textbf{#1}}
\else
\urtext{#1}
\fi
}
\let\urgrave\grave
\renewcommand{\grave}{\,\urgrave\,}

It has to be imported after the \usepackage commands in the TeX file:
\input{MMaInput}

This way I get all MMa input-lines in non ugly bold. Math is typeset
bold because of the use of \bm, which replaces the ugly \pmb of
amsmath. The \text{...} stuff inside these lines is made bold too
with the \renewcommand of \text, which takes care of beeing inside
bold stuff.
For me the backticks were to tight to be visible, so I did a
\renewcommand of \grave too.

a blank line instead. This makes the output look better in this case.
In "normal" LaTeX files I usually don't use this.

Remark to \unicode:
In my big file there were only calls of \unicode{0009}. In the
notebook these were tabs, which TeX doesn't honor. A workaround is to
change the unicode command to:

This doesn't look pretty, because the columns will be ragged, but
better then no space at all.

My conclusion is: It's worse then in older Versions of Mathematica. I
think it's best to print the notebook to a PDF-File.

Gruß Peter
--
==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
Peter Breitfeld                 | http://www.pBreitfeld.de
Kreuzgasse 4, 88348 Bad Saulgau | PGP/GPG Key gibts hier

------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/