TeX (.tex)

Background & Context

    • MIME type: application/x-tex
    • TeX typesetting system and programming language.
    • Commonly used for typesetting mathematical and scientific publications and other technical documents.
    • Plain text format.
    • Describes the contents and the layout of multipage documents.
    • Developed since 1977 by Donald Knuth.

Export

  • Export["file.tex",expr] exports arbitrary expressions and Notebook or Cell objects, as well as any box expressions obtained from ToBoxes, to the TeX format.
  • The exported TeX includes markup material that maintains much of the document structure that exists within the Wolfram System.
  • Export always generates complete AMS-LaTeX documents, not merely TeX language fragments.
  • TeXForm can be used to create a TeX version of a typeset expression.
  • Export["file.tex",expr,elem] creates a TeX file by treating expr as specifying element elem.
  • The export format can be explicitly specified with the command Export["file",expr,"TeX"].
  • See the following reference pages for full general information:
  • Import, Exportimport from or export to a file
    CloudImport, CloudExportimport from or export to a cloud object
    ImportString, ExportStringimport from or export to a string
    ImportByteArray, ExportByteArrayimport from or export to a byte array

Notebook Interface

  • In the notebook front end, Save As exports the active notebook as a TeX file.
  • Save Selection As exports the selected part of a notebook to TeX.

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Summary"summary of the file
    "Rules"list of rules for all available elements

Options

  • Advanced Export options:
  • "BoxRules"{}specifies mappings from Wolfram Language box expressions to TeX elements
    "ConversionRules"Automaticspecifies mappings from Wolfram System cell styles to TeX elements
    "DocumentClass""article"what LaTeX document type to use
    "MathOutput""TeX"format to use for typeset expressions
    "UsePackages"Automaticlist of packages to include in \usepackage{}
  • Typical settings for "DocumentClass" include "article", "report", and "letter".
  • Possible values for "MathOutput" are:
  • "EPS"converts typeset expressions to EPS, stored in separate files
    "TeX"formats all typeset expressions to embedded TeX macros

Examples

Basic Examples  (6)

Export an arbitrary expression to TeX:

This converts a Cell expression to TeX:

Specify "ConversionRules" for the translation of a Wolfram System style element to a user-defined TeX macro:

Create a numbered equation using the "ConversionRules" option:

Convert typeset expressions to EPS, stored in separate files:

Use the "BoxRules" option to customize how Wolfram Language boxes are translated to TeX: