Features for testing the presence of latex and equivalent programs - Packages and Features

Skip to content
Back to top
View this page
Edit this page

# Features for testing the presence of `latex` and equivalent programs

class sage.features.latex.LaTeX(*args, **kwds)

  Bases: `Executable`

  A `Feature` describing the presence of `latex`.

  EXAMPLES:

  Sage

      sage: from sage.features.latex import latex
      sage: latex().is_present()             # optional - latex
      FeatureTestResult('latex', True)

  Python

      >>> from sage.all import *
      >>> from sage.features.latex import latex
      >>> latex().is_present()             # optional - latex
      FeatureTestResult('latex', True)

  is_functional()

    Return whether `latex` in the path is functional.

    EXAMPLES:

    Sage

        sage: from sage.features.latex import latex
        sage: latex().is_functional()             # optional - latex
        FeatureTestResult('latex', True)

    Python

        >>> from sage.all import *
        >>> from sage.features.latex import latex
        >>> latex().is_functional()             # optional - latex
        FeatureTestResult('latex', True)

    When the feature is not functional, more information on the reason can be obtained as follows:

    Sage

        sage: result = latex().is_functional()    # not tested
        sage: print(result.reason)                # not tested
        Running latex on a sample file
        (with command='latex -interaction=nonstopmode tmp_wmpos8ak.tex')
        returned nonzero exit status='1' with stderr=''
        and stdout='This is pdfTeX,
        ...
        Runaway argument?
        {document
        ! File ended while scanning use of \end.
        ...
        No pages of output.
        Transcript written on tmp_wmpos8ak.log.'

    [Python]

        >>> from sage.all import *
        >>> result = latex().is_functional()    # not tested
        >>> print(result.reason)                # not tested
        Running latex on a sample file
        (with command='latex -interaction=nonstopmode tmp_wmpos8ak.tex')
        returned nonzero exit status='1' with stderr=''
        and stdout='This is pdfTeX,
        ...
        Runaway argument?
        {document
        ! File ended while scanning use of \end.
        ...
        No pages of output.
        Transcript written on tmp_wmpos8ak.log.'

class sage.features.latex.LaTeXPackage(*args, **kwds)

  Bases: `TeXFile`

  A `sage.features.Feature` describing the presence of a LaTeX package (`.sty` file).

  EXAMPLES:

  Sage

      sage: from sage.features.latex import LaTeXPackage
      sage: LaTeXPackage('graphics').is_present()  # optional - latex
      FeatureTestResult('latex_package_graphics', True)

  Python

      >>> from sage.all import *
      >>> from sage.features.latex import LaTeXPackage
      >>> LaTeXPackage('graphics').is_present()  # optional - latex
      FeatureTestResult('latex_package_graphics', True)

class sage.features.latex.TeXFile(*args, **kwds)

  Bases: `StaticFile`

  A `sage.features.Feature` describing the presence of a TeX file.

  EXAMPLES:

  Sage

      sage: from sage.features.latex import TeXFile
      sage: TeXFile('x', 'x.tex').is_present()  # optional - latex
      FeatureTestResult('x', True)

  Python

      >>> from sage.all import *
      >>> from sage.features.latex import TeXFile
      >>> TeXFile('x', 'x.tex').is_present()  # optional - latex
      FeatureTestResult('x', True)

  absolute_filename()

    The absolute path of the file.

    EXAMPLES:

    Sage

        sage: from sage.features.latex import TeXFile
        sage: feature = TeXFile('latex_class_article', 'article.cls')
        sage: feature.absolute_filename()  # optional - latex
        '.../latex/base/article.cls'

    Python

        >>> from sage.all import *
        >>> from sage.features.latex import TeXFile
        >>> feature = TeXFile('latex_class_article', 'article.cls')
        >>> feature.absolute_filename()  # optional - latex
        '.../latex/base/article.cls'

sage.features.latex.all_features()

class sage.features.latex.dvips(*args, **kwds)

  Bases: `Executable`

  A `Feature` describing the presence of `dvips`.

  EXAMPLES:

  Sage

      sage: from sage.features.latex import dvips
      sage: dvips().is_present()             # optional - dvips
      FeatureTestResult('dvips', True)

  Python

      >>> from sage.all import *
      >>> from sage.features.latex import dvips
      >>> dvips().is_present()             # optional - dvips
      FeatureTestResult('dvips', True)

class sage.features.latex.latex(*args, **kwds)

  Bases: `LaTeX`

  A `Feature` describing the presence of `latex`.

  EXAMPLES:

  Sage

      sage: from sage.features.latex import latex
      sage: latex().is_present()             # optional - latex
      FeatureTestResult('latex', True)

  Python

      >>> from sage.all import *
      >>> from sage.features.latex import latex
      >>> latex().is_present()             # optional - latex
      FeatureTestResult('latex', True)

class sage.features.latex.lualatex(*args, **kwds)

  Bases: `LaTeX`

  A `Feature` describing the presence of `lualatex`.

  EXAMPLES:

  Sage

      sage: from sage.features.latex import lualatex
      sage: lualatex().is_present()             # optional - lualatex
      FeatureTestResult('lualatex', True)

  Python

      >>> from sage.all import *
      >>> from sage.features.latex import lualatex
      >>> lualatex().is_present()             # optional - lualatex
      FeatureTestResult('lualatex', True)

class sage.features.latex.pdflatex(*args, **kwds)

  Bases: `LaTeX`

  A `Feature` describing the presence of `pdflatex`.

  EXAMPLES:

  Sage

      sage: from sage.features.latex import pdflatex
      sage: pdflatex().is_present()             # optional - pdflatex
      FeatureTestResult('pdflatex', True)

  Python

      >>> from sage.all import *
      >>> from sage.features.latex import pdflatex
      >>> pdflatex().is_present()             # optional - pdflatex
      FeatureTestResult('pdflatex', True)

class sage.features.latex.xelatex(*args, **kwds)

  Bases: `LaTeX`

  A `Feature` describing the presence of `xelatex`.

  EXAMPLES:

  Sage

      sage: from sage.features.latex import xelatex
      sage: xelatex().is_present()             # optional - xelatex
      FeatureTestResult('xelatex', True)

  Python

      >>> from sage.all import *
      >>> from sage.features.latex import xelatex
      >>> xelatex().is_present()             # optional - xelatex
      FeatureTestResult('xelatex', True)