This is documentation for Mathematica 4, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

 Documentation /  Mathematica /  Eingebaute Funktionen /  Neu in Version 3.0 /  Eingabe und Ausgabe /

HTMLSaveStandardForm

TeXSave

FilledSmallSquare TeXSave["datei.tex"] speichert eine TeX-Version des aktuell in der Benutzeroberfläche gewählten Notebooks.

FilledSmallSquare TeXSave["datei.tex", "quelle.nb"] speichert eine TeX-Version des Notebooks aus der Datei quelle.nb.

FilledSmallSquare TeXSave["datei.tex", notebook] speichert eine TeX-Version des Notebooks, das dem spezifizierten Notebook-Objekt entspricht.

FilledSmallSquare TeXSave hat Optionen, mit denen Eigenschaften spezifiziert werden können, wie man zum Beispiel Grafik mit-einbezieht, welches TeX-Format zu verwenden ist, und wie jeder Notebook-Stil in TeX dargestellt werden soll.

FilledSmallSquare Auf TeXSave kann häufig über den Menübefehl Speichern unter (spezial) (Save As Special) in der Notebook-Benutzeroberfläche zugegriffen werden.

FilledSmallSquare Siehe Anmerkungen zu TeXForm.

FilledSmallSquare Siehe Das Mathematica Buch: 1.11.6.

FilledSmallSquare Siehe auch: TeXForm, HTMLSave.

Additional Information

User Interface

In addition to being able to convert individual expressions to TeX, Mathematica also provides capabilities for translating complete notebooks and their subexpressions. The conversion is done by the kernel function TeXSave, which may be accessed either directly or from the Save As Special menu on the notebook front end.

Required Materials for Processing Output

The default output of TeXSave is designed to be compatible with the LaTeX2 document preparation system. TeXSave output employs specialized macros, which are defined in the LaTeX package notebook2e.sty that comes with most versions of Mathematica.

To ensure that the TeX document resembles the appearance of printed Mathematica notebooks, the macro definitions in notebook2e.sty typeset plain text with the Times, Helvetica, and Courier font families instead of the TeX-native Computer Modern fonts. Your LaTeX installation will need to be configured to support the creation of DVI files that use these fonts. It is unlikely that you will need to make any adjustments since the default setup of most current TeX distributions includes this feature. If you performed a minimal installation of the distribution, you may need to install additional modules for that distribution. Refer to your distribution's Local Guide for more information.

The math mode macros in notebook2e.sty typeset special characters using the same fonts used by Mathematica. This is done with the help of Jens-Peer Kuska's Mathematica Virtual Font Package. Since virtual fonts are used instead of PK fonts, you will not be able to see the special characters in most DVI previewers. The characters will be visible after the DVI file has been converted to PostScript by a driver like DVIPS.

The notebook2e.sty file and the virtual fonts package are included with most versions of Mathematica. Information on where to find these files on your system is given in comments at the beginning of the Mathematica-generated TeX input file. The files are arranged in a TeX Directory Standard-compliant tree to make installation of the files as straightforward as possible.

Once the required files are copied to your TeX installation, you may need to refresh your TeX installation's database of filenames so that TeX can find the new package files. Consult your TeX distribution's documentation for specific instructions on doing this. Additionally, you will need to configure your DVI to PostScript driver to find the Type 1 versions of the Math fonts on your system.

Mathematica licensees are permitted to supply copies of the .sty files and the Type 1 versions of the Math fonts to publishers and service bureaus for processing files generated by TeXSave. You can obtain clarification on copyright issues associated with these files by sending e-mail to permissions@wolfram.com.

Principles of Notebook Conversion

Because LaTeX is a markup language, TeXSave separates content from formatting details by treating Mathematica cell styles as abstractions. Little explicit formatting information is retained in the conversion of a plain text cell.

Here is a cell expression that uses the Subsection style.

Cell[TextData["Survey of existing literature"], "Subsection"]

This is the output written to the TeX input file after conversion. The output does not explicitly specify the font choice or how the text should be positioned within the document.

\SubsectionSurvey of existing literature

For cells that contain two-dimensional typeset math expressions, TeXSave generates custom macro names based on the cell's environment, format, and cell style.

Here is a cell expression that uses the Text style and contains aTraditionalForm inline cell.

Cell[TextData[

"The Pythagorean theorem states that ",

Cell[BoxData[

FormBox[

RowBox[

SuperscriptBox["c", "2"], "=", " ",

RowBox[

SuperscriptBox["a",

RowBox["2", " "]], "+", " ",

SuperscriptBox["b", "2"]]], TraditionalForm]]],

"."

], "Text"]

This is what is written to the TeX input file. The macro \inlineTFinmath is one of many macros defined in the LaTeX package files that are provided with Mathematica. The macro \multsp is used to denote a multiplication space.

The Pythagorean theorem states that \inlineTFinmathc^2=\multsp

a^2\multsp +\multsp b^2.

The control over the appearance of the text resides within the macro definitions in the LaTeX2 package file specified in the document's preamble. The default package file, notebook2e.sty, is intended be used with LaTeX2. For backward compatibility with LaTeX 2.09, the older notebook.sty is also provided on the Mathematica distribution medium. Adjustments to appearance should be made by specifying an additional custom package file that contains private macro definitions and modifications.

