[OS X TeX] TeX & Mathematica 5.2

Jens Nöckel noeckel at uoregon.edu
Sun Nov 27 22:56:19 CET 2005

On Nov 27, 2005, at 5:53 AM, Themis Matsoukas wrote:

> 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

Hi Themis,

at present, Mathematica (even in version 5.1) has very buggy LaTeX 
output, and the retreat from the "mathematica.sty" requirement of 
earlier versions seems to have brought as many problems as it has 
brought benefits (the main benefit being that the output is more 
portable in principle). Perhaps Wolfram wants to strong-arm people into 
buying Publicon, their text-processing companion product, by keeping 
LaTeX export in Mathematica at a more rudimentary level...

I would currently not write long documents in Mathematica if they're 
intended for TeX export. Publicon may be better for that, but it again 
uses custom style files, as far as I recall (they had a beta versions 
years ago, I tried it in 2000 or even before that). For short LaTeX 
fragments Mathematica has, I think, actually become a bit more useful 
than before. However, its LaTeX code has gotten uglier than in earlier 
versions! For example, instead of using \begin{equation} or \[ for 
displayed equations, the exported .tex file just puts inline formulas 
\( ...\) into separate paragraphs to simulate the display style. These 
things might make sense with a view toward MathML or HTML conversion 
later on (e.g.), but it doesn't look good to those of us who actually 
read LaTeX source code...

I'm guessing that the \unicode and \mathsym commands are probably also 
introduced for purposes of conversion to MathML or HTML, etc. And 
you're absolutely right, the \unicode is missing an argument count [1]. 
The reason these commands exist is understandable - it provides the 
latex user with great flexibility in treating two types of "non-latex" 
there are some symbols in Mathematica for which there may not be a 
LaTeX command, but there could still exist a Unicode symbol. Although 
this is a problem for latex, it may not be a problem for 
post-processors like tex4ht for HTML translation, where one could then 
change the definition of  "\unicode"  to produce the desired unicode 
character (e.g., with \HCode).
There are Mathematica symbols for which not even a Unicode equivalent 
exists. E.g, \[math] or \[wolf] would be of that type. Such a symbol is 
then converted to \mathsym{Wolf}, and you again have the freedom to 
modify the \mathsym command to suit your particular purposes (the 
default being to gobble them up).

Unfortunately, there are other errors in the LaTeX export: e.g., type  
\[UpEquilibrium] in a notebook and you'll get a wrong LaTeX 
translation, involving "\upharpoon" instead of "\upharpoonleft".

As for neutralizing those \unicode commands - I guess they are intended 
to be as neutral as possible already...
Hope this helps,


Jens Uwe Nöckel
Assistant Professor
Department of Physics
University of Oregon

------------------------- 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/

More information about the macostex-archives mailing list