Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Replace pdflatex to latex
Browse files Browse the repository at this point in the history
  • Loading branch information
kwankyu committed Aug 21, 2022
1 parent a5900ac commit 9e6ca2a
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions src/sage/features/latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self, name):
sage: isinstance(latex(), latex)
True
"""
Executable.__init__(self, name, executable=name, spkg=latex_spkg, url=latex_url)
super().__init__(name, executable=name, spkg=latex_spkg, url=latex_url)

def is_functional(self):
r"""
Expand Down Expand Up @@ -97,7 +97,7 @@ def __init__(self):
sage: isinstance(latex(), latex)
True
"""
LaTeX.__init__(self, "latex")
super().__init__("latex")


class pdflatex(LaTeX):
Expand All @@ -118,7 +118,7 @@ def __init__(self):
sage: isinstance(pdflatex(), pdflatex)
True
"""
LaTeX.__init__(self, "pdflatex")
super().__init__("pdflatex")


class xelatex(LaTeX):
Expand All @@ -139,7 +139,7 @@ def __init__(self):
sage: isinstance(xelatex(), xelatex)
True
"""
LaTeX.__init__(self, "xelatex")
super().__init__("xelatex")


class lualatex(LaTeX):
Expand All @@ -160,7 +160,7 @@ def __init__(self):
sage: isinstance(lualatex(), lualatex)
True
"""
LaTeX.__init__(self, "lualatex")
super().__init__("lualatex")


class TeXFile(StaticFile, JoinFeature):
Expand All @@ -170,20 +170,20 @@ class TeXFile(StaticFile, JoinFeature):
EXAMPLES::
sage: from sage.features.latex import TeXFile
sage: TeXFile('x', 'x.tex').is_present() # optional: pdflatex
sage: TeXFile('x', 'x.tex').is_present() # optional - latex
FeatureTestResult('x', True)
sage: TeXFile('nonexisting', 'xxxxxx-nonexisting-file.tex').is_present() # optional - pdflatex
sage: TeXFile('nonexisting', 'xxxxxx-nonexisting-file.tex').is_present() # optional - latex
FeatureTestResult('nonexisting', False)
"""
def __init__(self, name, filename, **kwds):
r"""
EXAMPLES::
sage: from sage.features.latex import LaTeXPackage, pdflatex
sage: from sage.features.latex import LaTeXPackage
sage: LaTeXPackage("tkz-graph")._features
[Feature('pdflatex')]
[Feature('latex')]
"""
JoinFeature.__init__(self, name, [pdflatex()],
JoinFeature.__init__(self, name, [latex()],
spkg=latex_spkg, url=latex_url) # see :trac:`34282`
StaticFile.__init__(self, name, filename, search_path=[], **kwds)

Expand All @@ -195,7 +195,7 @@ def absolute_filename(self) -> str:
sage: from sage.features.latex import TeXFile
sage: feature = TeXFile('latex_class_article', 'article.cls')
sage: feature.absolute_filename() # optional - pdflatex
sage: feature.absolute_filename() # optional - latex
'.../latex/base/article.cls'
"""
from subprocess import run, CalledProcessError, PIPE
Expand All @@ -214,16 +214,13 @@ def _is_present(self):
EXAMPLES::
sage: from sage.features.latex import LaTeXPackage, pdflatex
sage: from sage.features.latex import LaTeXPackage, latex
sage: f = LaTeXPackage("tkz-graph")
sage: g = pdflatex()
sage: bool(f.is_present()) == bool(g.is_present()) # indirect doctest
sage: g = latex()
sage: not f.is_present() or bool(g.is_present()) # indirect doctest
True
"""
test = JoinFeature._is_present(self)
if not test:
return test
return super(TeXFile, self)._is_present()
return JoinFeature._is_present(self) and StaticFile._is_present(self)


class LaTeXPackage(TeXFile):
Expand All @@ -234,7 +231,7 @@ class LaTeXPackage(TeXFile):
EXAMPLES::
sage: from sage.features.latex import LaTeXPackage
sage: LaTeXPackage('graphics').is_present() # optional - pdflatex
sage: LaTeXPackage('graphics').is_present() # optional - latex
FeatureTestResult('latex_package_graphics', True)
"""
@staticmethod
Expand Down

0 comments on commit 9e6ca2a

Please sign in to comment.