Re: LaTeX format or multiline TeX
- To: mathgroup at smc.vnet.net
- Subject: [mg19971] Re: LaTeX format or multiline TeX
- From: paulh at wolfram.com (P.J. Hinton)
- Date: Thu, 23 Sep 1999 23:26:20 -0400
- Organization: "Wolfram Research, Inc."
- References: <7sa2v1$m4t@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <7sa2v1$m4t at smc.vnet.net>, Rita Bijlsma <R.Bijlsma at iri.tudelft.nl> writes:
> Is is possible to have mathematica give a formula in TeX format
> that will in TeX be written over several lines?
>
> Or, is LaTeX format possible (which is for me easier to read
>and adjust)
>
> Thanks for all and any help!,
If you're still running Mathematica 2.x under some form of
VMS, then the answer is no. You will have to write your
own formatting function to compute linebreaks.
Under Mathematica 3.0 and 4, the TeXForm[] function is capable
querying the front end for line break information, provided
that the kernel is being run from the front end and that the
expression supplied by the user is a box form or a Cell
expression with box form contents.
Let's say that I wanted to take the result of Expand[(x + y)^20]
and format it with TeXForm[]. The syntax for doing this would
be
TeXForm[ToBoxes[Expand[(x + y)^20]]]
If you were writing this to a file, you could also do:
ToString[ToBoxes[Expand[(x + y)^20], TeXForm]
The front end computes the line breaks based on the default
font sizes and format types defined by your style sheet or
inherited from global values. If you want greater control
over this, you can do something along the lines of:
ToString[
Cell[
BoxData[ToBoxes[Expand[(x + y)^20], TraditionalForm]],
FontFamily -> "Times",
FontSize -> 14,
PageWidth -> 640
],
TeXForm
]
If your windowing environment provides TeX Computer Modern fonts
so that they can be used in notebooks, you can specify that this
font be used at the size used in your TeX documents, and the
linebreak calculations will be pretty much on target.
Note that there are several macros that are emitted by the output
of TeXForm. You can find definitions for these macros in
notebook.sty, which appears on the Mathematica CD-ROM.
--
P.J. Hinton
Mathematica Programming Group paulh at wolfram.com
Wolfram Research, Inc.
Disclaimer: Opinions expressed herein are those of the author alone.