LaTeX and the ConversionRules option

• To: mathgroup at smc.vnet.net
• Subject: [mg66649] LaTeX and the ConversionRules option
• From: exorch at gmail.com
• Date: Thu, 25 May 2006 02:58:53 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

Hi,

I would like to use the File -> Save As Special ... -> TeX feature to
save one of my Mathematica notebooks as a *.tex file.  Also, I would
like to use the ConversionRules option in a custom cell in a custom
style sheet to directly transfer TeX code into the final document.  The
code I am using write now (in the options for the style cell) is this:

ConversionRules:> "TeX" -> {    {"", Identity, ""}, {"", Identity, ""}
}

This should (and does, in some cases) put the text that I type in the
cells of the custom style directly into the final *.tex document.
According to the rule, the text in the cell is prefaced by nothing, is
formatted by "Identity" (as opposed to TeXForm), and nothing is placed
after it.  The conversion rule works fine when I make standalone cells
of the custom style type, allowing me to put TeX code directly into my
Mathematica notebook and have it saved correctly in the final *.tex
document.  However, when I try to make inline cells of the custom style
type (say, in cells of the NumberedEquation style) by using CTRL+9
<typestuff> CTRL+0, the conversion rule does not work on the inline
cell, and I end up with <typestuff> being interpreted as text and
presented as text in the final *.tex document (even if it were code,
for example "\today" ends up being not "May 24, 2006" but is "\today"
after compiling the *.tex document).

Is this error what is meant by "For the cases where TeXSave generates a
custom TeX macro, the delimiters specified in the conversion rule are
overridden, leaving only the formatting function to have an impact on
the output. A typical formatting function used in conversion rules is
TeXForm." on the page to which I linked?  If so, I'm not really sure
how I can achieve nested environments consisitently (i.e.
\begin{environment-name} ... \end{environment-name}).  It is easy to
nest environments when actually writing a TeX document manually, but
when I nest cells (which correspond to environments, as no lower level
construct has a ConversionRules option) in Mathematica notebooks, the
conversion rules for nested cells do not trigger.

I am hoping that there is some way for this to work.

However, what I am actually trying to implement is just a reference
system by which I can refer to equations by labels rather than their
number (which may or may not change as I add or delete equations from
my document).  I would like to mimic the functionality of the
\label{keyname} and \ref{keyname} commands from LaTeX in a Mathematica
notebook, so that when I Save As Special ... -> TeX, my TeX document
will have correct cross-references.  Mathematica to some extent already
has an implementation of this in its Labels and Hyperlinks, but I don't
know how to (or if I can) transfer these Labels and Hyperlinks to my
TeX document when I Save As Special ... -> TeX.