Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting the LaTeX code for a matrix should not try to compile LaTeX #39351

Open
orlitzky opened this issue Jan 19, 2025 · 1 comment
Open

Getting the LaTeX code for a matrix should not try to compile LaTeX #39351

orlitzky opened this issue Jan 19, 2025 · 1 comment

Comments

@orlitzky
Copy link
Contributor

When you create a matrix and call latex() on it, its _latex_() method gets called, and these are its first two lines:

latex = sage.misc.latex.latex
matrix_delimiters = latex.matrix_delimiters()

But the matrix_delimiters() method returns,

_Latex_prefs._option['matrix_delimiters']

and that _option attribute is...

self.__option["engine"] = default_engine()[0]
self.__option["engine_name"] = default_engine()[1]
return self.__option

Finally, the default_engine() is determined by...

from sage.features.latex import pdflatex, xelatex, lualatex
if lualatex().is_present():
    return 'lualatex', 'LuaLaTeX'
if xelatex().is_present():
    return 'xelatex', 'XeLaTeX'
if pdflatex().is_present():
    return 'pdflatex', 'pdfLaTeX'
return 'latex', 'LaTeX'

And those feature tests try to compile some LaTeX, launching a heavy process all just to print \begin{array}\end{array}.

@user202729
Copy link
Contributor

The way to fix this should be to make def _option returns a lazy dict of some sort. Not sure if the change will break something downstream though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants