Discussion:
Mathematica code & Latex
(too old to reply)
Daniel Arnold
2005-12-29 08:27:49 UTC
Permalink
Hi all

In order to include some Mathematica code into a latex document I've
tried the package notebook2e. But as soon as I use this package all the
fonts in my latex document are changed. I am not able to include some
code without changing the whole document. Do you know how to fix that or
do you know other possibilities to get Mathematica code into a latex
document (others than making screenshots)?

Greets, Daniel
Christopher Arthur
2005-12-30 07:33:52 UTC
Permalink
Maybe this is too simple, but can't you just try the Save As Special...TeX
option on the File menu of the front end, then include that file in your
latex document? It doesn't seem to look exactly like the notebook front
end, but I can't see why it would change the rest of your formatting either.

Another option is to take postscript "screenshots" and display them as
figures. Maybe try pstoedit on the output postscript file since pstoedit
comes with some special implementation to make latex code from postscript
files.

C.Arthur
----- Original Message -----
From: "Daniel Arnold" <***@students.unibe.ch>
Subject: Mathematica code & Latex
Post by Daniel Arnold
Hi all
In order to include some Mathematica code into a latex document I've
tried the package notebook2e. But as soon as I use this package all the
fonts in my latex document are changed. I am not able to include some
code without changing the whole document. Do you know how to fix that or
do you know other possibilities to get Mathematica code into a latex
document (others than making screenshots)?
Greets, Daniel
c***@colorado.edu
2005-12-30 07:36:57 UTC
Permalink
My preference: save cell as eps, process with Illustrator
to replace trouble-prone fonts, include as figure.

If a Mathematica script uses only roman fonts,
verbatim mode insertion (with cut and paste, or
SaveSelection -> plain text) is also safe but less flexible.

If the LaTeX document is to be submitted to a publisher,
utmost care is needed with fonts. E.g. MathType fonts
in EPS figures may not show up correctly in their proofs.
Christopher Arthur
2005-12-30 07:46:52 UTC
Permalink
Daniel,

If the mathematica code is not too sophisticated, you don't have to use the notebook2e package. If you just use

\usepackage{amsmath,amssymb, graphics}

then you can get decent results, although the fonts for your mathematica code will end up looking more like typical latex fonts rather than the specialized fonts.

Actually...while we're on the subject...I have another latex issue that I can't seem to resolve: inline cells with formulae, when inside a text cell, do not format correctly when converted to latex. What happens is that special symbols get $ $ delimiters individually instead of around the whole inline cell. I tried changing the DefaultNewInlineCell to some "formula" type, and that gets me half-way there: the whole cell gets the math delimiters, but still the superfluous $'s don't leave. Any ideas?

Regards,

C.Arthur
Christopher Arthur
2005-12-30 08:18:15 UTC
Permalink
Maybe this is too simple, but can't you just try the Save As Special...TeX
option on the File menu of the front end, then include that file in your
latex document? It doesn't seem to look exactly like the notebook front
end, but I can't see why it would change the rest of your formatting either.

Another option is to take postscript "screenshots" and display them as
figures. Maybe try pstoedit on the output postscript file since pstoedit
comes with some special implementation to make latex code from postscript
files.

C.Arthur
----- Original Message -----
From: "Daniel Arnold" <***@students.unibe.ch>
Subject: Mathematica code & Latex
Post by Daniel Arnold
Hi all
In order to include some Mathematica code into a latex document I've
tried the package notebook2e. But as soon as I use this package all the
fonts in my latex document are changed. I am not able to include some
code without changing the whole document. Do you know how to fix that or
do you know other possibilities to get Mathematica code into a latex
document (others than making screenshots)?
Greets, Daniel
c***@colorado.edu
2005-12-30 08:21:19 UTC
Permalink
My preference: save cell as eps, process with Illustrator
to replace trouble-prone fonts, include as figure.

If a Mathematica script uses only roman fonts,
verbatim mode insertion (with cut and paste, or
SaveSelection -> plain text) is also safe but less flexible.

If the LaTeX document is to be submitted to a publisher,
utmost care is needed with fonts. E.g. MathType fonts
in EPS figures may not show up correctly in their proofs.
pacotomi
2005-12-30 08:23:36 UTC
Permalink
Post by Daniel Arnold
Hi all
In order to include some Mathematica code into a latex document I've
tried the package notebook2e. But as soon as I use this package all the
fonts in my latex document are changed. I am not able to include some
code without changing the whole document. Do you know how to fix that or
do you know other possibilities to get Mathematica code into a latex
document (others than making screenshots)?
Greets, Daniel
Hi,
It seems that Mathematica 5.2 does not need notebook2e. If I save my
notebook with Save as special -> TeX, I get :
***********************************************************
%% AMS-LaTeX Created by Wolfram Mathematica 5.2

\documentclass{article}
\usepackage{amsmath, amssymb, graphics}

\newcommand{\mathsym}[1]{{}}
\newcommand{\unicode}{{}}

\begin{document}

\noindent\(\pmb{1+1}\)

\noindent\(2\)


\end{document}
**************************************************************
Then I can merge the resulting code in my existing foo.tex

The result is ugly because Mathematica uses the amsmath "poor math
bold". But the procedure is very easy.

With Mathematica < 5.2 ...... Snip:-(

Pacotomi.
Christopher Arthur
2005-12-30 08:31:15 UTC
Permalink
Daniel,

If the mathematica code is not too sophisticated, you don't have to use the notebook2e package. If you just use

\usepackage{amsmath,amssymb, graphics}

then you can get decent results, although the fonts for your mathematica code will end up looking more like typical latex fonts rather than the specialized fonts.

Actually...while we're on the subject...I have another latex issue that I can't seem to resolve: inline cells with formulae, when inside a text cell, do not format correctly when converted to latex. What happens is that special symbols get $ $ delimiters individually instead of around the whole inline cell. I tried changing the DefaultNewInlineCell to some "formula" type, and that gets me half-way there: the whole cell gets the math delimiters, but still the superfluous $'s don't leave. Any ideas?

Regards,

C.Arthur
Daniel Arnold
2005-12-31 11:45:07 UTC
Permalink
Thanks for your answers

Including Mathematica code without notebook2e doesn't work. And I don't
want to make screenshots any more. There must be a way to make sure that
notebook2e.sty won't change the fonts. Can't I "reset" the fonts after
loading notebook2e?

Daniel
Post by Christopher Arthur
Daniel,
If the mathematica code is not too sophisticated, you don't have to use the notebook2e package. If you just use
\usepackage{amsmath,amssymb, graphics}
then you can get decent results, although the fonts for your mathematica code will end up looking more like typical latex fonts rather than the specialized fonts.
Actually...while we're on the subject...I have another latex issue that I can't seem to resolve: inline cells with formulae, when inside a text cell, do not format correctly when converted to latex. What happens is that special symbols get $ $ delimiters individually instead of around the whole inline cell. I tried changing the DefaultNewInlineCell to some "formula" type, and that gets me half-way there: the whole cell gets the math delimiters, but still the superfluous $'s don't leave. Any ideas?
Regards,
C.Arthur
Continue reading on narkive:
Loading...