A large number of cell styles are supported by TeXSave and the .sty files that come with Mathematica. If you use a style sheet that is not part of the Mathematica distribution, you may need to add additional definitions for macros based on the new style names.

Options for Adjusting Output

The output of TeXSave can be adjusted through ConversionOptions, which takes a list of suboptions as its value.

The suboption "TeXVersion" specifies which version of LaTeX the should be used in generating output. The default value is "LaTeX2e". Output that is compatible with LaTeX 2.09 can be obtained by setting the value to "LaTeX2.09". Due to inherent limitations in the font selection mechanism of LaTeX 2.09, the macros in notebook.sty make use of TeX-native Computer Modern fonts to typeset both text and TraditionalForm mathematics. Courier-Bold is still used to represent input and output in InputForm, OutputForm, and StandardForm.

The "DocumentClass" suboption specifies what type of document style LaTeX should use when processing the TeX input file. Typical values for this option are "article" and "report".

Where possible, TeXSave will convert graphics within a notebook to Encapsulated PostScript format. The option "EmbeddedGraphics" specifies where to direct the EPS output. When the option is set to False, each graphic will be written to an individual EPS file with the name filename_grnumber.eps. When this option is set to True, the EPS will be included within the TeX input file. The EPS does not contain a bitmap preview, so the graphic will not be rendered if your TeX preview software does not have a built-in PostScript interpreter. The graphics will be rendered properly when printed with a PostScript printer or displayed on a full-featured PostScript onscreen previewer.

The correspondence between Mathematica cell styles and TeX macros is determined by the settings in the option "MarkupRules". If this option is not set explicitly by the user, TeXSave will use its own built-in conversion rules. The value of this option is a list of items. Possible items include style sheet notebooks, notebook objects, file names specified as strings or as FrontEnd`FileName objects, and concise listings of ConversionRules options. If two conversion rules specify different settings for the same cell style or format type, then the last conversion rule listed will be used.

If a style sheet notebook is specified, the only options extracted from the style definitions are ConversionRules. No other formatting options at the notebook or cell level are processed since it is assumed that details about the appearance of the style will be governed by the macro definition that is associated with the style.

A text conversion rule conveys information about what TeX macro should be used to delimit the converted cell's contents. Its general structure takes the form ConversionRules -> "TeX" -> "opening delimiter", "closing delimiter".

Here is a style definition that contains a conversion rule for a user-defined cell style called Digression, as one might find it in a style sheet notebook.

Cell[StyleData["Digression"],

other cell options, ...

ConversionRules ->

"TeX" -> "\Digression", "\n"



]

Here is a cell expression that uses the Digression style.

Cell[TextData["Functions defined on DoubleStruckCapitalZ"],

"Digression"]

Here is the appearance of the converted cell in the LaTeX input file.

\DigressionFunctions defined on \DoubleStruckCapitalZ

For cell styles associated with typeset mathematics, a distinction must be made as to whether the typeset expression appears in an inline or a freestanding environment. The conversion rules used here have two parts, taking the form ConversionRules -> "TeX" -> inline formatting list, display formatting list. Each formatting list contains the following information opening delimiter, formatting function, closing delimiter. For the cases where TeXSave generates a custom TeX macro, the delimiters specified in the conversion rule are overridden, leaving only the formatting function to have an impact on the output. A typical formatting function used in conversion rules is TeXForm.

Here is a cell style definition that contains a conversion rule for a user-defined style called EmphasizedFormula.

Cell[StyleData["EmphasizedFormula"],

other cell options, ...

ConversionRules ->

"TeX" ->

"\\inlineEmphasizedFormula",

ToString[#, TeXForm]\&,

"\\"

,

"\\displayEmphasizedFormula\\n",

ToString[#, TeXForm]\&,

"\n\\\n"







]

Here is a combination of the prior examples using the "MarkupRules" option hat could be supplied as an argument to TeXSave.

"MarkupRules" -> "Digression" -> "\\Digression", "\n",

"EmphasizedFormula" ->

"\\inlineEmphasizedFormula",

ToString[#, FormatType->TeXForm]&,

"\\"

,

"\\displayEmphasizedFormula\n",

ToString[#, FormatType -> TeXForm]&,

"\n\\\n"



By default, TeXSave uses the built-in function TeXForm to convert typeset math expressions into TeX syntax. If you have set "TeXVersion" to "LaTeX2.09" and desire an appearance that is closer to what you see in a Mathematica notebook, you can change the option "DisplayMathToTeX" from its default value of True to MVFalse. TeXSave will convert each display math formula into an Encapsulated PostScript graphic using a file naming system similar to that of files generated by converting Graphics style cells.

Source Code Availability

Despite the large number of options for adjusting TeXSave output, there may be circumstances where you may need to make changes at a deeper level. Since the bulk of TeXSave is implemented as top-level Mathematica code, we make the source code available in Mathematica package format.

The packages can be downloaded from links at URL: http://www.wolfram.com/support/FrontEnds/Export/TeX/. Routine updates to notebook2e.sty and notebook.sty are available from this site as well.

HTMLSaveStandardForm