MathGroup Archive 1999

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

Search the Archive

Re: TeXForm with long expressions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg18392] Re: TeXForm with long expressions
  • From: paulh at wolfram.com (P.J. Hinton)
  • Date: Wed, 7 Jul 1999 00:10:58 -0400
  • Organization: Wolfram Research, Inc.
  • References: <7l0jdg$chl@smc.vnet.net> <7l3mmj$gen@smc.vnet.net> <7lcdqd$1hr@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <7lcdqd$1hr at smc.vnet.net>, "Xiaogang Wang" <xgwang at emu.thchem.ox.ac.uk> writes:

> If the expression is long, TeXForm does not know where to fold it. My
> solution
> is to split the expression manually. For example,
> 
> TeXForm[TraditionalForm[expr[[{1,2,3}]] ]]
> TeXForm[TraditionalForm[expr[[{4,5}]] ]]
> TeXForm[TraditionalForm[expr[[{6,7,8}]] ]]
> ....
> 
> I use TraditionalForm since I want variable to be italic, however sometimes
> TraditionalForm gives me expr[[{1,3,2}]] instead of expr[[{1,2,3}]], again
> a small problem.

The problem of breaking a long expression across lines is a nontrivial
one.  It requires making assumptions about the metrics of the fonts being
used to typeset the text.

If the kernel is connected to a notebook front end, you make TeXForm[]
return a linebroken version by supplying it box form representation.

	TeXForm[ToBoxes[expr], TraditionalForm]

The kernel will request that the front end provide information about how
this equation would be linebroken in the event that you used the
TraditionalForm format type in a notebook in the default font (Times).
Using TraditionalForm ensures that the line widths are computed with
single letter variables set in italics.

If you want to specify that a different page width be used, you can wrap
the boxes in a cell expression.

TeXForm[Cell[BoxData[ToBoxes[expr], TraditionalForm], PageWidth -> 600]]

The special macros emitted by TeXForm[] are defined in notebook.sty (plain
TeX and LaTeX 2.09) and notebook2e.sty (LaTeX 2e).  If you are using
Mathemtica 3.0, these files can be downloaded via anonymous ftp from
ftp.wolfram.com, the directory is /pub/outgoing/TeXSave/.  The .sty file
that you choose should be placed in a location where TeX searches for such
files.  If you are using notebook2e.sty, you must also download MathSource
item 0209-034, which provides a mechanism for using the Math fonts in a
TeX document. 

--
P.J. Hinton	
Mathematica Programming Group		paulh at wolfram.com
Wolfram Research, Inc.
Disclaimer: Opinions expressed herein are those of the author alone.


  • Prev by Date: Re: Problem with Mathematica 4. Someone can help me ?
  • Next by Date: Re: Problem with Mathematica 4. Someone can help me ?
  • Previous by thread: Re: TeXForm with long expressions
  • Next by thread: Re: easiest way to sort a list?