From 18c06635988f0e8f8b7be57d229e9da0dd9afa28 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Mon, 11 Dec 2023 21:50:45 +0900 Subject: [PATCH 01/38] Use XeLaTeX by default --- src/sage/misc/latex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/misc/latex.py b/src/sage/misc/latex.py index df469ca8189..809b0d82cf5 100644 --- a/src/sage/misc/latex.py +++ b/src/sage/misc/latex.py @@ -605,7 +605,7 @@ def __init__(self, bb=False, delimiters=["(", ")"], self._option["matrix_column_alignment"] = matrix_column_alignment self._option["macros"] = "" self._option["preamble"] = "" - self._option["engine"] = "pdflatex" + self._option["engine"] = "xelatex" self._option["engine_name"] = "LaTeX" From 1ea88d8c5180a562103750acbd3ce707cdf25f78 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Tue, 12 Dec 2023 08:58:59 +0900 Subject: [PATCH 02/38] Set latex engine to xelatex for building docs --- src/sage_docbuild/conf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sage_docbuild/conf.py b/src/sage_docbuild/conf.py index 8602016d042..1dc23e53d56 100644 --- a/src/sage_docbuild/conf.py +++ b/src/sage_docbuild/conf.py @@ -198,6 +198,9 @@ def sphinx_plot(graphics, **kwds): # for a list of supported languages. #language = None +# The LaTeX engine to build the docs. +latex_engine = 'xelatex' + # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' From 68adb858d384afbaf29731f679e9c333285d6978 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Tue, 12 Dec 2023 14:20:14 +0900 Subject: [PATCH 03/38] Use uplatex for Japanese --- src/doc/ja/a_tour_of_sage/conf.py | 4 ++++ src/sage/misc/latex.py | 6 +++--- src/sage_docbuild/conf.py | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/doc/ja/a_tour_of_sage/conf.py b/src/doc/ja/a_tour_of_sage/conf.py index bf1f84bf962..451d7cc5b58 100644 --- a/src/doc/ja/a_tour_of_sage/conf.py +++ b/src/doc/ja/a_tour_of_sage/conf.py @@ -25,6 +25,10 @@ name = 'a_tour_of_sage' language = "ja" +# The LaTeX engine to build the docs in Japanese. +# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-latex_engine +latex_engine = 'uplatex' + # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". html_title = project + " v" + release diff --git a/src/sage/misc/latex.py b/src/sage/misc/latex.py index 809b0d82cf5..907163831b6 100644 --- a/src/sage/misc/latex.py +++ b/src/sage/misc/latex.py @@ -1591,13 +1591,13 @@ def engine(self, e=None): EXAMPLES:: sage: latex.engine() - 'pdflatex' + 'xelatex' sage: latex.engine("latex") sage: latex.engine() 'latex' - sage: latex.engine("xelatex") + sage: latex.engine("pdflatex") sage: latex.engine() - 'xelatex' + 'pdflatex' """ if e is None: return _Latex_prefs._option["engine"] diff --git a/src/sage_docbuild/conf.py b/src/sage_docbuild/conf.py index 1dc23e53d56..d1bcce65e90 100644 --- a/src/sage_docbuild/conf.py +++ b/src/sage_docbuild/conf.py @@ -199,6 +199,7 @@ def sphinx_plot(graphics, **kwds): #language = None # The LaTeX engine to build the docs. +# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-latex_engine latex_engine = 'xelatex' # There are two options for replacing |today|: either, you set today to some From fb8a1ad2637edebfbe86453eb1a127747ff62c10 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Tue, 12 Dec 2023 17:32:50 +0900 Subject: [PATCH 04/38] Use uplatex for Japanese tutorial too --- src/doc/ja/tutorial/conf.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/doc/ja/tutorial/conf.py b/src/doc/ja/tutorial/conf.py index 9521bc91828..e4b79bd7875 100644 --- a/src/doc/ja/tutorial/conf.py +++ b/src/doc/ja/tutorial/conf.py @@ -25,6 +25,10 @@ name = 'tutorial-jp' language = "ja" +# The LaTeX engine to build the docs in Japanese. +# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-latex_engine +latex_engine = 'uplatex' + # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". html_title = project + " v" + release From 708c100b1c6308bcd2ae6bc360c271ddaadbd1bc Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Tue, 12 Dec 2023 17:44:05 +0900 Subject: [PATCH 05/38] Remove unused DeclareUnicodeCharacter commands --- src/doc/fr/tutorial/conf.py | 3 --- src/doc/ru/tutorial/conf.py | 3 --- src/sage_docbuild/conf.py | 4 ++-- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/doc/fr/tutorial/conf.py b/src/doc/fr/tutorial/conf.py index 7208ddada17..f44315072ff 100644 --- a/src/doc/fr/tutorial/conf.py +++ b/src/doc/fr/tutorial/conf.py @@ -39,9 +39,6 @@ 'The Sage Group', 'manual'), ] -# Additional LaTeX stuff for the French version -#latex_elements['preamble'] += '\\DeclareUnicodeCharacter{00A0}{\\nobreakspace}\n' - # the definition of \\at in the standard preamble of the sphinx doc # conflicts with that in babel/french[b] latex_elements['preamble'] += '\\let\\at\\undefined' diff --git a/src/doc/ru/tutorial/conf.py b/src/doc/ru/tutorial/conf.py index 0b7a8c4e3db..cda4d9762ed 100644 --- a/src/doc/ru/tutorial/conf.py +++ b/src/doc/ru/tutorial/conf.py @@ -38,6 +38,3 @@ ('index', 'SageTutorial_ru.tex', 'Sage Tutorial in Russian', 'The Sage Development Team', 'manual'), ] - -# Additional LaTeX stuff if necessary: -#latex_elements['preamble'] += '\\DeclareUnicodeCharacter{00A0}{\\nobreakspace}\n' diff --git a/src/sage_docbuild/conf.py b/src/sage_docbuild/conf.py index d1bcce65e90..cfdfd0d035b 100644 --- a/src/sage_docbuild/conf.py +++ b/src/sage_docbuild/conf.py @@ -506,8 +506,8 @@ def set_intersphinx_mappings(app, config): \usepackage{mathrsfs} \usepackage{iftex} -% Only declare unicode characters when compiling with pdftex; E.g. japanese -% tutorial does not use pdftex +% Only declare Unicode characters when compiling with pdftex; for example, +% Japanese tutorial does not use pdftex. \ifPDFTeX \DeclareUnicodeCharacter{01CE}{\capitalcaron a} \DeclareUnicodeCharacter{0428}{cyrillic Sha} From 77e58826a5bd1d2097659bd24b71cdff323ecb6d Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Tue, 12 Dec 2023 17:50:17 +0900 Subject: [PATCH 06/38] Remove deprecated code --- src/sage/misc/latex.py | 105 ----------------------------------------- 1 file changed, 105 deletions(-) diff --git a/src/sage/misc/latex.py b/src/sage/misc/latex.py index 907163831b6..3bc947f8907 100644 --- a/src/sage/misc/latex.py +++ b/src/sage/misc/latex.py @@ -66,111 +66,6 @@ ''') -@cached_function -def have_latex() -> bool: - """ - Return ``True`` if this computer has the program ``latex``. - - If this computer does not have LaTeX installed, you may obtain it - from http://ctan.org/. - - EXAMPLES:: - - sage: from sage.misc.latex import have_latex - sage: have_latex() # random - True - """ - from .superseded import deprecation - deprecation(32650, 'the function have_latex() is replaced by: ' - 'from sage.features.latex import latex;latex().is_present()') - from sage.features.latex import latex - return latex().is_present() - - -@cached_function -def have_pdflatex() -> bool: - """ - Return ``True`` if this computer has the program ``pdflatex``. - - If this computer does not have pdflatex installed, you may obtain it - from http://ctan.org/. - - EXAMPLES:: - - sage: from sage.misc.latex import have_pdflatex - sage: have_pdflatex() # random - True - """ - from .superseded import deprecation - deprecation(32650, 'the function have_pdflatex() is replaced by: ' - 'from sage.features.latex import pdflatex;pdflatex().is_present()') - from sage.features.latex import pdflatex - return pdflatex().is_present() - - -@cached_function -def have_xelatex() -> bool: - """ - Return ``True`` if this computer has the program ``xelatex``. - - If this computer does not have xelatex installed, you may obtain it - from http://ctan.org/. - - EXAMPLES:: - - sage: from sage.misc.latex import have_xelatex - sage: have_xelatex() # random - True - """ - from .superseded import deprecation - deprecation(32650, 'the function have_xelatex() is replaced by: ' - 'from sage.features.latex import xelatex;xelatex().is_present()') - from sage.features.latex import xelatex - return xelatex().is_present() - - -@cached_function -def have_dvipng() -> bool: - """ - Return ``True`` if this computer has the program ``dvipng``. - - If this computer does not have dvipng installed, you may obtain it - from http://sourceforge.net/projects/dvipng/ - - EXAMPLES:: - - sage: from sage.misc.latex import have_dvipng - sage: have_dvipng() # random - True - """ - from .superseded import deprecation - deprecation(32650, 'the function have_dvipng() is replaced by: ' - 'from sage.features.dvipng import dvipng;dvipng().is_present()') - from sage.features.dvipng import dvipng - return dvipng().is_present() - -@cached_function -def have_convert() -> bool: - """ - Return ``True`` if this computer has the program ``convert``. - - If this computer does not have convert installed, you may obtain it - (along with the rest of the ImageMagick suite) from - http://www.imagemagick.org - - EXAMPLES:: - - sage: from sage.misc.latex import have_convert - sage: have_convert() # random - True - """ - from .superseded import deprecation - deprecation(32650, 'the function have_convert() is replaced by: ' - 'from sage.features.imagemagick import imagemagick;imagemagick().is_present()') - from sage.features.imagemagick import ImageMagick - return ImageMagick().is_present() - - def list_function(x): r""" Returns the LaTeX code for a list ``x``. From 8a966dd5c6449f435360be79399d741702432592 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Tue, 12 Dec 2023 18:26:28 +0900 Subject: [PATCH 07/38] Add support for lualatex and make xelatex as the default engine for latexing pdf --- src/sage/misc/latex.py | 136 +++++++++++++++++++---------------------- 1 file changed, 64 insertions(+), 72 deletions(-) diff --git a/src/sage/misc/latex.py b/src/sage/misc/latex.py index 3bc947f8907..d114f962e2d 100644 --- a/src/sage/misc/latex.py +++ b/src/sage/misc/latex.py @@ -500,7 +500,7 @@ def __init__(self, bb=False, delimiters=["(", ")"], self._option["matrix_column_alignment"] = matrix_column_alignment self._option["macros"] = "" self._option["preamble"] = "" - self._option["engine"] = "xelatex" + self._option["engine"] = "xelatex" # lualatex is an alternative self._option["engine_name"] = "LaTeX" @@ -559,11 +559,11 @@ def latex_extra_preamble(): def _run_latex_(filename, debug=False, density=150, engine=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files - "filename.dvi" (or "filename.pdf"` if engine is either ``pdflatex`` - or ``xelatex``) and if ``png`` is ``True``, "filename.png". If ``png`` - is ``True`` and dvipng cannot convert the dvi file to png (because of - postscript specials or other issues), then dvips is called, and the - PS file is converted to a png file. + "filename.dvi" (or "filename.pdf"` if engine is either ``pdflatex``, + ``xelatex``, or ``lualatex``) and if ``png`` is ``True``, "filename.png". + If ``png`` is ``True`` and dvipng cannot convert the dvi file to png + (because of postscript specials or other issues), then dvips is called, and + the PS file is converted to a png file. INPUT: @@ -585,23 +585,22 @@ def _run_latex_(filename, debug=False, density=150, engine=None, png=False, do_i OUTPUT: - A string which could be a string starting with 'Error' (if - there was a problem), or it could be 'pdf' or 'dvi'. If - engine is latex or ``None``, then a dvi file is created, but if there - appear to be problems with it (because of PS special commands, for - example), then a pdf file is created instead. The function - returns 'dvi' or 'pdf' to indicate which type of file is created. - (Detecting problems requires that dvipng be installed; if it is - not, then the dvi file is not checked for problems and 'dvi' is - returned.) If engine is pdflatex or xelatex and there are no errors, then - 'pdf' is returned. + A string which could be a string starting with 'Error' (if there was a + problem), or it could be 'pdf' or 'dvi'. If engine is latex or ``None``, + then a dvi file is created, but if there appear to be problems with it + (because of PS special commands, for example), then a pdf file is created + instead. The function returns 'dvi' or 'pdf' to indicate which type of + file is created. (Detecting problems requires that dvipng be installed; if + it is not, then the dvi file is not checked for problems and 'dvi' is + returned.) If engine is pdflatex, xelatex or lualatex and there are no + errors, then 'pdf' is returned. .. WARNING:: If ``png`` is ``True``, then when using latex (the default), you must have 'dvipng' (or 'dvips' and 'convert') installed on your operating system, or this command will not work. When using - pdflatex or xelatex, you must have 'convert' installed. + pdflatex, xelatex or lualatex, you must have 'convert' installed. EXAMPLES:: @@ -635,6 +634,12 @@ def _run_latex_(filename, debug=False, density=150, engine=None, png=False, do_i command = "xelatex" suffix = "pdf" return_suffix = "pdf" + elif engine == "lualatex": + from sage.features.latex import lualatex + lualatex().require() + command = "lualatex" + suffix = "pdf" + return_suffix = "pdf" else: raise ValueError("Unsupported LaTeX engine.") @@ -653,10 +658,8 @@ def _run_latex_(filename, debug=False, density=150, engine=None, png=False, do_i print("Go to http://sourceforge.net/projects/dvipng/ and") print("http://www.imagemagick.org to download these programs.") return "Error" - # if png output + pdflatex, check to see if convert is installed. - elif engine == "pdflatex": - ImageMagick().require() - elif engine == "xelatex": + # if png output + [pdf|xe|lua]latex, check to see if convert is installed. + elif engine in ["pdflatex", "xelatex", "lualatex"]: ImageMagick().require() # check_validity: check to see if the dvi file is okay by trying # to convert to a png file. if this fails, return_suffix will be @@ -709,7 +712,7 @@ def _run_latex_(filename, debug=False, density=150, engine=None, png=False, do_i def subpcall(x): return not call(x, stdout=redirect, stderr=redirect, cwd=base) - if engine == "pdflatex" or engine == "xelatex": + if engine in ['pdflatex', 'xelatex', 'lualatex']: if debug: print(lt) if png: @@ -750,9 +753,9 @@ def subpcall(x): e = subpcall(dvips) and subpcall(ps2pdf) if not e: # error running dvips and/or ps2pdf pdflt = lt[:] - pdflt[1] = 'pdflatex' + pdflt[1] = 'xelatex' if debug: - print("error running dvips and ps2pdf; trying pdflatex instead...") + print("error running dvips and ps2pdf; trying xelatex instead...") print(pdflt) e = subpcall(pdflt) else: # do not have dvipng, so must have convert. run latex, dvips, convert. @@ -876,7 +879,7 @@ class Latex(LatexCall): sage: LatexExpr(r"y \neq") + latex(x^20 + 1) # needs sage.symbolic y \neq x^{20} + 1 """ - def __init__(self, debug=False, slide=False, density=150, pdflatex=None, engine=None): + def __init__(self, debug=False, slide=False, density=150, engine=None): """ Initialize the latex builder. @@ -888,7 +891,6 @@ def __init__(self, debug=False, slide=False, density=150, pdflatex=None, engine= """ self.__debug = debug self.__slide = slide - self.__pdflatex = pdflatex self.__engine = engine self.__density = density @@ -941,7 +943,7 @@ def _latex_preparse(self, s, locals): s = s[:i] + k + t[j + 1:] def eval(self, x, globals, strip=False, filename=None, debug=None, - density=None, pdflatex=None, engine=None, locals={}): + density=None, engine=None, locals={}): r""" Compile the formatted tex given by ``x`` as a png and writes the output file to the directory given by ``filename``. @@ -961,21 +963,18 @@ def eval(self, x, globals, strip=False, filename=None, debug=None, - ``density`` -- how big output image is. - - ``pdflatex`` -- whether to use pdflatex. This is deprecated. Use - ``engine`` option instead. - - - ``engine`` -- latex engine to use. Currently latex, pdflatex, and - xelatex are supported. + - ``engine`` -- latex engine to use. Currently latex, pdflatex, xelatex and + lualatex are supported. - ``locals`` - extra local variables used when evaluating Sage code in ``x``. .. WARNING:: - When using latex (the default), you must have 'dvipng' (or - 'dvips' and 'convert') installed on your operating system, - or this command will not work. When using pdflatex or xelatex, you - must have 'convert' installed. + When using latex (the default), you must have 'dvipng' (or 'dvips' + and 'convert') installed on your operating system, or this command + will not work. When using pdflatex, xelatex or lualatex, you must + have 'convert' installed. OUTPUT: @@ -1471,7 +1470,7 @@ def engine(self, e=None): INPUT: - - ``e`` -- 'latex', 'pdflatex', 'xelatex' or ``None`` + - ``e`` -- 'latex', 'pdflatex', 'xelatex', 'lualatex' or ``None`` If ``e`` is ``None``, return the current engine. @@ -1506,8 +1505,11 @@ def engine(self, e=None): elif e == "xelatex": _Latex_prefs._option["engine"] = e _Latex_prefs._option["engine_name"] = "XeLaTeX" + elif e == "lualatex": + _Latex_prefs._option["engine"] = e + _Latex_prefs._option["engine_name"] = "LuaLaTeX" else: - raise ValueError("%s is not a supported LaTeX engine. Use latex, pdflatex, or xelatex" % e) + raise ValueError("%s is not a supported LaTeX engine. Use latex, pdflatex, xelatex, or lualatex" % e) # Note: latex used to be a separate function, which by default was # only loaded in command-line mode: in the old notebook, @@ -1652,7 +1654,7 @@ def _latex_file_(objects, title='SAGE', debug=False, def view(objects, title='Sage', debug=False, sep='', tiny=False, - pdflatex=None, engine=None, viewer=None, tightpage=True, margin=None, + engine=None, viewer=None, tightpage=True, margin=None, mode='inline', combine_all=False, **kwds): r"""nodetex Compute a latex representation of each object in objects, compile, @@ -1674,9 +1676,6 @@ def view(objects, title='Sage', debug=False, sep='', tiny=False, - ``tiny`` -- bool (default: ``False``): use tiny font. - - ``pdflatex`` -- bool (default: ``False``): use pdflatex. This is - deprecated. Use ``'engine'`` option instead. - - ``engine`` -- string or ``None`` (default: ``None``). Can take the following values: @@ -1687,6 +1686,8 @@ def view(objects, title='Sage', debug=False, sep='', tiny=False, - ``'xelatex'`` -- compilation does tex -> pdf + - ``'lualatex'`` -- compilation does tex -> pdf + - ``'latex'`` -- compilation first tries tex -> dvi -> png and if an error occurs then tries dvi -> ps -> pdf. This is slower than ``'pdflatex'`` and known to be broken when overfull hbox are detected. @@ -1724,20 +1725,17 @@ def view(objects, title='Sage', debug=False, sep='', tiny=False, adds a horizontal line between objects, and ``sep='\\newpage'`` inserts a page break between objects. - If ``pdflatex`` is ``True``, then the latex engine is set to - pdflatex. - - If the ``engine`` is either ``pdflatex`` or ``xelatex``, it produces - a pdf file. Otherwise, it produces a dvi file, and if the program dvipng is - installed, it checks the dvi file by trying to convert it to a png - file. If this conversion fails, the dvi file probably contains - some postscript special commands or it has other issues which - might make displaying it a problem; in this case, the file is - converted to a pdf file, which is then displayed. + If the ``engine`` is either ``pdflatex``, ``xelatex``, or ``lualatex``, it + produces a pdf file. Otherwise, it produces a dvi file, and if the program + dvipng is installed, it checks the dvi file by trying to convert it to a + png file. If this conversion fails, the dvi file probably contains some + postscript special commands or it has other issues which might make + displaying it a problem; in this case, the file is converted to a pdf file, + which is then displayed. Setting ``viewer`` to ``'pdf'`` forces the use of a separate viewer, even in notebook mode. This also sets the latex engine to be - ``pdflatex`` if the current engine is latex. + ``xelatex`` if the current engine is latex. Setting the option ``tightpage`` to ``True`` (this is the default setting) tells LaTeX to use the package 'preview' with the 'tightpage' option. @@ -1816,8 +1814,8 @@ def view(objects, title='Sage', debug=False, sep='', tiny=False, s = _latex_file_(objects, title=title, sep=sep, tiny=tiny, debug=debug, **latex_options) if engine is None: engine = _Latex_prefs._option["engine"] - if pdflatex or (viewer == "pdf" and engine == "latex"): - engine = "pdflatex" + if viewer == "pdf" and engine == "latex": + engine = "xelatex" # command line or notebook with viewer # We can't automatically delete the temporary file in this case @@ -1865,32 +1863,28 @@ def run_viewer(): def png(x, filename, density=150, debug=False, - do_in_background=False, tiny=False, pdflatex=True, engine='pdflatex'): + do_in_background=False, tiny=False, engine='xelatex'): """ Create a png image representation of ``x`` and save to the given filename. INPUT: - - ``x`` -- object to be displayed - - - ``filename`` -- file in which to save the image + - ``x`` -- object to be displayed - - ``density`` -- integer (default: 150) + - ``filename`` -- file in which to save the image - - ``debug`` -- bool (default: ``False``): print verbose - output + - ``density`` -- integer (default: 150) - - ``do_in_background`` -- bool (default: ``False``): Unused, - kept for backwards compatibility + - ``debug`` -- bool (default: ``False``): print verbose output - - ``tiny`` -- bool (default: ``False``): use 'tiny' font + - ``do_in_background`` -- bool (default: ``False``): Unused, kept for + backwards compatibility - - ``pdflatex`` -- bool (default: ``True``): use pdflatex. This option is - deprecated. Use ``engine`` option instead. See below. + - ``tiny`` -- bool (default: ``False``): use 'tiny' font - - ``engine`` -- (default: ``'pdflatex'``) ``'latex'``, ``'pdflatex'``, - or ``'xelatex'`` + - ``engine`` -- (default: ``'xelatex'``) ``'latex'``, ``'pdflatex'``, + ``'xelatex'`` or ``'lualatex'`` EXAMPLES:: @@ -1899,8 +1893,6 @@ def png(x, filename, density=150, debug=False, sage: with tempfile.NamedTemporaryFile(suffix=".png") as f: # random # optional - imagemagick latex, needs sage.plot ....: png(ZZ[x], f.name) """ - if not pdflatex: - engine = "latex" import sage.plot.all if sage.plot.graphics.is_Graphics(x): x.save(filename) @@ -2362,7 +2354,7 @@ def _repr_(self): make sure that you have the most recent version of the TeX package pstricks installed. Run 'latex.add_to_preamble("\\usepackage{pstricks}")' and try viewing it again. Call 'view' with the option `engine='latex'` --- the default behavior is to use pdflatex, which does not work with +-- the default behavior is to use xelatex, which does not work with pstricks. From the command line, this should pop open a nice window with a picture of forces acting on a mass on a pendulum.""" From cbe2330b4a2beb315edea21e9182acf49dcb220c Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Tue, 12 Dec 2023 23:12:00 +0900 Subject: [PATCH 08/38] Add free_fonts spkg --- build/pkgs/_recommended/dependencies | 2 +- build/pkgs/free_fonts/SPKG.rst | 10 ++++++++++ build/pkgs/free_fonts/distros/alpine.txt | 1 + build/pkgs/free_fonts/distros/arch.txt | 1 + build/pkgs/free_fonts/distros/conda.txt | 1 + build/pkgs/free_fonts/distros/debian.txt | 1 + build/pkgs/free_fonts/distros/fedora.txt | 1 + build/pkgs/free_fonts/distros/freebsd.txt | 1 + build/pkgs/free_fonts/distros/gentoo.txt | 1 + build/pkgs/free_fonts/distros/macports.txt | 1 + build/pkgs/free_fonts/distros/opensuse.txt | 1 + build/pkgs/free_fonts/distros/repology.txt | 1 + build/pkgs/free_fonts/distros/void.txt | 1 + build/pkgs/free_fonts/spkg-configure.m4 | 1 + build/pkgs/free_fonts/type | 1 + 15 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 build/pkgs/free_fonts/SPKG.rst create mode 100644 build/pkgs/free_fonts/distros/alpine.txt create mode 100644 build/pkgs/free_fonts/distros/arch.txt create mode 100644 build/pkgs/free_fonts/distros/conda.txt create mode 100644 build/pkgs/free_fonts/distros/debian.txt create mode 100644 build/pkgs/free_fonts/distros/fedora.txt create mode 100644 build/pkgs/free_fonts/distros/freebsd.txt create mode 100644 build/pkgs/free_fonts/distros/gentoo.txt create mode 100644 build/pkgs/free_fonts/distros/macports.txt create mode 100644 build/pkgs/free_fonts/distros/opensuse.txt create mode 100644 build/pkgs/free_fonts/distros/repology.txt create mode 100644 build/pkgs/free_fonts/distros/void.txt create mode 100644 build/pkgs/free_fonts/spkg-configure.m4 create mode 100644 build/pkgs/free_fonts/type diff --git a/build/pkgs/_recommended/dependencies b/build/pkgs/_recommended/dependencies index f4baa9b1fb2..26ad1209419 100644 --- a/build/pkgs/_recommended/dependencies +++ b/build/pkgs/_recommended/dependencies @@ -1 +1 @@ -pandoc ffmpeg imagemagick texlive git libjpeg +pandoc ffmpeg imagemagick texlive git libjpeg free_fonts diff --git a/build/pkgs/free_fonts/SPKG.rst b/build/pkgs/free_fonts/SPKG.rst new file mode 100644 index 00000000000..45f69e88555 --- /dev/null +++ b/build/pkgs/free_fonts/SPKG.rst @@ -0,0 +1,10 @@ +free fonts +========== + +Description +----------- + +This dummy package represents the free fonts. + +We do not have an SPKG for it. The purpose of this dummy package is to +associate system package lists with it. diff --git a/build/pkgs/free_fonts/distros/alpine.txt b/build/pkgs/free_fonts/distros/alpine.txt new file mode 100644 index 00000000000..756efd2627c --- /dev/null +++ b/build/pkgs/free_fonts/distros/alpine.txt @@ -0,0 +1 @@ +ttf-freefont diff --git a/build/pkgs/free_fonts/distros/arch.txt b/build/pkgs/free_fonts/distros/arch.txt new file mode 100644 index 00000000000..b03a4525c08 --- /dev/null +++ b/build/pkgs/free_fonts/distros/arch.txt @@ -0,0 +1 @@ +gnu-free-fonts diff --git a/build/pkgs/free_fonts/distros/conda.txt b/build/pkgs/free_fonts/distros/conda.txt new file mode 100644 index 00000000000..bdf05c629cf --- /dev/null +++ b/build/pkgs/free_fonts/distros/conda.txt @@ -0,0 +1 @@ +open-fonts diff --git a/build/pkgs/free_fonts/distros/debian.txt b/build/pkgs/free_fonts/distros/debian.txt new file mode 100644 index 00000000000..da059bc8000 --- /dev/null +++ b/build/pkgs/free_fonts/distros/debian.txt @@ -0,0 +1 @@ +fonts-freefont diff --git a/build/pkgs/free_fonts/distros/fedora.txt b/build/pkgs/free_fonts/distros/fedora.txt new file mode 100644 index 00000000000..b03a4525c08 --- /dev/null +++ b/build/pkgs/free_fonts/distros/fedora.txt @@ -0,0 +1 @@ +gnu-free-fonts diff --git a/build/pkgs/free_fonts/distros/freebsd.txt b/build/pkgs/free_fonts/distros/freebsd.txt new file mode 100644 index 00000000000..34b729ae37f --- /dev/null +++ b/build/pkgs/free_fonts/distros/freebsd.txt @@ -0,0 +1 @@ +x11-fonts/freefont-ttf diff --git a/build/pkgs/free_fonts/distros/gentoo.txt b/build/pkgs/free_fonts/distros/gentoo.txt new file mode 100644 index 00000000000..f9711d7a9f2 --- /dev/null +++ b/build/pkgs/free_fonts/distros/gentoo.txt @@ -0,0 +1 @@ +media-fonts/freefont diff --git a/build/pkgs/free_fonts/distros/macports.txt b/build/pkgs/free_fonts/distros/macports.txt new file mode 100644 index 00000000000..d5a8b479117 --- /dev/null +++ b/build/pkgs/free_fonts/distros/macports.txt @@ -0,0 +1 @@ +freefont-ttf diff --git a/build/pkgs/free_fonts/distros/opensuse.txt b/build/pkgs/free_fonts/distros/opensuse.txt new file mode 100644 index 00000000000..b03a4525c08 --- /dev/null +++ b/build/pkgs/free_fonts/distros/opensuse.txt @@ -0,0 +1 @@ +gnu-free-fonts diff --git a/build/pkgs/free_fonts/distros/repology.txt b/build/pkgs/free_fonts/distros/repology.txt new file mode 100644 index 00000000000..0870af23017 --- /dev/null +++ b/build/pkgs/free_fonts/distros/repology.txt @@ -0,0 +1 @@ +gnu-freefont diff --git a/build/pkgs/free_fonts/distros/void.txt b/build/pkgs/free_fonts/distros/void.txt new file mode 100644 index 00000000000..d5a8b479117 --- /dev/null +++ b/build/pkgs/free_fonts/distros/void.txt @@ -0,0 +1 @@ +freefont-ttf diff --git a/build/pkgs/free_fonts/spkg-configure.m4 b/build/pkgs/free_fonts/spkg-configure.m4 new file mode 100644 index 00000000000..cbead113af9 --- /dev/null +++ b/build/pkgs/free_fonts/spkg-configure.m4 @@ -0,0 +1 @@ +sage_spkg_install_free_fonts=yes diff --git a/build/pkgs/free_fonts/type b/build/pkgs/free_fonts/type new file mode 100644 index 00000000000..134d9bc32d5 --- /dev/null +++ b/build/pkgs/free_fonts/type @@ -0,0 +1 @@ +optional From 8de57e08f7d68475cd932da88b472d31041fc7d6 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 13 Dec 2023 06:41:08 +0900 Subject: [PATCH 09/38] Add more description to the spkg --- build/pkgs/free_fonts/SPKG.rst | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/build/pkgs/free_fonts/SPKG.rst b/build/pkgs/free_fonts/SPKG.rst index 45f69e88555..17b37952654 100644 --- a/build/pkgs/free_fonts/SPKG.rst +++ b/build/pkgs/free_fonts/SPKG.rst @@ -1,10 +1,23 @@ -free fonts -========== +free fonts: a free family of scalable outline fonts +=================================================== Description ----------- -This dummy package represents the free fonts. +This dummy package represents the GNU free fonts: a free family of scalable +outline fonts, suitable for general use on computers and for desktop +publishing. It is Unicode-encoded for compatibility with all modern operating +systems. We do not have an SPKG for it. The purpose of this dummy package is to associate system package lists with it. + +License +------- + +GNU General Public License + +Upstream Contact +---------------- + +https://www.gnu.org/software/freefont/ From d41807e3dc06934b945cb282f34480b1e33303a5 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 13 Dec 2023 06:44:25 +0900 Subject: [PATCH 10/38] Fix a typo --- build/pkgs/free_fonts/SPKG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/free_fonts/SPKG.rst b/build/pkgs/free_fonts/SPKG.rst index 17b37952654..822ed412bb8 100644 --- a/build/pkgs/free_fonts/SPKG.rst +++ b/build/pkgs/free_fonts/SPKG.rst @@ -1,4 +1,4 @@ -free fonts: a free family of scalable outline fonts +free_fonts: a free family of scalable outline fonts =================================================== Description From 804648632afaf053e96162e82442e0489d96465f Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 13 Dec 2023 07:17:26 +0900 Subject: [PATCH 11/38] Add version to GPL --- build/pkgs/free_fonts/SPKG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/free_fonts/SPKG.rst b/build/pkgs/free_fonts/SPKG.rst index 822ed412bb8..417954179a7 100644 --- a/build/pkgs/free_fonts/SPKG.rst +++ b/build/pkgs/free_fonts/SPKG.rst @@ -15,7 +15,7 @@ associate system package lists with it. License ------- -GNU General Public License +GNU General Public License GPLv3+ Upstream Contact ---------------- From b397f8a3b536f0b29accdc9719ac50d33a4b8b5b Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 13 Dec 2023 07:21:04 +0900 Subject: [PATCH 12/38] Add free_fonts as dependency to sagemath_doc_pdf --- build/pkgs/sagemath_doc_pdf/dependencies | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/sagemath_doc_pdf/dependencies b/build/pkgs/sagemath_doc_pdf/dependencies index 21eb5295b36..c9d9fe8f061 100644 --- a/build/pkgs/sagemath_doc_pdf/dependencies +++ b/build/pkgs/sagemath_doc_pdf/dependencies @@ -1 +1 @@ -sagemath_doc_html texlive +sagemath_doc_html texlive free_fonts From 1929e0e3002c2126e99d56b2c829540c8b331adb Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 13 Dec 2023 08:04:55 +0900 Subject: [PATCH 13/38] Add proper spkg-configure.m4 --- build/pkgs/free_fonts/spkg-configure.m4 | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/build/pkgs/free_fonts/spkg-configure.m4 b/build/pkgs/free_fonts/spkg-configure.m4 index cbead113af9..38e97ce0a23 100644 --- a/build/pkgs/free_fonts/spkg-configure.m4 +++ b/build/pkgs/free_fonts/spkg-configure.m4 @@ -1 +1,16 @@ -sage_spkg_install_free_fonts=yes +SAGE_SPKG_CONFIGURE([free_fonts], [ + sage_spkg_install_free_fonts=yes + m4_foreach([font], + [FreeSerif.ttf,FreeSerif.otf], + [ + AC_MSG_CHECKING([for font $font]) + AS_IF([kpsewhich $font >& AS_MESSAGE_LOG_FD 2>&1], [ + AC_MSG_RESULT([yes]) + sage_spkg_install_free_fonts=no + break + ], [ + AC_MSG_RESULT([no]) + ]) + ]) +]) + From 45f643f4c8eef14915eb6e8d84f84f102acc1cb6 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 13 Dec 2023 08:31:17 +0900 Subject: [PATCH 14/38] Install free fonts in build pdf workflow --- .github/workflows/doc-build-pdf.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/doc-build-pdf.yml b/.github/workflows/doc-build-pdf.yml index bfa32760934..631443c6e85 100644 --- a/.github/workflows/doc-build-pdf.yml +++ b/.github/workflows/doc-build-pdf.yml @@ -57,7 +57,7 @@ jobs: export PATH="build/bin:$PATH" eval $(sage-print-system-package-command auto update) eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip) - eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive) + eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive fonts-freefont) - name: Add prebuilt tree as a worktree id: worktree From 2d45451225363b3f9d92db79d879e6ab50f4fddf Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 13 Dec 2023 08:33:59 +0900 Subject: [PATCH 15/38] Use spkg name --- .github/workflows/doc-build-pdf.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/doc-build-pdf.yml b/.github/workflows/doc-build-pdf.yml index 631443c6e85..d65557d1368 100644 --- a/.github/workflows/doc-build-pdf.yml +++ b/.github/workflows/doc-build-pdf.yml @@ -57,7 +57,7 @@ jobs: export PATH="build/bin:$PATH" eval $(sage-print-system-package-command auto update) eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip) - eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive fonts-freefont) + eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive free_fonts) - name: Add prebuilt tree as a worktree id: worktree From 7807f427948796ae6a030e122c22dfb3df575467 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 13 Dec 2023 08:56:17 +0900 Subject: [PATCH 16/38] Change debian distro package name --- build/pkgs/free_fonts/distros/debian.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/free_fonts/distros/debian.txt b/build/pkgs/free_fonts/distros/debian.txt index da059bc8000..9dae6737769 100644 --- a/build/pkgs/free_fonts/distros/debian.txt +++ b/build/pkgs/free_fonts/distros/debian.txt @@ -1 +1 @@ -fonts-freefont +fonts-freefont-otf From 4144143cc6077b03875b95799ab8f774e573d83d Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 13 Dec 2023 10:37:38 +0900 Subject: [PATCH 17/38] Install xindy general-purpose index processor for xelatex --- .github/workflows/doc-build-pdf.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/doc-build-pdf.yml b/.github/workflows/doc-build-pdf.yml index d65557d1368..fa40b2fcd7b 100644 --- a/.github/workflows/doc-build-pdf.yml +++ b/.github/workflows/doc-build-pdf.yml @@ -55,8 +55,9 @@ jobs: - name: Update system packages run: | export PATH="build/bin:$PATH" + # Install free fonts and xindy along with texlive to build pdf docs by xelatex eval $(sage-print-system-package-command auto update) - eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip) + eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip xindy) eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive free_fonts) - name: Add prebuilt tree as a worktree From 20bdc440a2e1e8dc069d5ebca894b1d0fe3ff7e9 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 13 Dec 2023 14:51:23 +0900 Subject: [PATCH 18/38] Merge a fix for create-changes-html --- .ci/create-changes-html.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.ci/create-changes-html.sh b/.ci/create-changes-html.sh index 1a6fbeef27b..cce6c45acac 100755 --- a/.ci/create-changes-html.sh +++ b/.ci/create-changes-html.sh @@ -69,12 +69,14 @@ for block in diff_blocks: count = 0 for line in block.splitlines(): if line.startswith('@@ -'): - line_number = int(re.search(r'@@ -(\d+)', line).group(1)) - for i in range(line_number, -1, -1): - if content[i].startswith('<'): - count += 1 - content[i] = f'' + content[i] - break + search_result = re.search(r'@@ -(\d+),(\d+) \+(\d+),(\d+)', line) + if search_result: + line_number = int(search_result.group(3)) + for i in range(line_number - 1, -1, -1): + if content[i].startswith('<'): + count += 1 + content[i] = f'' + content[i] + break with open(file_path, 'w') as file: file.writelines(content) hunks = ' '.join(f'#{i + 1}' for i in range(count)) From 36922f95e5c0d06547f86d7bafc7633a4ccb389c Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 13 Dec 2023 15:47:53 +0900 Subject: [PATCH 19/38] Remove DeclareUnicodeCharacter from conf.py --- src/sage_docbuild/conf.py | 176 -------------------------------------- 1 file changed, 176 deletions(-) diff --git a/src/sage_docbuild/conf.py b/src/sage_docbuild/conf.py index cfdfd0d035b..036ef1568d1 100644 --- a/src/sage_docbuild/conf.py +++ b/src/sage_docbuild/conf.py @@ -506,182 +506,6 @@ def set_intersphinx_mappings(app, config): \usepackage{mathrsfs} \usepackage{iftex} -% Only declare Unicode characters when compiling with pdftex; for example, -% Japanese tutorial does not use pdftex. -\ifPDFTeX - \DeclareUnicodeCharacter{01CE}{\capitalcaron a} - \DeclareUnicodeCharacter{0428}{cyrillic Sha} - \DeclareUnicodeCharacter{250C}{+} - \DeclareUnicodeCharacter{2510}{+} - \DeclareUnicodeCharacter{2514}{+} - \DeclareUnicodeCharacter{2518}{+} - \DeclareUnicodeCharacter{253C}{+} - - \DeclareUnicodeCharacter{03B1}{\ensuremath{\alpha}} - \DeclareUnicodeCharacter{03B2}{\ensuremath{\beta}} - \DeclareUnicodeCharacter{03B3}{\ensuremath{\gamma}} - \DeclareUnicodeCharacter{0393}{\ensuremath{\Gamma}} - \DeclareUnicodeCharacter{03B4}{\ensuremath{\delta}} - \DeclareUnicodeCharacter{0394}{\ensuremath{\Delta}} - \DeclareUnicodeCharacter{03B5}{\ensuremath{\varepsilon}} - \DeclareUnicodeCharacter{03B6}{\ensuremath{\zeta}} - \DeclareUnicodeCharacter{03B7}{\ensuremath{\eta}} - \DeclareUnicodeCharacter{03B8}{\ensuremath{\vartheta}} - \DeclareUnicodeCharacter{0398}{\ensuremath{\Theta}} - \DeclareUnicodeCharacter{03BA}{\ensuremath{\kappa}} - \DeclareUnicodeCharacter{03BB}{\ensuremath{\lambda}} - \DeclareUnicodeCharacter{039B}{\ensuremath{\Lambda}} - \DeclareUnicodeCharacter{00B5}{\ensuremath{\mu}} % micron sign - \DeclareUnicodeCharacter{03BC}{\ensuremath{\mu}} - \DeclareUnicodeCharacter{03BD}{\ensuremath{\nu}} - \DeclareUnicodeCharacter{03BE}{\ensuremath{\xi}} - \DeclareUnicodeCharacter{039E}{\ensuremath{\Xi}} - \DeclareUnicodeCharacter{03B9}{\ensuremath{\iota}} - \DeclareUnicodeCharacter{03C0}{\ensuremath{\pi}} - \DeclareUnicodeCharacter{03A0}{\ensuremath{\Pi}} - \DeclareUnicodeCharacter{03C1}{\ensuremath{\rho}} - \DeclareUnicodeCharacter{03C3}{\ensuremath{\sigma}} - \DeclareUnicodeCharacter{03A3}{\ensuremath{\Sigma}} - \DeclareUnicodeCharacter{03C4}{\ensuremath{\tau}} - \DeclareUnicodeCharacter{03C6}{\ensuremath{\varphi}} - \DeclareUnicodeCharacter{03A6}{\ensuremath{\Phi}} - \DeclareUnicodeCharacter{03C7}{\ensuremath{\chi}} - \DeclareUnicodeCharacter{03C8}{\ensuremath{\psi}} - \DeclareUnicodeCharacter{03A8}{\ensuremath{\Psi}} - \DeclareUnicodeCharacter{03C9}{\ensuremath{\omega}} - \DeclareUnicodeCharacter{03A9}{\ensuremath{\Omega}} - \DeclareUnicodeCharacter{03C5}{\ensuremath{\upsilon}} - \DeclareUnicodeCharacter{03A5}{\ensuremath{\Upsilon}} - \DeclareUnicodeCharacter{2113}{\ell} - - \DeclareUnicodeCharacter{2148}{\ensuremath{\id}} - \DeclareUnicodeCharacter{2202}{\ensuremath{\partial}} - \DeclareUnicodeCharacter{2205}{\ensuremath{\emptyset}} - \DeclareUnicodeCharacter{2208}{\ensuremath{\in}} - \DeclareUnicodeCharacter{2209}{\ensuremath{\notin}} - \DeclareUnicodeCharacter{2211}{\ensuremath{\sum}} - \DeclareUnicodeCharacter{221A}{\ensuremath{\sqrt{}}} - \DeclareUnicodeCharacter{221E}{\ensuremath{\infty}} - \DeclareUnicodeCharacter{2227}{\ensuremath{\wedge}} - \DeclareUnicodeCharacter{2228}{\ensuremath{\vee}} - \DeclareUnicodeCharacter{2229}{\ensuremath{\cap}} - \DeclareUnicodeCharacter{222A}{\ensuremath{\cup}} - \DeclareUnicodeCharacter{222B}{\ensuremath{\int}} - \DeclareUnicodeCharacter{2248}{\ensuremath{\approx}} - \DeclareUnicodeCharacter{2260}{\ensuremath{\neq}} - \DeclareUnicodeCharacter{2264}{\ensuremath{\leq}} - \DeclareUnicodeCharacter{2265}{\ensuremath{\geq}} - \DeclareUnicodeCharacter{2293}{\ensuremath{\sqcap}} - \DeclareUnicodeCharacter{2294}{\ensuremath{\sqcup}} - \DeclareUnicodeCharacter{22C0}{\ensuremath{\bigwedge}} - \DeclareUnicodeCharacter{22C1}{\ensuremath{\bigvee}} - \DeclareUnicodeCharacter{22C2}{\ensuremath{\bigcap}} - \DeclareUnicodeCharacter{22C3}{\ensuremath{\bigcup}} - \DeclareUnicodeCharacter{2323}{\ensuremath{\smile}} % cup product - \DeclareUnicodeCharacter{00B1}{\ensuremath{\pm}} - \DeclareUnicodeCharacter{2A02}{\ensuremath{\bigotimes}} - \DeclareUnicodeCharacter{2295}{\ensuremath{\oplus}} - \DeclareUnicodeCharacter{2297}{\ensuremath{\otimes}} - \DeclareUnicodeCharacter{2A01}{\ensuremath{\oplus}} - \DeclareUnicodeCharacter{00BD}{\ensuremath{\nicefrac{1}{2}}} - \DeclareUnicodeCharacter{00D7}{\ensuremath{\times}} - \DeclareUnicodeCharacter{00B7}{\ensuremath{\cdot}} - \DeclareUnicodeCharacter{230A}{\ensuremath{\lfloor}} - \DeclareUnicodeCharacter{230B}{\ensuremath{\rfloor}} - \DeclareUnicodeCharacter{2308}{\ensuremath{\lceil}} - \DeclareUnicodeCharacter{2309}{\ensuremath{\rceil}} - \DeclareUnicodeCharacter{22C5}{\ensuremath{\cdot}} - \DeclareUnicodeCharacter{2227}{\ensuremath{\wedge}} - \DeclareUnicodeCharacter{22C0}{\ensuremath{\bigwedge}} - \DeclareUnicodeCharacter{2192}{\ensuremath{\to}} - \DeclareUnicodeCharacter{21A6}{\ensuremath{\mapsto}} - \DeclareUnicodeCharacter{2102}{\ensuremath{\mathbb{C}}} - \DeclareUnicodeCharacter{211A}{\ensuremath{\mathbb{Q}}} - \DeclareUnicodeCharacter{211D}{\ensuremath{\mathbb{R}}} - \DeclareUnicodeCharacter{2124}{\ensuremath{\mathbb{Z}}} - \DeclareUnicodeCharacter{2202}{\ensuremath{\partial}} - - \DeclareUnicodeCharacter{2070}{\ensuremath{{}^0}} - \DeclareUnicodeCharacter{00B9}{\ensuremath{{}^1}} - \DeclareUnicodeCharacter{00B2}{\ensuremath{{}^2}} - \DeclareUnicodeCharacter{00B3}{\ensuremath{{}^3}} - \DeclareUnicodeCharacter{2074}{\ensuremath{{}^4}} - \DeclareUnicodeCharacter{2075}{\ensuremath{{}^5}} - \DeclareUnicodeCharacter{2076}{\ensuremath{{}^6}} - \DeclareUnicodeCharacter{2077}{\ensuremath{{}^7}} - \DeclareUnicodeCharacter{2078}{\ensuremath{{}^8}} - \DeclareUnicodeCharacter{2079}{\ensuremath{{}^9}} - \DeclareUnicodeCharacter{207A}{\ensuremath{{}^+}} - \DeclareUnicodeCharacter{207B}{\ensuremath{{}^-}} - \DeclareUnicodeCharacter{141F}{\ensuremath{{}^/}} - \DeclareUnicodeCharacter{2080}{\ensuremath{{}_0}} - \DeclareUnicodeCharacter{2081}{\ensuremath{{}_1}} - \DeclareUnicodeCharacter{2082}{\ensuremath{{}_2}} - \DeclareUnicodeCharacter{2083}{\ensuremath{{}_3}} - \DeclareUnicodeCharacter{2084}{\ensuremath{{}_4}} - \DeclareUnicodeCharacter{2085}{\ensuremath{{}_5}} - \DeclareUnicodeCharacter{2086}{\ensuremath{{}_6}} - \DeclareUnicodeCharacter{2087}{\ensuremath{{}_7}} - \DeclareUnicodeCharacter{2088}{\ensuremath{{}_8}} - \DeclareUnicodeCharacter{2089}{\ensuremath{{}_9}} - \DeclareUnicodeCharacter{208A}{\ensuremath{{}_+}} - \DeclareUnicodeCharacter{208B}{\ensuremath{{}_-}} - \DeclareUnicodeCharacter{1D62}{\ensuremath{{}_i}} - \DeclareUnicodeCharacter{2C7C}{\ensuremath{{}_j}} - - \newcommand{\sageMexSymbol}[1] - {{\fontencoding{OMX}\fontfamily{cmex}\selectfont\raisebox{0.75em}{\symbol{#1}}}} - \DeclareUnicodeCharacter{239B}{\sageMexSymbol{"30}} % parenlefttp - \DeclareUnicodeCharacter{239C}{\sageMexSymbol{"42}} % parenleftex - \DeclareUnicodeCharacter{239D}{\sageMexSymbol{"40}} % parenleftbt - \DeclareUnicodeCharacter{239E}{\sageMexSymbol{"31}} % parenrighttp - \DeclareUnicodeCharacter{239F}{\sageMexSymbol{"43}} % parenrightex - \DeclareUnicodeCharacter{23A0}{\sageMexSymbol{"41}} % parenrightbt - \DeclareUnicodeCharacter{23A1}{\sageMexSymbol{"32}} % bracketlefttp - \DeclareUnicodeCharacter{23A2}{\sageMexSymbol{"36}} % bracketleftex - \DeclareUnicodeCharacter{23A3}{\sageMexSymbol{"34}} % bracketleftbt - \DeclareUnicodeCharacter{23A4}{\sageMexSymbol{"33}} % bracketrighttp - \DeclareUnicodeCharacter{23A5}{\sageMexSymbol{"37}} % bracketrightex - \DeclareUnicodeCharacter{23A6}{\sageMexSymbol{"35}} % bracketrightbt - - \DeclareUnicodeCharacter{23A7}{\sageMexSymbol{"38}} % curly brace left top - \DeclareUnicodeCharacter{23A8}{\sageMexSymbol{"3C}} % curly brace left middle - \DeclareUnicodeCharacter{23A9}{\sageMexSymbol{"3A}} % curly brace left bottom - \DeclareUnicodeCharacter{23AA}{\sageMexSymbol{"3E}} % curly brace extension - \DeclareUnicodeCharacter{23AB}{\sageMexSymbol{"39}} % curly brace right top - \DeclareUnicodeCharacter{23AC}{\sageMexSymbol{"3D}} % curly brace right middle - \DeclareUnicodeCharacter{23AD}{\sageMexSymbol{"3B}} % curly brace right bottom - \DeclareUnicodeCharacter{23B0}{\{} % 2-line curly brace left top half (not in cmex) - \DeclareUnicodeCharacter{23B1}{\}} % 2-line curly brace right top half (not in cmex) - - \DeclareUnicodeCharacter{2320}{\ensuremath{\int}} % top half integral - \DeclareUnicodeCharacter{2321}{\ensuremath{\int}} % bottom half integral - \DeclareUnicodeCharacter{23AE}{\ensuremath{\|}} % integral extenison - - % Box drawings light - \DeclareUnicodeCharacter{2500}{-} % h - \DeclareUnicodeCharacter{2502}{|} % v - \DeclareUnicodeCharacter{250C}{+} % dr - \DeclareUnicodeCharacter{2510}{+} % dl - \DeclareUnicodeCharacter{2514}{+} % ur - \DeclareUnicodeCharacter{2518}{+} % ul - \DeclareUnicodeCharacter{251C}{+} % vr - \DeclareUnicodeCharacter{2524}{+} % vl - \DeclareUnicodeCharacter{252C}{+} % dh - \DeclareUnicodeCharacter{2534}{+} % uh - \DeclareUnicodeCharacter{253C}{+} % vh - \DeclareUnicodeCharacter{2571}{/} % upper right to lower left - \DeclareUnicodeCharacter{2572}{\ensuremath{\setminus}} % upper left to lower right - \DeclareUnicodeCharacter{2573}{X} % diagonal cross - - \DeclareUnicodeCharacter{25CF}{\ensuremath{\bullet}} % medium black circle - \DeclareUnicodeCharacter{26AC}{\ensuremath{\circ}} % medium small white circle - \DeclareUnicodeCharacter{256D}{+} - \DeclareUnicodeCharacter{256E}{+} - \DeclareUnicodeCharacter{256F}{+} - \DeclareUnicodeCharacter{2570}{+} -\fi - \let\textLaTeX\LaTeX \AtBeginDocument{\renewcommand*{\LaTeX}{\hbox{\textLaTeX}}} From 40f7a02e0a3068887f8d0c2236590312ad346acf Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 13 Dec 2023 18:12:58 +0900 Subject: [PATCH 20/38] Some edits --- .github/workflows/doc-build-pdf.yml | 2 +- src/sage/misc/latex.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/doc-build-pdf.yml b/.github/workflows/doc-build-pdf.yml index fa40b2fcd7b..d5de7578a80 100644 --- a/.github/workflows/doc-build-pdf.yml +++ b/.github/workflows/doc-build-pdf.yml @@ -55,7 +55,7 @@ jobs: - name: Update system packages run: | export PATH="build/bin:$PATH" - # Install free fonts and xindy along with texlive to build pdf docs by xelatex + # Install free fonts and xindy along with texlive to build pdf docs by [xe|lua]latex eval $(sage-print-system-package-command auto update) eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip xindy) eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive free_fonts) diff --git a/src/sage/misc/latex.py b/src/sage/misc/latex.py index d114f962e2d..77da176df39 100644 --- a/src/sage/misc/latex.py +++ b/src/sage/misc/latex.py @@ -658,7 +658,7 @@ def _run_latex_(filename, debug=False, density=150, engine=None, png=False, do_i print("Go to http://sourceforge.net/projects/dvipng/ and") print("http://www.imagemagick.org to download these programs.") return "Error" - # if png output + [pdf|xe|lua]latex, check to see if convert is installed. + # if png output + [pdf|xe|lua]latex, check to see if convert is installed. elif engine in ["pdflatex", "xelatex", "lualatex"]: ImageMagick().require() # check_validity: check to see if the dvi file is okay by trying @@ -753,7 +753,7 @@ def subpcall(x): e = subpcall(dvips) and subpcall(ps2pdf) if not e: # error running dvips and/or ps2pdf pdflt = lt[:] - pdflt[1] = 'xelatex' + pdflt[1] = 'xelatex' # or lualatex if debug: print("error running dvips and ps2pdf; trying xelatex instead...") print(pdflt) @@ -1815,7 +1815,7 @@ def view(objects, title='Sage', debug=False, sep='', tiny=False, if engine is None: engine = _Latex_prefs._option["engine"] if viewer == "pdf" and engine == "latex": - engine = "xelatex" + engine = "xelatex" # or lualatex # command line or notebook with viewer # We can't automatically delete the temporary file in this case From d2378f1504e9ce1a493a6a4151691fb758a14cbe Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 13 Dec 2023 19:31:13 +0900 Subject: [PATCH 21/38] More edits --- src/sage/misc/latex.py | 98 +++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/src/sage/misc/latex.py b/src/sage/misc/latex.py index 77da176df39..e02ee5b2054 100644 --- a/src/sage/misc/latex.py +++ b/src/sage/misc/latex.py @@ -500,8 +500,8 @@ def __init__(self, bb=False, delimiters=["(", ")"], self._option["matrix_column_alignment"] = matrix_column_alignment self._option["macros"] = "" self._option["preamble"] = "" - self._option["engine"] = "xelatex" # lualatex is an alternative - self._option["engine_name"] = "LaTeX" + self._option["engine"] = "xelatex" # or lualatex + self._option["engine_name"] = "XeLaTeX" _Latex_prefs = _Latex_prefs_object() @@ -559,25 +559,25 @@ def latex_extra_preamble(): def _run_latex_(filename, debug=False, density=150, engine=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files - "filename.dvi" (or "filename.pdf"` if engine is either ``pdflatex``, - ``xelatex``, or ``lualatex``) and if ``png`` is ``True``, "filename.png". + ``filename.dvi`` (or ``filename.pdf``` if engine is either ``'pdflatex'``, + ``'xelatex'``, or ``'lualatex'``) and if ``png`` is ``True``, ``filename.png``. If ``png`` is ``True`` and dvipng cannot convert the dvi file to png (because of postscript specials or other issues), then dvips is called, and the PS file is converted to a png file. INPUT: - - ``filename`` -- string: file to process, including full path + - ``filename`` -- string; file to process, including full path - - ``debug`` -- bool (optional, default ``False``): whether to print + - ``debug`` -- bool (optional, default ``False``); whether to print verbose debugging output - - ``density`` -- integer (optional, default 150): how big output + - ``density`` -- integer (optional, default 150); how big output image is. - ``engine`` -- string: latex engine to use. - - ``png`` -- bool (optional, default ``False``): whether to produce a + - ``png`` -- bool (optional, default ``False``); whether to produce a png file. - ``do_in_background`` -- bool (optional, default ``False``). Unused, @@ -585,22 +585,22 @@ def _run_latex_(filename, debug=False, density=150, engine=None, png=False, do_i OUTPUT: - A string which could be a string starting with 'Error' (if there was a - problem), or it could be 'pdf' or 'dvi'. If engine is latex or ``None``, + A string which could be a string starting with ``'Error'`` (if there was a + problem), or it could be ``'pdf'`` or ``'dvi'``. If engine is latex or ``None``, then a dvi file is created, but if there appear to be problems with it (because of PS special commands, for example), then a pdf file is created - instead. The function returns 'dvi' or 'pdf' to indicate which type of + instead. The function returns ``'dvi'`` or ``'pdf'`` to indicate which type of file is created. (Detecting problems requires that dvipng be installed; if - it is not, then the dvi file is not checked for problems and 'dvi' is - returned.) If engine is pdflatex, xelatex or lualatex and there are no - errors, then 'pdf' is returned. + it is not, then the dvi file is not checked for problems and ``'dvi'`` is + returned.) If ``engine`` is ``'pdflatex'``, ``'xelatex'`` or + ``'lualatex'`` and there are no errors, then ``'pdf'`` is returned. .. WARNING:: If ``png`` is ``True``, then when using latex (the default), you - must have 'dvipng' (or 'dvips' and 'convert') installed on your + must have ``dvipng`` (or ``dvips`` and ``convert``) installed on your operating system, or this command will not work. When using - pdflatex, xelatex or lualatex, you must have 'convert' installed. + ``pdflatex``, ``xelatex`` or ``lualatex``, you must have ``convert`` installed. EXAMPLES:: @@ -963,7 +963,7 @@ def eval(self, x, globals, strip=False, filename=None, debug=None, - ``density`` -- how big output image is. - - ``engine`` -- latex engine to use. Currently latex, pdflatex, xelatex and + - ``engine`` -- latex engine to use. Currently ``'latex'``, ``'pdflatex'``, ``'xelatex'`` and lualatex are supported. - ``locals`` - extra local variables used when @@ -971,10 +971,10 @@ def eval(self, x, globals, strip=False, filename=None, debug=None, .. WARNING:: - When using latex (the default), you must have 'dvipng' (or 'dvips' - and 'convert') installed on your operating system, or this command - will not work. When using pdflatex, xelatex or lualatex, you must - have 'convert' installed. + When using ``latex`` (the default), you must have ``dvipng`` (or ``dvips`` + and ``convert``) installed on your operating system, or this command + will not work. When using ``pdflatex``, ``xelatex`` or ``lualatex``, you must + have ``convert`` installed. OUTPUT: @@ -1470,7 +1470,7 @@ def engine(self, e=None): INPUT: - - ``e`` -- 'latex', 'pdflatex', 'xelatex', 'lualatex' or ``None`` + - ``e`` -- ``'latex'``, ``'pdflatex'``, ``'xelatex'``, ``'lualatex'`` or ``None`` If ``e`` is ``None``, return the current engine. @@ -1537,22 +1537,22 @@ def _latex_file_(objects, title='SAGE', debug=False, INPUT: - - ``objects`` -- list (or object) + - ``objects`` -- list (or object) - - ``title`` -- string (default: 'Sage'): title for the document + - ``title`` -- string (default: 'Sage'); title for the document - - ``math_left`` -- string (default: '\\['), left delimiter for math mode + - ``math_left`` -- string (default: '\\['), left delimiter for math mode - - ``math_right`` -- string (default: '\\]'), right delimiter for math mode + - ``math_right`` -- string (default: '\\]'), right delimiter for math mode - - ``debug`` -- bool (default: False): print verbose output + - ``debug`` -- bool (default: False); print verbose output - - ``sep`` -- string (default: ''): separator between math objects + - ``sep`` -- string (default: ``''``); separator between math objects - - ``tiny`` -- bool (default: False): use 'tiny' font. + - ``tiny`` -- bool (default: False); use 'tiny' font. - - ``extra_preamble`` -- string (default: ''): extra LaTeX commands, - inserted before "\\begin{document}" + - ``extra_preamble`` -- string (default: ``''``); extra LaTeX commands, + inserted before ``"\\begin{document}"`` This creates a string intended to be a LaTeX file containing the LaTeX representations of objects. It contains the following: @@ -1571,7 +1571,7 @@ def _latex_file_(objects, title='SAGE', debug=False, Then if ``objects`` contains more than one element, for each remaining element: - - the string ``sep``: you can use this, for example, to add + - the string ``sep``; you can use this, for example, to add vertical space between objects with ``sep='\\vspace{15mm}'``, or to add a horizontal line between objects with ``sep='\\hrule'``, or to insert a page break between objects @@ -1579,7 +1579,7 @@ def _latex_file_(objects, title='SAGE', debug=False, - the LaTeX representation of the element - The string ends with '\\end{document}'. + The string ends with ``'\\end{document}'``. EXAMPLES:: @@ -1665,16 +1665,16 @@ def view(objects, title='Sage', debug=False, sep='', tiny=False, - ``objects`` -- list (or object) - - ``title`` -- string (default: ``'Sage'``): title for the + - ``title`` -- string (default: ``'Sage'``); title for the document - - ``debug`` -- bool (default: ``False``): print verbose + - ``debug`` -- bool (default: ``False``); print verbose output - - ``sep`` -- string (default: ''): separator between + - ``sep`` -- string (default: ''); separator between math objects - - ``tiny`` -- bool (default: ``False``): use tiny font. + - ``tiny`` -- bool (default: ``False``); use tiny font. - ``engine`` -- string or ``None`` (default: ``None``). Can take the following values: @@ -1682,21 +1682,21 @@ def view(objects, title='Sage', debug=False, sep='', tiny=False, - ``None`` -- the value defined in the LaTeX global preferences ``latex.engine()`` is used. - - ``'pdflatex'`` -- compilation does tex -> pdf + - ``'pdflatex'`` -- compilation does ``tex`` -> ``pdf`` - - ``'xelatex'`` -- compilation does tex -> pdf + - ``'xelatex'`` -- compilation does ``tex`` -> ``pdf`` - - ``'lualatex'`` -- compilation does tex -> pdf + - ``'lualatex'`` -- compilation does ``tex`` -> ``pdf`` - - ``'latex'`` -- compilation first tries tex -> dvi -> png and if an - error occurs then tries dvi -> ps -> pdf. This is slower than + - ``'latex'`` -- compilation first tries ``tex`` -> ``dvi`` -> ``png`` and if an + error occurs then tries ``dvi`` -> ``ps`` -> ``pdf``. This is slower than ``'pdflatex'`` and known to be broken when overfull hbox are detected. - - ``viewer`` -- string or ``None`` (default: ``None``): specify a viewer + - ``viewer`` -- string or ``None`` (default: ``None``); specify a viewer to use; currently the only options are ``None`` and ``'pdf'``. - - ``tightpage`` -- bool (default: ``True``): use the LaTeX package - 'preview' with the 'tightpage' option. + - ``tightpage`` -- bool (default: ``True``); use the LaTeX package + ``preview`` with the 'tightpage' option. - ``margin`` -- float or ``None`` (default: ``None``): adds a margin of ``margin`` mm; has no affect if the option ``tightpage`` is @@ -1725,7 +1725,7 @@ def view(objects, title='Sage', debug=False, sep='', tiny=False, adds a horizontal line between objects, and ``sep='\\newpage'`` inserts a page break between objects. - If the ``engine`` is either ``pdflatex``, ``xelatex``, or ``lualatex``, it + If the ``engine`` is either ``'pdflatex'``, ``'xelatex'``, or ``'lualatex'``, it produces a pdf file. Otherwise, it produces a dvi file, and if the program dvipng is installed, it checks the dvi file by trying to convert it to a png file. If this conversion fails, the dvi file probably contains some @@ -1963,9 +1963,9 @@ def repr_lincomb(symbols, coeffs): INPUT: - - ``symbols`` -- list of symbols + - ``symbols`` -- list of symbols - - ``coeffs`` -- list of coefficients of the symbols + - ``coeffs`` -- list of coefficients of the symbols OUTPUT: @@ -2147,7 +2147,7 @@ def latex_variable_name(x, is_fname=False): 2. If the variable name is suffixed by a number, we put the number in the subscript. - 3. If the variable name contains an '_' we start the subscript at + 3. If the variable name contains an ``'_'`` we start the subscript at the underscore. Note that #3 trumps rule #2. 4. If a component of the variable is a Greek letter, escape it From 26812402b975b42ec6e98497c668a433d36aae63 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 13 Dec 2023 20:40:52 +0900 Subject: [PATCH 22/38] More edits --- src/sage/misc/latex.py | 73 +++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/src/sage/misc/latex.py b/src/sage/misc/latex.py index e02ee5b2054..9d4a25d58c9 100644 --- a/src/sage/misc/latex.py +++ b/src/sage/misc/latex.py @@ -950,31 +950,30 @@ def eval(self, x, globals, strip=False, filename=None, debug=None, INPUT: - - ``globals`` -- a globals dictionary + - ``globals`` -- a globals dictionary - - ``x`` -- string to evaluate. + - ``x`` -- string to evaluate - - ``strip`` -- ignored + - ``strip`` -- ignored - - ``filename`` -- output filename + - ``filename`` -- output filename - - ``debug`` -- whether to print verbose debugging + - ``debug`` -- whether to print verbose debugging output - - ``density`` -- how big output image is. + - ``density`` -- how big output image is - - ``engine`` -- latex engine to use. Currently ``'latex'``, ``'pdflatex'``, ``'xelatex'`` and - lualatex are supported. + - ``engine`` -- latex engine to use. Currently ``'latex'``, + ``'pdflatex'``, ``'xelatex'`` and ``'lualatex'`` are supported - - ``locals`` - extra local variables used when - evaluating Sage code in ``x``. + - ``locals`` - extra local variables used when evaluating Sage code in ``x`` .. WARNING:: - When using ``latex`` (the default), you must have ``dvipng`` (or ``dvips`` - and ``convert``) installed on your operating system, or this command - will not work. When using ``pdflatex``, ``xelatex`` or ``lualatex``, you must - have ``convert`` installed. + When using ``latex`` (the default), you must have ``dvipng`` (or + ``dvips`` and ``convert``) installed on your operating system, or + this command will not work. When using ``pdflatex``, ``xelatex`` + or ``lualatex``, you must have ``convert`` installed. OUTPUT: @@ -1101,18 +1100,18 @@ def matrix_delimiters(self, left=None, right=None): Good choices for ``left`` and ``right`` are any delimiters which LaTeX understands and knows how to resize; some examples are: - - parentheses: '(', ')' - - brackets: '[', ']' - - braces: '\\{', '\\}' - - vertical lines: '|' - - angle brackets: '\\langle', '\\rangle' + - parentheses: ``'('``, ``')'`` + - brackets: ``'['``, ``']'`` + - braces: ``'\\{'``, ``'\\}'`` + - vertical lines: ``'|'`` + - angle brackets: ``'\\langle'``, ``'\\rangle'`` .. NOTE:: - Putting aside aesthetics, you may combine these in any way - imaginable; for example, you could set ``left`` to be a - right-hand bracket ']' and ``right`` to be a right-hand - brace '\\}', and it will be typeset correctly. + Putting aside aesthetics, you may combine these in any way + imaginable; for example, you could set ``left`` to be a right-hand + bracket ``']'`` and ``right`` to be a right-hand brace ``'\\}'``, + and it will be typeset correctly. EXAMPLES:: @@ -1163,18 +1162,18 @@ def vector_delimiters(self, left=None, right=None): Good choices for ``left`` and ``right`` are any delimiters which LaTeX understands and knows how to resize; some examples are: - - parentheses: '(', ')' - - brackets: '[', ']' - - braces: '\\{', '\\}' - - vertical lines: '|' - - angle brackets: '\\langle', '\\rangle' + - parentheses: ``'('``, ``')'`` + - brackets: ``'['``, ``']'`` + - braces: ``'\\{'``, ``'\\}'`` + - vertical lines: ``'|'`` + - angle brackets: ``'\\langle'``, ``'\\rangle'`` .. NOTE:: - Putting aside aesthetics, you may combine these in any way - imaginable; for example, you could set ``left`` to be a - right-hand bracket ']' and ``right`` to be a right-hand - brace '\\}', and it will be typeset correctly. + Putting aside aesthetics, you may combine these in any way + imaginable; for example, you could set ``left`` to be a right-hand + bracket ``']'`` and ``right`` to be a right-hand brace ``'\\}'``, and it + will be typeset correctly. EXAMPLES:: @@ -1311,7 +1310,7 @@ def check_file(self, file_name, more_info=""): def extra_macros(self, macros=None): r"""nodetex - String containing extra LaTeX macros to use with %latex and %html. + String containing extra LaTeX macros to use with ``%latex`` and ``%html``. INPUT: @@ -1671,7 +1670,7 @@ def view(objects, title='Sage', debug=False, sep='', tiny=False, - ``debug`` -- bool (default: ``False``); print verbose output - - ``sep`` -- string (default: ''); separator between + - ``sep`` -- string (default: ``''``); separator between math objects - ``tiny`` -- bool (default: ``False``); use tiny font. @@ -1876,12 +1875,12 @@ def png(x, filename, density=150, debug=False, - ``density`` -- integer (default: 150) - - ``debug`` -- bool (default: ``False``): print verbose output + - ``debug`` -- bool (default: ``False``); print verbose output - - ``do_in_background`` -- bool (default: ``False``): Unused, kept for + - ``do_in_background`` -- bool (default: ``False``); Unused, kept for backwards compatibility - - ``tiny`` -- bool (default: ``False``): use 'tiny' font + - ``tiny`` -- bool (default: ``False``); use 'tiny' font - ``engine`` -- (default: ``'xelatex'``) ``'latex'``, ``'pdflatex'``, ``'xelatex'`` or ``'lualatex'`` From f1b1d435a0439aa16cac3fa7e6244b7c8f50b284 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Wed, 13 Dec 2023 21:59:16 +0900 Subject: [PATCH 23/38] Still more edits --- src/sage/misc/latex.py | 87 +++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/src/sage/misc/latex.py b/src/sage/misc/latex.py index 9d4a25d58c9..40c53ed9a50 100644 --- a/src/sage/misc/latex.py +++ b/src/sage/misc/latex.py @@ -102,7 +102,7 @@ def tuple_function(x, combine_all=False): - ``x`` -- a tuple - - ``combine_all`` -- boolean (Default: ``False``) If ``combine_all`` is + - ``combine_all`` -- boolean (default: ``False``) If ``combine_all`` is ``True``, then it does not return a tuple and instead returns a string with all the elements separated by a single space. It does not collapse tuples which are inside tuples. @@ -210,11 +210,9 @@ def str_function(x): INPUT: - - ``x`` -- a string. + - ``x`` -- a string - OUTPUT: - - A string + OUTPUT: A string EXAMPLES:: @@ -331,10 +329,10 @@ class LatexExpr(str): Normally, objects of this class are created by a :func:`latex` call. It is also possible to generate :class:`LatexExpr` directly from a string, which must contain valid LaTeX code for typesetting in math mode (without dollar - signs). In the Sage notebook, use - :func:`~sage.repl.rich_output.pretty_print.pretty_print` or the "Typeset" - checkbox to actually see the typeset LaTeX code; alternatively, from - either the command-line or the notebook, use the :func:`view` function. + signs). In the Jupyter notebook, use + :func:`~sage.repl.rich_output.pretty_print.pretty_print` to actually see + the typeset LaTeX code; alternatively, from either the command-line or the + notebook, use the :func:`view` function. INPUT: @@ -958,8 +956,7 @@ def eval(self, x, globals, strip=False, filename=None, debug=None, - ``filename`` -- output filename - - ``debug`` -- whether to print verbose debugging - output + - ``debug`` -- whether to print verbose debugging output - ``density`` -- how big output image is @@ -1044,7 +1041,7 @@ def eval(self, x, globals, strip=False, filename=None, debug=None, def blackboard_bold(self, t=None): r"""nodetex Controls whether Sage uses blackboard bold or ordinary bold - face for typesetting ZZ, RR, etc. + face for typesetting ``ZZ``, ``RR``, etc. INPUT: @@ -1121,12 +1118,12 @@ def matrix_delimiters(self, left=None, right=None): \left(\begin{array}{r} 17 \end{array}\right) - sage: latex.matrix_delimiters("[", "]") + sage: latex.matrix_delimiters('[', ']') sage: latex(a) \left[\begin{array}{r} 17 \end{array}\right] - sage: latex.matrix_delimiters(left="\\{") + sage: latex.matrix_delimiters(left='\\{') sage: latex(a) \left\{\begin{array}{r} 17 @@ -1136,7 +1133,7 @@ def matrix_delimiters(self, left=None, right=None): Restore defaults:: - sage: latex.matrix_delimiters("(", ")") + sage: latex.matrix_delimiters('(', ')') """ if left is None and right is None: return _Latex_prefs._option['matrix_delimiters'] @@ -1181,10 +1178,10 @@ def vector_delimiters(self, left=None, right=None): sage: a = vector(QQ, [1,2,3]) sage: latex(a) \left(1,\,2,\,3\right) - sage: latex.vector_delimiters("[", "]") + sage: latex.vector_delimiters('[', ']') sage: latex(a) \left[1,\,2,\,3\right] - sage: latex.vector_delimiters(right="\\}") + sage: latex.vector_delimiters(right='\\}') sage: latex(a) \left[1,\,2,\,3\right\} sage: latex.vector_delimiters() @@ -1192,7 +1189,7 @@ def vector_delimiters(self, left=None, right=None): Restore defaults:: - sage: latex.vector_delimiters("(", ")") + sage: latex.vector_delimiters('(', ')') """ if left is None and right is None: return _Latex_prefs._option['vector_delimiters'] @@ -1280,7 +1277,7 @@ def check_file(self, file_name, more_info=""): - ``file_name`` -- a string - - ``more_info`` -- a string (default: "") + - ``more_info`` -- a string (default: ``""``) Emit a warning if the local LaTeX installation does not include ``file_name``. The string ``more_info`` is appended @@ -1393,7 +1390,7 @@ def extra_preamble(self, s=None): def add_to_preamble(self, s): r"""nodetex Append to the string ``s`` of extra LaTeX macros, for use with - %latex. + ``%latex``. EXAMPLES:: @@ -1416,7 +1413,7 @@ def add_to_preamble(self, s): sage: latex.extra_preamble() '\\DeclareMathOperator{\\Ext}{Ext}\\usepackage{xypic}' - Now one can put various xypic diagrams into a %latex cell, such as + Now one can put various xypic diagrams into a ``%latex`` cell, such as :: @@ -1662,49 +1659,49 @@ def view(objects, title='Sage', debug=False, sep='', tiny=False, INPUT: - - ``objects`` -- list (or object) + - ``objects`` -- list (or object) - - ``title`` -- string (default: ``'Sage'``); title for the + - ``title`` -- string (default: ``'Sage'``); title for the document - - ``debug`` -- bool (default: ``False``); print verbose + - ``debug`` -- bool (default: ``False``); print verbose output - - ``sep`` -- string (default: ``''``); separator between + - ``sep`` -- string (default: ``''``); separator between math objects - - ``tiny`` -- bool (default: ``False``); use tiny font. + - ``tiny`` -- bool (default: ``False``); use tiny font. - - ``engine`` -- string or ``None`` (default: ``None``). Can take the + - ``engine`` -- string or ``None`` (default: ``None``); can take the following values: - - ``None`` -- the value defined in the LaTeX global preferences - ``latex.engine()`` is used. + - ``None`` -- the value defined in the LaTeX global preferences + ``latex.engine()`` is used. - - ``'pdflatex'`` -- compilation does ``tex`` -> ``pdf`` + - ``'pdflatex'`` -- compilation does ``tex`` -> ``pdf`` - - ``'xelatex'`` -- compilation does ``tex`` -> ``pdf`` + - ``'xelatex'`` -- compilation does ``tex`` -> ``pdf`` - - ``'lualatex'`` -- compilation does ``tex`` -> ``pdf`` + - ``'lualatex'`` -- compilation does ``tex`` -> ``pdf`` - - ``'latex'`` -- compilation first tries ``tex`` -> ``dvi`` -> ``png`` and if an - error occurs then tries ``dvi`` -> ``ps`` -> ``pdf``. This is slower than - ``'pdflatex'`` and known to be broken when overfull hbox are detected. + - ``'latex'`` -- compilation first tries ``tex`` -> ``dvi`` -> ``png`` and if an + error occurs then tries ``dvi`` -> ``ps`` -> ``pdf``. This is slower than + ``'pdflatex'`` and known to be broken when overfull hbox are detected. - - ``viewer`` -- string or ``None`` (default: ``None``); specify a viewer + - ``viewer`` -- string or ``None`` (default: ``None``); specify a viewer to use; currently the only options are ``None`` and ``'pdf'``. - - ``tightpage`` -- bool (default: ``True``); use the LaTeX package + - ``tightpage`` -- bool (default: ``True``); use the LaTeX package ``preview`` with the 'tightpage' option. - - ``margin`` -- float or ``None`` (default: ``None``): adds a margin + - ``margin`` -- float or ``None`` (default: ``None``); adds a margin of ``margin`` mm; has no affect if the option ``tightpage`` is ``False``. - - ``mode`` -- string (default: ``'inline'``): ``'display'`` for + - ``mode`` -- string (default: ``'inline'``); ``'display'`` for displaymath or ``'inline'`` for inline math - - ``combine_all`` -- bool (default: ``False``): If ``combine_all`` is + - ``combine_all`` -- bool (default: ``False``); if ``combine_all`` is ``True`` and the input is a tuple, then it does not return a tuple and instead returns a string with all the elements separated by a single space. @@ -1880,7 +1877,7 @@ def png(x, filename, density=150, debug=False, - ``do_in_background`` -- bool (default: ``False``); Unused, kept for backwards compatibility - - ``tiny`` -- bool (default: ``False``); use 'tiny' font + - ``tiny`` -- bool (default: ``False``); use "tiny" font - ``engine`` -- (default: ``'xelatex'``) ``'latex'``, ``'pdflatex'``, ``'xelatex'`` or ``'lualatex'`` @@ -1966,9 +1963,7 @@ def repr_lincomb(symbols, coeffs): - ``coeffs`` -- list of coefficients of the symbols - OUTPUT: - - A string + OUTPUT: A string EXAMPLES:: @@ -2099,9 +2094,7 @@ def latex_varify(a, is_fname=False): - ``a`` -- string - OUTPUT: - - A string + OUTPUT: A string EXAMPLES:: From 88efa258199cce810a89f60ca748427cf7ed1fa6 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Thu, 14 Dec 2023 05:03:03 +0900 Subject: [PATCH 24/38] Add xindy dummy package --- build/pkgs/free_fonts/spkg-configure.m4 | 2 +- build/pkgs/sagemath_doc_pdf/dependencies | 2 +- build/pkgs/xindy/SPKG.rst | 20 ++++++++++++++++++++ build/pkgs/xindy/distros/debian.txt | 1 + build/pkgs/xindy/distros/macports.txt | 1 + build/pkgs/xindy/distros/opensuse.txt | 1 + build/pkgs/xindy/distros/repology.txt | 1 + build/pkgs/xindy/spkg-configure.m4 | 6 ++++++ build/pkgs/xindy/type | 1 + 9 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 build/pkgs/xindy/SPKG.rst create mode 100644 build/pkgs/xindy/distros/debian.txt create mode 100644 build/pkgs/xindy/distros/macports.txt create mode 100644 build/pkgs/xindy/distros/opensuse.txt create mode 100644 build/pkgs/xindy/distros/repology.txt create mode 100644 build/pkgs/xindy/spkg-configure.m4 create mode 100644 build/pkgs/xindy/type diff --git a/build/pkgs/free_fonts/spkg-configure.m4 b/build/pkgs/free_fonts/spkg-configure.m4 index 38e97ce0a23..47ebb4c1cb8 100644 --- a/build/pkgs/free_fonts/spkg-configure.m4 +++ b/build/pkgs/free_fonts/spkg-configure.m4 @@ -4,7 +4,7 @@ SAGE_SPKG_CONFIGURE([free_fonts], [ [FreeSerif.ttf,FreeSerif.otf], [ AC_MSG_CHECKING([for font $font]) - AS_IF([kpsewhich $font >& AS_MESSAGE_LOG_FD 2>&1], [ + AS_IF([kpsewhich ]font[ >& AS_MESSAGE_LOG_FD 2>&1], [ AC_MSG_RESULT([yes]) sage_spkg_install_free_fonts=no break diff --git a/build/pkgs/sagemath_doc_pdf/dependencies b/build/pkgs/sagemath_doc_pdf/dependencies index c9d9fe8f061..2021464b877 100644 --- a/build/pkgs/sagemath_doc_pdf/dependencies +++ b/build/pkgs/sagemath_doc_pdf/dependencies @@ -1 +1 @@ -sagemath_doc_html texlive free_fonts +sagemath_doc_html texlive free_fonts xindy diff --git a/build/pkgs/xindy/SPKG.rst b/build/pkgs/xindy/SPKG.rst new file mode 100644 index 00000000000..49733639b2f --- /dev/null +++ b/build/pkgs/xindy/SPKG.rst @@ -0,0 +1,20 @@ +xindy: a general-purpose index processor +======================================== + +Description +----------- + +This dummy package represents xindy: xindy was developed after an impasse had been encountered in the attempt to complete internationalisation of makeindex. Xindy can be used to process indexes for documents marked up using (LA)TEX, Nroff family and SGML-based languages. Xindy is highly configurable, both in markup terms and in terms of the collating order of the text being processed. + +We do not have an SPKG for it. The purpose of this dummy package is to +associate system package lists with it. + +License +------- + +GNU General Public License version 2.0 (GPLv2) + +Upstream Contact +---------------- + +http://www.xindy.org/ diff --git a/build/pkgs/xindy/distros/debian.txt b/build/pkgs/xindy/distros/debian.txt new file mode 100644 index 00000000000..aeb5474c700 --- /dev/null +++ b/build/pkgs/xindy/distros/debian.txt @@ -0,0 +1 @@ +xindy diff --git a/build/pkgs/xindy/distros/macports.txt b/build/pkgs/xindy/distros/macports.txt new file mode 100644 index 00000000000..aeb5474c700 --- /dev/null +++ b/build/pkgs/xindy/distros/macports.txt @@ -0,0 +1 @@ +xindy diff --git a/build/pkgs/xindy/distros/opensuse.txt b/build/pkgs/xindy/distros/opensuse.txt new file mode 100644 index 00000000000..aeb5474c700 --- /dev/null +++ b/build/pkgs/xindy/distros/opensuse.txt @@ -0,0 +1 @@ +xindy diff --git a/build/pkgs/xindy/distros/repology.txt b/build/pkgs/xindy/distros/repology.txt new file mode 100644 index 00000000000..aeb5474c700 --- /dev/null +++ b/build/pkgs/xindy/distros/repology.txt @@ -0,0 +1 @@ +xindy diff --git a/build/pkgs/xindy/spkg-configure.m4 b/build/pkgs/xindy/spkg-configure.m4 new file mode 100644 index 00000000000..ad507b3d0b3 --- /dev/null +++ b/build/pkgs/xindy/spkg-configure.m4 @@ -0,0 +1,6 @@ +SAGE_SPKG_CONFIGURE([xindy], [ + sage_spkg_install_xindy=no + AC_PATH_PROG([XINDY], [xindy]) + AS_IF([test -z "$XINDY"], [sage_spkg_install_xindy=yes]) +]) + diff --git a/build/pkgs/xindy/type b/build/pkgs/xindy/type new file mode 100644 index 00000000000..134d9bc32d5 --- /dev/null +++ b/build/pkgs/xindy/type @@ -0,0 +1 @@ +optional From 307cf499a655664e9fa1bda35d137ee7c5d6badd Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Thu, 14 Dec 2023 05:57:30 +0900 Subject: [PATCH 25/38] Fix an error in free_fonts spkg-configure.m4 --- build/pkgs/free_fonts/spkg-configure.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/free_fonts/spkg-configure.m4 b/build/pkgs/free_fonts/spkg-configure.m4 index 47ebb4c1cb8..d6864f5b58c 100644 --- a/build/pkgs/free_fonts/spkg-configure.m4 +++ b/build/pkgs/free_fonts/spkg-configure.m4 @@ -3,7 +3,7 @@ SAGE_SPKG_CONFIGURE([free_fonts], [ m4_foreach([font], [FreeSerif.ttf,FreeSerif.otf], [ - AC_MSG_CHECKING([for font $font]) + AC_MSG_CHECKING([for ]font) AS_IF([kpsewhich ]font[ >& AS_MESSAGE_LOG_FD 2>&1], [ AC_MSG_RESULT([yes]) sage_spkg_install_free_fonts=no From 4529b55e81e9cf0203e22bf07217e7dc76d22d12 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Thu, 14 Dec 2023 09:27:05 +0900 Subject: [PATCH 26/38] Update .github/workflows/doc-build-pdf.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matthias Köppe --- .github/workflows/doc-build-pdf.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/doc-build-pdf.yml b/.github/workflows/doc-build-pdf.yml index d5de7578a80..47ac84b362e 100644 --- a/.github/workflows/doc-build-pdf.yml +++ b/.github/workflows/doc-build-pdf.yml @@ -57,8 +57,8 @@ jobs: export PATH="build/bin:$PATH" # Install free fonts and xindy along with texlive to build pdf docs by [xe|lua]latex eval $(sage-print-system-package-command auto update) - eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip xindy) - eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive free_fonts) + eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip) + eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive free_fonts xindy) - name: Add prebuilt tree as a worktree id: worktree From 035f13466d8be41f53154732501008d4a544103b Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Thu, 14 Dec 2023 23:51:46 +0900 Subject: [PATCH 27/38] Switch again to lualatex --- build/pkgs/_recommended/dependencies | 2 +- src/sage/misc/latex.py | 26 +++++++++++++------------- src/sage_docbuild/conf.py | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/build/pkgs/_recommended/dependencies b/build/pkgs/_recommended/dependencies index 26ad1209419..3497f233fbb 100644 --- a/build/pkgs/_recommended/dependencies +++ b/build/pkgs/_recommended/dependencies @@ -1 +1 @@ -pandoc ffmpeg imagemagick texlive git libjpeg free_fonts +pandoc ffmpeg imagemagick texlive git libjpeg free_fonts xindy diff --git a/src/sage/misc/latex.py b/src/sage/misc/latex.py index 40c53ed9a50..ae2db29d438 100644 --- a/src/sage/misc/latex.py +++ b/src/sage/misc/latex.py @@ -498,8 +498,8 @@ def __init__(self, bb=False, delimiters=["(", ")"], self._option["matrix_column_alignment"] = matrix_column_alignment self._option["macros"] = "" self._option["preamble"] = "" - self._option["engine"] = "xelatex" # or lualatex - self._option["engine_name"] = "XeLaTeX" + self._option["engine"] = "lualatex" + self._option["engine_name"] = "LuaLaTeX" _Latex_prefs = _Latex_prefs_object() @@ -751,9 +751,9 @@ def subpcall(x): e = subpcall(dvips) and subpcall(ps2pdf) if not e: # error running dvips and/or ps2pdf pdflt = lt[:] - pdflt[1] = 'xelatex' # or lualatex + pdflt[1] = 'lualatex' if debug: - print("error running dvips and ps2pdf; trying xelatex instead...") + print("error running dvips and ps2pdf; trying lualatex instead...") print(pdflt) e = subpcall(pdflt) else: # do not have dvipng, so must have convert. run latex, dvips, convert. @@ -1481,7 +1481,7 @@ def engine(self, e=None): EXAMPLES:: sage: latex.engine() - 'xelatex' + 'lualatex' sage: latex.engine("latex") sage: latex.engine() 'latex' @@ -1721,8 +1721,8 @@ def view(objects, title='Sage', debug=False, sep='', tiny=False, adds a horizontal line between objects, and ``sep='\\newpage'`` inserts a page break between objects. - If the ``engine`` is either ``'pdflatex'``, ``'xelatex'``, or ``'lualatex'``, it - produces a pdf file. Otherwise, it produces a dvi file, and if the program + If the ``engine`` is either ``'pdflatex'``, ``'xelatex'``, or ``'lualatex'``, + it produces a pdf file. Otherwise, it produces a dvi file, and if the program dvipng is installed, it checks the dvi file by trying to convert it to a png file. If this conversion fails, the dvi file probably contains some postscript special commands or it has other issues which might make @@ -1731,7 +1731,7 @@ def view(objects, title='Sage', debug=False, sep='', tiny=False, Setting ``viewer`` to ``'pdf'`` forces the use of a separate viewer, even in notebook mode. This also sets the latex engine to be - ``xelatex`` if the current engine is latex. + ``lualatex`` if the current engine is latex. Setting the option ``tightpage`` to ``True`` (this is the default setting) tells LaTeX to use the package 'preview' with the 'tightpage' option. @@ -1811,7 +1811,7 @@ def view(objects, title='Sage', debug=False, sep='', tiny=False, if engine is None: engine = _Latex_prefs._option["engine"] if viewer == "pdf" and engine == "latex": - engine = "xelatex" # or lualatex + engine = "lualatex" # command line or notebook with viewer # We can't automatically delete the temporary file in this case @@ -1859,7 +1859,7 @@ def run_viewer(): def png(x, filename, density=150, debug=False, - do_in_background=False, tiny=False, engine='xelatex'): + do_in_background=False, tiny=False, engine='lualatex'): """ Create a png image representation of ``x`` and save to the given filename. @@ -1877,9 +1877,9 @@ def png(x, filename, density=150, debug=False, - ``do_in_background`` -- bool (default: ``False``); Unused, kept for backwards compatibility - - ``tiny`` -- bool (default: ``False``); use "tiny" font + - ``tiny`` -- bool (default: ``False``); use tiny font - - ``engine`` -- (default: ``'xelatex'``) ``'latex'``, ``'pdflatex'``, + - ``engine`` -- (default: ``'lualatex'``) ``'latex'``, ``'pdflatex'``, ``'xelatex'`` or ``'lualatex'`` EXAMPLES:: @@ -2346,7 +2346,7 @@ def _repr_(self): make sure that you have the most recent version of the TeX package pstricks installed. Run 'latex.add_to_preamble("\\usepackage{pstricks}")' and try viewing it again. Call 'view' with the option `engine='latex'` --- the default behavior is to use xelatex, which does not work with +-- the default behavior is to use lualatex, which does not work with pstricks. From the command line, this should pop open a nice window with a picture of forces acting on a mass on a pendulum.""" diff --git a/src/sage_docbuild/conf.py b/src/sage_docbuild/conf.py index 036ef1568d1..0ab862c7a13 100644 --- a/src/sage_docbuild/conf.py +++ b/src/sage_docbuild/conf.py @@ -200,7 +200,7 @@ def sphinx_plot(graphics, **kwds): # The LaTeX engine to build the docs. # https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-latex_engine -latex_engine = 'xelatex' +latex_engine = 'lualatex' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: From 9c11301bee0c4accea575b56cda131e31a7a8bc4 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Fri, 15 Dec 2023 03:05:39 +0900 Subject: [PATCH 28/38] Add texlive-luatex --- .github/workflows/doc-build-pdf.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/doc-build-pdf.yml b/.github/workflows/doc-build-pdf.yml index 47ac84b362e..b3028cbb49a 100644 --- a/.github/workflows/doc-build-pdf.yml +++ b/.github/workflows/doc-build-pdf.yml @@ -57,7 +57,7 @@ jobs: export PATH="build/bin:$PATH" # Install free fonts and xindy along with texlive to build pdf docs by [xe|lua]latex eval $(sage-print-system-package-command auto update) - eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip) + eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip texlive-luatex) eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive free_fonts xindy) - name: Add prebuilt tree as a worktree From e4c9f7418fb9661350bb699bf11e680a9ce75983 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Fri, 15 Dec 2023 09:29:17 +0900 Subject: [PATCH 29/38] Add texlive_luatex dummy package --- .github/workflows/doc-build-pdf.yml | 4 +-- build/pkgs/sagemath_doc_pdf/dependencies | 2 +- build/pkgs/texlive_luatex/SPKG.rst | 26 +++++++++++++++++++ build/pkgs/texlive_luatex/distros/alpine.txt | 1 + build/pkgs/texlive_luatex/distros/arch.txt | 1 + build/pkgs/texlive_luatex/distros/cygwin.txt | 1 + build/pkgs/texlive_luatex/distros/debian.txt | 1 + build/pkgs/texlive_luatex/distros/fedora.txt | 1 + build/pkgs/texlive_luatex/distros/gentoo.txt | 1 + .../pkgs/texlive_luatex/distros/macports.txt | 1 + .../pkgs/texlive_luatex/distros/opensuse.txt | 1 + .../pkgs/texlive_luatex/distros/repology.txt | 1 + build/pkgs/texlive_luatex/spkg-configure.m4 | 10 +++++++ build/pkgs/texlive_luatex/type | 1 + build/pkgs/xindy/spkg-configure.m4 | 3 +-- 15 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 build/pkgs/texlive_luatex/SPKG.rst create mode 100644 build/pkgs/texlive_luatex/distros/alpine.txt create mode 100644 build/pkgs/texlive_luatex/distros/arch.txt create mode 100644 build/pkgs/texlive_luatex/distros/cygwin.txt create mode 100644 build/pkgs/texlive_luatex/distros/debian.txt create mode 100644 build/pkgs/texlive_luatex/distros/fedora.txt create mode 100644 build/pkgs/texlive_luatex/distros/gentoo.txt create mode 100644 build/pkgs/texlive_luatex/distros/macports.txt create mode 100644 build/pkgs/texlive_luatex/distros/opensuse.txt create mode 100644 build/pkgs/texlive_luatex/distros/repology.txt create mode 100644 build/pkgs/texlive_luatex/spkg-configure.m4 create mode 100644 build/pkgs/texlive_luatex/type diff --git a/.github/workflows/doc-build-pdf.yml b/.github/workflows/doc-build-pdf.yml index b3028cbb49a..5f84fe9a306 100644 --- a/.github/workflows/doc-build-pdf.yml +++ b/.github/workflows/doc-build-pdf.yml @@ -57,8 +57,8 @@ jobs: export PATH="build/bin:$PATH" # Install free fonts and xindy along with texlive to build pdf docs by [xe|lua]latex eval $(sage-print-system-package-command auto update) - eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip texlive-luatex) - eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive free_fonts xindy) + eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip) + eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive texlive_luatex free_fonts xindy) - name: Add prebuilt tree as a worktree id: worktree diff --git a/build/pkgs/sagemath_doc_pdf/dependencies b/build/pkgs/sagemath_doc_pdf/dependencies index 2021464b877..9980c42c10b 100644 --- a/build/pkgs/sagemath_doc_pdf/dependencies +++ b/build/pkgs/sagemath_doc_pdf/dependencies @@ -1 +1 @@ -sagemath_doc_html texlive free_fonts xindy +sagemath_doc_html texlive texlive-luatex free_fonts xindy diff --git a/build/pkgs/texlive_luatex/SPKG.rst b/build/pkgs/texlive_luatex/SPKG.rst new file mode 100644 index 00000000000..42eb4b8edb2 --- /dev/null +++ b/build/pkgs/texlive_luatex/SPKG.rst @@ -0,0 +1,26 @@ +texlive-luatex: LuaTeX packages +=============================== + +Description +----------- + +Packages for LuaTeX, a TeX engine using Lua as an embedded scripting and +extension language, with native support for Unicode, OpenType/TrueType fonts, +and both PDF and DVI output. + +The purpose of this dummy package is to associate system package lists with it. + +License +------- + +GNU General Public License version 2.0 (GPLv2) + +Upstream Contact +---------------- + +https://www.luatex.org/ + +Dependencies +------------ + +texlive diff --git a/build/pkgs/texlive_luatex/distros/alpine.txt b/build/pkgs/texlive_luatex/distros/alpine.txt new file mode 100644 index 00000000000..d2b702df88a --- /dev/null +++ b/build/pkgs/texlive_luatex/distros/alpine.txt @@ -0,0 +1 @@ +texlive-luatex diff --git a/build/pkgs/texlive_luatex/distros/arch.txt b/build/pkgs/texlive_luatex/distros/arch.txt new file mode 100644 index 00000000000..2eec092a978 --- /dev/null +++ b/build/pkgs/texlive_luatex/distros/arch.txt @@ -0,0 +1 @@ +texlive-collection-luatex diff --git a/build/pkgs/texlive_luatex/distros/cygwin.txt b/build/pkgs/texlive_luatex/distros/cygwin.txt new file mode 100644 index 00000000000..ba0ee3a029f --- /dev/null +++ b/build/pkgs/texlive_luatex/distros/cygwin.txt @@ -0,0 +1 @@ +texlive diff --git a/build/pkgs/texlive_luatex/distros/debian.txt b/build/pkgs/texlive_luatex/distros/debian.txt new file mode 100644 index 00000000000..d2b702df88a --- /dev/null +++ b/build/pkgs/texlive_luatex/distros/debian.txt @@ -0,0 +1 @@ +texlive-luatex diff --git a/build/pkgs/texlive_luatex/distros/fedora.txt b/build/pkgs/texlive_luatex/distros/fedora.txt new file mode 100644 index 00000000000..d2b702df88a --- /dev/null +++ b/build/pkgs/texlive_luatex/distros/fedora.txt @@ -0,0 +1 @@ +texlive-luatex diff --git a/build/pkgs/texlive_luatex/distros/gentoo.txt b/build/pkgs/texlive_luatex/distros/gentoo.txt new file mode 100644 index 00000000000..6e651aec020 --- /dev/null +++ b/build/pkgs/texlive_luatex/distros/gentoo.txt @@ -0,0 +1 @@ +dev-texlive/texlive-luatex diff --git a/build/pkgs/texlive_luatex/distros/macports.txt b/build/pkgs/texlive_luatex/distros/macports.txt new file mode 100644 index 00000000000..d2b702df88a --- /dev/null +++ b/build/pkgs/texlive_luatex/distros/macports.txt @@ -0,0 +1 @@ +texlive-luatex diff --git a/build/pkgs/texlive_luatex/distros/opensuse.txt b/build/pkgs/texlive_luatex/distros/opensuse.txt new file mode 100644 index 00000000000..d2b702df88a --- /dev/null +++ b/build/pkgs/texlive_luatex/distros/opensuse.txt @@ -0,0 +1 @@ +texlive-luatex diff --git a/build/pkgs/texlive_luatex/distros/repology.txt b/build/pkgs/texlive_luatex/distros/repology.txt new file mode 100644 index 00000000000..d2b702df88a --- /dev/null +++ b/build/pkgs/texlive_luatex/distros/repology.txt @@ -0,0 +1 @@ +texlive-luatex diff --git a/build/pkgs/texlive_luatex/spkg-configure.m4 b/build/pkgs/texlive_luatex/spkg-configure.m4 new file mode 100644 index 00000000000..6fb53bbc171 --- /dev/null +++ b/build/pkgs/texlive_luatex/spkg-configure.m4 @@ -0,0 +1,10 @@ +SAGE_SPKG_CONFIGURE([texlive_luatex], [ + sage_spkg_install_texlive_luatex=no + AC_MSG_CHECKING([for luaotfload-main.lua]) + AS_IF([kpsewhich luaotfload-main.lua >& AS_MESSAGE_LOG_FD 2>&1], [ + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + sage_spkg_install_texlive_luatex=yes + ]) +]) diff --git a/build/pkgs/texlive_luatex/type b/build/pkgs/texlive_luatex/type new file mode 100644 index 00000000000..134d9bc32d5 --- /dev/null +++ b/build/pkgs/texlive_luatex/type @@ -0,0 +1 @@ +optional diff --git a/build/pkgs/xindy/spkg-configure.m4 b/build/pkgs/xindy/spkg-configure.m4 index ad507b3d0b3..d5d016b430c 100644 --- a/build/pkgs/xindy/spkg-configure.m4 +++ b/build/pkgs/xindy/spkg-configure.m4 @@ -1,6 +1,5 @@ SAGE_SPKG_CONFIGURE([xindy], [ sage_spkg_install_xindy=no AC_PATH_PROG([XINDY], [xindy]) - AS_IF([test -z "$XINDY"], [sage_spkg_install_xindy=yes]) + AS_IF([test -z "$ac_cv_path_XINDY"], [sage_spkg_install_free_fonts=yes]) ]) - From 369d889c3eb9113f9f77dae16456e3fea33438c0 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Fri, 15 Dec 2023 14:16:28 +0900 Subject: [PATCH 30/38] Fix an error in xindy package --- build/pkgs/xindy/spkg-configure.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/xindy/spkg-configure.m4 b/build/pkgs/xindy/spkg-configure.m4 index d5d016b430c..07fbe71efa8 100644 --- a/build/pkgs/xindy/spkg-configure.m4 +++ b/build/pkgs/xindy/spkg-configure.m4 @@ -1,5 +1,5 @@ SAGE_SPKG_CONFIGURE([xindy], [ sage_spkg_install_xindy=no AC_PATH_PROG([XINDY], [xindy]) - AS_IF([test -z "$ac_cv_path_XINDY"], [sage_spkg_install_free_fonts=yes]) + AS_IF([test -z "$XINDY"], [sage_spkg_install_xindy=yes]) ]) From a817fe95c4beef3386f8da479188d6c4fe609fb2 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Fri, 15 Dec 2023 15:25:44 +0900 Subject: [PATCH 31/38] Fix a typo --- build/pkgs/texlive_luatex/SPKG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pkgs/texlive_luatex/SPKG.rst b/build/pkgs/texlive_luatex/SPKG.rst index 42eb4b8edb2..b58e6c5003f 100644 --- a/build/pkgs/texlive_luatex/SPKG.rst +++ b/build/pkgs/texlive_luatex/SPKG.rst @@ -1,4 +1,4 @@ -texlive-luatex: LuaTeX packages +texlive_luatex: LuaTeX packages =============================== Description From a7944ef0612547254855f15c96bb45ae367b46aa Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Fri, 15 Dec 2023 18:04:55 +0900 Subject: [PATCH 32/38] Add optional packages for live doc --- .github/workflows/doc-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml index 0c5200dbe81..9d82909ef5f 100644 --- a/.github/workflows/doc-build.yml +++ b/.github/workflows/doc-build.yml @@ -161,7 +161,7 @@ jobs: export PATH="build/bin:$PATH" eval $(sage-print-system-package-command auto update) eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip) - eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive) + eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive texlive_luatex free_fonts xindy) export SAGE_USE_CDNS=yes export SAGE_LIVE_DOC=yes export SAGE_JUPYTER_SERVER=binder:sagemath/sage-binder-env/dev From 88ddd0a00beb6e33de2de5e739ad5342110658bb Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Sat, 16 Dec 2023 16:53:49 +0900 Subject: [PATCH 33/38] Fixes for reviewer comments --- build/pkgs/_recommended/dependencies | 2 +- build/pkgs/sagemath_doc_pdf/dependencies | 2 +- build/pkgs/texlive_luatex/SPKG.rst | 5 --- build/pkgs/texlive_luatex/dependencies | 1 + src/sage/misc/latex.py | 41 ++++++++++++------------ 5 files changed, 24 insertions(+), 27 deletions(-) create mode 100644 build/pkgs/texlive_luatex/dependencies diff --git a/build/pkgs/_recommended/dependencies b/build/pkgs/_recommended/dependencies index 3497f233fbb..6e36fc6d390 100644 --- a/build/pkgs/_recommended/dependencies +++ b/build/pkgs/_recommended/dependencies @@ -1 +1 @@ -pandoc ffmpeg imagemagick texlive git libjpeg free_fonts xindy +pandoc ffmpeg imagemagick git libjpeg texlive texlive_luatex free_fonts xindy diff --git a/build/pkgs/sagemath_doc_pdf/dependencies b/build/pkgs/sagemath_doc_pdf/dependencies index 9980c42c10b..7e3e7f136d2 100644 --- a/build/pkgs/sagemath_doc_pdf/dependencies +++ b/build/pkgs/sagemath_doc_pdf/dependencies @@ -1 +1 @@ -sagemath_doc_html texlive texlive-luatex free_fonts xindy +sagemath_doc_html texlive texlive_luatex free_fonts xindy diff --git a/build/pkgs/texlive_luatex/SPKG.rst b/build/pkgs/texlive_luatex/SPKG.rst index b58e6c5003f..0bb7f65eb8b 100644 --- a/build/pkgs/texlive_luatex/SPKG.rst +++ b/build/pkgs/texlive_luatex/SPKG.rst @@ -19,8 +19,3 @@ Upstream Contact ---------------- https://www.luatex.org/ - -Dependencies ------------- - -texlive diff --git a/build/pkgs/texlive_luatex/dependencies b/build/pkgs/texlive_luatex/dependencies new file mode 100644 index 00000000000..ba0ee3a029f --- /dev/null +++ b/build/pkgs/texlive_luatex/dependencies @@ -0,0 +1 @@ +texlive diff --git a/src/sage/misc/latex.py b/src/sage/misc/latex.py index ae2db29d438..82fccd1c3bc 100644 --- a/src/sage/misc/latex.py +++ b/src/sage/misc/latex.py @@ -557,10 +557,10 @@ def latex_extra_preamble(): def _run_latex_(filename, debug=False, density=150, engine=None, png=False, do_in_background=False): """ This runs LaTeX on the TeX file "filename.tex". It produces files - ``filename.dvi`` (or ``filename.pdf``` if engine is either ``'pdflatex'``, + ``filename.dvi`` (or ``filename.pdf``` if ``engine`` is either ``'pdflatex'``, ``'xelatex'``, or ``'lualatex'``) and if ``png`` is ``True``, ``filename.png``. - If ``png`` is ``True`` and dvipng cannot convert the dvi file to png - (because of postscript specials or other issues), then dvips is called, and + If ``png`` is ``True`` and ``dvipng`` cannot convert the dvi file to png + (because of postscript specials or other issues), then ``dvips`` is called, and the PS file is converted to a png file. INPUT: @@ -584,14 +584,15 @@ def _run_latex_(filename, debug=False, density=150, engine=None, png=False, do_i OUTPUT: A string which could be a string starting with ``'Error'`` (if there was a - problem), or it could be ``'pdf'`` or ``'dvi'``. If engine is latex or ``None``, - then a dvi file is created, but if there appear to be problems with it - (because of PS special commands, for example), then a pdf file is created - instead. The function returns ``'dvi'`` or ``'pdf'`` to indicate which type of - file is created. (Detecting problems requires that dvipng be installed; if - it is not, then the dvi file is not checked for problems and ``'dvi'`` is - returned.) If ``engine`` is ``'pdflatex'``, ``'xelatex'`` or - ``'lualatex'`` and there are no errors, then ``'pdf'`` is returned. + problem), or it could be ``'pdf'`` or ``'dvi'``. If ``engine`` is + ``'latex'`` or ``None``, then a dvi file is created, but if there appear to + be problems with it (because of PS special commands, for example), then a + pdf file is created instead. The function returns ``'dvi'`` or ``'pdf'`` + to indicate which type of file is created. (Detecting problems requires + that ``dvipng`` be installed; if it is not, then the dvi file is not checked + for problems and ``'dvi'`` is returned.) If ``engine`` is ``'pdflatex'``, + ``'xelatex'`` or ``'lualatex'`` and there are no errors, then ``'pdf'`` is + returned. .. WARNING:: @@ -751,9 +752,9 @@ def subpcall(x): e = subpcall(dvips) and subpcall(ps2pdf) if not e: # error running dvips and/or ps2pdf pdflt = lt[:] - pdflt[1] = 'lualatex' + pdflt[1] = 'pdflatex' if debug: - print("error running dvips and ps2pdf; trying lualatex instead...") + print("error running dvips and ps2pdf; trying pdflatex instead...") print(pdflt) e = subpcall(pdflt) else: # do not have dvipng, so must have convert. run latex, dvips, convert. @@ -967,10 +968,10 @@ def eval(self, x, globals, strip=False, filename=None, debug=None, .. WARNING:: - When using ``latex`` (the default), you must have ``dvipng`` (or + When using ``'latex'`` (the default), you must have ``dvipng`` (or ``dvips`` and ``convert``) installed on your operating system, or - this command will not work. When using ``pdflatex``, ``xelatex`` - or ``lualatex``, you must have ``convert`` installed. + this command will not work. When using ``'pdflatex'``, ``'xelatex'`` + or ``'lualatex'``, you must have ``convert`` installed. OUTPUT: @@ -1686,7 +1687,7 @@ def view(objects, title='Sage', debug=False, sep='', tiny=False, - ``'latex'`` -- compilation first tries ``tex`` -> ``dvi`` -> ``png`` and if an error occurs then tries ``dvi`` -> ``ps`` -> ``pdf``. This is slower than - ``'pdflatex'`` and known to be broken when overfull hbox are detected. + ``'pdflatex'`` and known to be broken when overfull hboxes are detected. - ``viewer`` -- string or ``None`` (default: ``None``); specify a viewer to use; currently the only options are ``None`` and ``'pdf'``. @@ -1723,7 +1724,7 @@ def view(objects, title='Sage', debug=False, sep='', tiny=False, If the ``engine`` is either ``'pdflatex'``, ``'xelatex'``, or ``'lualatex'``, it produces a pdf file. Otherwise, it produces a dvi file, and if the program - dvipng is installed, it checks the dvi file by trying to convert it to a + ``dvipng`` is installed, it checks the dvi file by trying to convert it to a png file. If this conversion fails, the dvi file probably contains some postscript special commands or it has other issues which might make displaying it a problem; in this case, the file is converted to a pdf file, @@ -1731,7 +1732,7 @@ def view(objects, title='Sage', debug=False, sep='', tiny=False, Setting ``viewer`` to ``'pdf'`` forces the use of a separate viewer, even in notebook mode. This also sets the latex engine to be - ``lualatex`` if the current engine is latex. + ``pdflatex`` if the current engine is ``latex``. Setting the option ``tightpage`` to ``True`` (this is the default setting) tells LaTeX to use the package 'preview' with the 'tightpage' option. @@ -1811,7 +1812,7 @@ def view(objects, title='Sage', debug=False, sep='', tiny=False, if engine is None: engine = _Latex_prefs._option["engine"] if viewer == "pdf" and engine == "latex": - engine = "lualatex" + engine = "pdflatex" # command line or notebook with viewer # We can't automatically delete the temporary file in this case From f1c31fc32b5138693b14bc4b7fb37fb08f59022b Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Sat, 16 Dec 2023 20:34:53 +0900 Subject: [PATCH 34/38] Implement fallback mechanism of default latex engine --- src/sage/misc/latex.py | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/sage/misc/latex.py b/src/sage/misc/latex.py index 82fccd1c3bc..b9946e120e3 100644 --- a/src/sage/misc/latex.py +++ b/src/sage/misc/latex.py @@ -35,8 +35,6 @@ from sage.misc.cachefunc import cached_function, cached_method from sage.structure.sage_object import SageObject -from sage.misc.lazy_import import lazy_import -lazy_import('sage.misc.html', ('MathJax', 'MathJaxExpr'), deprecation=31536) COMMON_HEADER = r'''\usepackage{amsmath} \usepackage{amssymb} @@ -476,6 +474,30 @@ def has_latex_attr(x) -> bool: return hasattr(x, '_latex_') and not isinstance(x, type) +@cached_function +def default_engine(): + """ + Return the default latex engine and the official name of the engine. + + This is determined by availability of the popular engines on the user's + system. It is assumed that at least latex is available. + + EXAMPLES:: + + sage: from sage.misc.latex import default_engine + sage: default_engine() # random + ('lualatex', 'LuaLaTeX') + """ + 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' + + class _Latex_prefs_object(SageObject): """ An object that holds LaTeX global preferences. @@ -498,8 +520,8 @@ def __init__(self, bb=False, delimiters=["(", ")"], self._option["matrix_column_alignment"] = matrix_column_alignment self._option["macros"] = "" self._option["preamble"] = "" - self._option["engine"] = "lualatex" - self._option["engine_name"] = "LuaLaTeX" + self._option["engine"] = default_engine()[0] + self._option["engine_name"] = default_engine()[1] _Latex_prefs = _Latex_prefs_object() From fa9463011c5dba21a2908b141de22be61805888e Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Sun, 17 Dec 2023 16:57:44 +0900 Subject: [PATCH 35/38] Default engine is computed lazily --- src/sage/misc/latex.py | 53 ++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/src/sage/misc/latex.py b/src/sage/misc/latex.py index b9946e120e3..cb93ad3f7a9 100644 --- a/src/sage/misc/latex.py +++ b/src/sage/misc/latex.py @@ -33,6 +33,7 @@ from tempfile import TemporaryDirectory from sage.misc.cachefunc import cached_function, cached_method +from sage.misc.lazy_attribute import lazy_attribute from sage.structure.sage_object import SageObject @@ -513,23 +514,38 @@ def __init__(self, bb=False, delimiters=["(", ")"], sage: latex_prefs = _Latex_prefs_object() sage: TestSuite(latex_prefs).run(skip ="_test_pickling") """ - self._option = {} - self._option["blackboard_bold"] = bb - self._option["matrix_delimiters"] = list(delimiters) - self._option["vector_delimiters"] = list(delimiters) - self._option["matrix_column_alignment"] = matrix_column_alignment - self._option["macros"] = "" - self._option["preamble"] = "" - self._option["engine"] = default_engine()[0] - self._option["engine_name"] = default_engine()[1] + self.__option = {} + self.__option["blackboard_bold"] = bb + self.__option["matrix_delimiters"] = list(delimiters) + self.__option["vector_delimiters"] = list(delimiters) + self.__option["matrix_column_alignment"] = matrix_column_alignment + self.__option["macros"] = "" + self.__option["preamble"] = "" + + @lazy_attribute + def _option(self): + """ + This attribute contains the preferences list. + EXAMPLES:: + + sage: from sage.misc.latex import _Latex_prefs_object + sage: _Latex_prefs_object()._option # random + {'blackboard_bold': False, + 'matrix_delimiters': ['(', ')'], + 'vector_delimiters': ['(', ')'], + 'matrix_column_alignment': 'r', + 'macros': '', + 'preamble': '', + 'engine': 'lualatex', + 'engine_name': 'LuaLaTeX'} + """ + self.__option["engine"] = default_engine()[0] + self.__option["engine_name"] = default_engine()[1] + return self.__option -_Latex_prefs = _Latex_prefs_object() -############################################################## -# The Latex class is used to make slides and LaTeX output in -# the Sage Notebook -######################################### +_Latex_prefs = _Latex_prefs_object() def latex_extra_preamble(): @@ -796,6 +812,11 @@ def subpcall(x): return return_suffix +# ------------------------------------------------------- +# The Latex class is used to make slides and LaTeX output +# ------------------------------------------------------- + + class LatexCall: r""" Typeset Sage objects via a ``__call__`` method to this class, @@ -1530,6 +1551,7 @@ def engine(self, e=None): else: raise ValueError("%s is not a supported LaTeX engine. Use latex, pdflatex, xelatex, or lualatex" % e) + # Note: latex used to be a separate function, which by default was # only loaded in command-line mode: in the old notebook, # latex was defined by 'latex = Latex(density=130)'. @@ -1537,13 +1559,10 @@ def engine(self, e=None): # function. This has been changed around so that the contents of the # old latex function are now in Latex.__call__; thus the following # assignment. - - latex = Latex() # Ensure that latex appear in the sphinx doc as a function # so that the link :func:`latex` is correctly set up. latex.__doc__ = Latex.__call__.__doc__ -######################################### def _latex_file_(objects, title='SAGE', debug=False, From fc86ec5e9ffa430dd69d14b50835ffad721a097d Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Sun, 17 Dec 2023 21:35:45 +0900 Subject: [PATCH 36/38] png() uses the default engine --- src/sage/misc/latex.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/sage/misc/latex.py b/src/sage/misc/latex.py index cb93ad3f7a9..b5fe97ff062 100644 --- a/src/sage/misc/latex.py +++ b/src/sage/misc/latex.py @@ -1901,7 +1901,7 @@ def run_viewer(): def png(x, filename, density=150, debug=False, - do_in_background=False, tiny=False, engine='lualatex'): + do_in_background=False, tiny=False, engine=None): """ Create a png image representation of ``x`` and save to the given filename. @@ -1921,14 +1921,15 @@ def png(x, filename, density=150, debug=False, - ``tiny`` -- bool (default: ``False``); use tiny font - - ``engine`` -- (default: ``'lualatex'``) ``'latex'``, ``'pdflatex'``, - ``'xelatex'`` or ``'lualatex'`` + - ``engine`` -- (default: ``None``) ``'latex'``, ``'pdflatex'``, + ``'xelatex'`` or ``'lualatex'`` EXAMPLES:: + sage: # optional - imagemagick latex, needs sage.plot sage: from sage.misc.latex import png sage: import tempfile - sage: with tempfile.NamedTemporaryFile(suffix=".png") as f: # random # optional - imagemagick latex, needs sage.plot + sage: with tempfile.NamedTemporaryFile(suffix=".png") as f: # random ....: png(ZZ[x], f.name) """ import sage.plot.all @@ -1939,6 +1940,8 @@ def png(x, filename, density=150, debug=False, s = _latex_file_([x], math_left='$\\displaystyle', math_right='$', title='', debug=debug, tiny=tiny, extra_preamble='\\textheight=2\\textheight') + if engine is None: + engine = _Latex_prefs._option["engine"] # path name for permanent png output abs_path_to_png = os.path.abspath(filename) # temporary directory to store stuff From 658abc49731ee79bbdcbcce72d773092f3415c90 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Mon, 18 Dec 2023 07:54:24 +0900 Subject: [PATCH 37/38] Current engine is dependent on the user's system --- src/sage/misc/latex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/misc/latex.py b/src/sage/misc/latex.py index b5fe97ff062..25f19e6f329 100644 --- a/src/sage/misc/latex.py +++ b/src/sage/misc/latex.py @@ -1524,7 +1524,7 @@ def engine(self, e=None): EXAMPLES:: - sage: latex.engine() + sage: latex.engine() # random 'lualatex' sage: latex.engine("latex") sage: latex.engine() From 7ab3557043fa6853afdeb43e569b92bc820fef47 Mon Sep 17 00:00:00 2001 From: Kwankyu Lee Date: Tue, 19 Dec 2023 08:51:22 +0900 Subject: [PATCH 38/38] Remove a redundant comment --- .github/workflows/doc-build-pdf.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/doc-build-pdf.yml b/.github/workflows/doc-build-pdf.yml index 5f84fe9a306..7ae675d9e64 100644 --- a/.github/workflows/doc-build-pdf.yml +++ b/.github/workflows/doc-build-pdf.yml @@ -55,7 +55,6 @@ jobs: - name: Update system packages run: | export PATH="build/bin:$PATH" - # Install free fonts and xindy along with texlive to build pdf docs by [xe|lua]latex eval $(sage-print-system-package-command auto update) eval $(sage-print-system-package-command auto --yes --no-install-recommends install zip) eval $(sage-print-system-package-command auto --spkg --yes --no-install-recommends install git texlive texlive_luatex free_fonts xindy)