MathGroup Archive 2006

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

Search the Archive

Re: LaTeX and the ConversionRules option

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66986] Re: LaTeX and the ConversionRules option
  • From: "davidr" <davidr at wolfram.com>
  • Date: Tue, 6 Jun 2006 06:27:32 -0400 (EDT)
  • References: <e53lrl$3vh$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I believe the user is asking three distinct questions:
1. How do you write a ConversionRule that handles both inline and top
level cells independently?
2. How do you write ConversionRules that will form both syntactically
and functionally appropriate TeX environments?
3. How do you write ConversionRules that will preserve cross
references?

Mathematica's TeXExport can already satisfy questions 1 and 3 in a
straightforward manner by using ConversionRules. However, question 2,
regarding the handling of environments, may require additional
formatting. Both techniques are illustrated below.

Note, Publicon is another Wolfram product that can export to TeX.
Publicon may be easier to use for TeXExport than Mathematica because
Publicon offers templated documents with predefined conversion rules
that correspond directly to specific LaTeX Packages.

Answers to questions:
1. How do you write a ConversionRule that handles both inline and top
level cells independently?

First note that the rhs of a "TeX" ConversionRule must be a List whose
contents are either two scalar, three scalar, or two List elements.

Examples:
a) "TeX" ConversionRule whose rhs is a List of two scalars:

ConversionRules:>{"TeX"->{"\\macroname{", "}"}}

b) "TeX" ConversionRule whose rhs is a List of three scalars:

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

c) "TeX" ConversionRule whose rhs is a List of two Lists:

ConversionRules:>{"TeX"->{{"lead text", InlineConversionFunction,
"trail text"},
  {"lead text", TopLevelConversionFunction, "trail text"}}}

The format we need to answer question 1 is found in Example c, where
the rhs of the ConversionRule is a List of two Lists. The two inner
List elements define a ConversionRule for inline cells and separate one
for the top level cell, respectively. From Example c, we see the
ConversionRule for inline cells is defined as {"lead text",
InlineConversionFunction, "trail text"}, where the first and third
elements of the list are always strings that are pre- and postpended,
respectively, to the inline conversion. The second element is the
conversion function itself.

The second list is defined as {"lead text", TopLevelConversionFunction,
"trail text"} It works in the same manner as the inline ConversionRule,
but it only acts on the top level cell as a whole.

2. How do you write ConversionRules that will form both syntactically
and functionally appropriate TeX environments?

If the content of the environment comes from only on a single cell,
like a single paragraph abstract, you could use a ConversionRule that
is similar to the following:

Example1--Style definition for "Abstract":

Cell[StyleData["Abstract"],


  • Prev by Date: Re: piecewise integration
  • Next by Date: Re: Re: Re: Simplifying algebraic expressions
  • Previous by thread: Re: .NET/Link and two-dimensional strings
  • Next by thread: Re: How can I use multiple filename ?