|
[Date Index]
[Thread Index]
[Author Index]
Re: Typesetting Mathematica code
"J. McKenzie Alexander" <jalex at lse.ac.uk> wrote in message
news:d3t3jq$8n4$1 at smc.vnet.net...
> What is the best way for including Mathematica source code (typically
> whole cells) - using the same typeface/font as in the front end - in
> LaTeX documents?
>
> It seems to me that there are three solutions: TeXForm, TeXSave, and
> saving the cell as EPS. But none of these seem really feasible.
>
> Using TeXForm doesn't seem ideal, since TeXForm[ expr ] first evaluates
> expr and prints a TeX version of the output, where what I want is the
> TeXForm of expr before evaluation. TeXSave is deprecated in Mathematica
> 5.1 and, anyway, doesn't preserve the typeface/font. For example, the
> lower-case double-stroked "e", "i", and "d" characters are translated
> into ordinary "e", "i", and "d". The only fail-safe way seems to be
> saving the cell as EPS, but that won't really work for very long cells,
> and seems extremely wasteful, since the same font definitions will be
> included many, many times.
>
If you are satisfied with TeXForm, then why not wrap your expression in
HoldForm and then use TeXForm.
For example:
TeXForm[ HoldForm[2^2] ]
returns
2^2
If there is some input line that you want to write out as TeX, you can use
Extract. For example, if line 8 had the input
In[8]:=
2^2
Out[8]=
4
Then you could recover this input as follows:
In[10]:=
Extract[DownValues[In],{8,2},HoldForm]//TeXForm
Out[10]//TeXForm=
2^2
Carl Woll
Prev by Date:
Re: Re: Re: Re: Infinite sum of gaussians
Next by Date:
Re: Re: FortranForm o/p question
Previous by thread:
Re: Re: Re: Re: Infinite sum of gaussians
Next by thread:
Re: Typesetting Mathematica code
|