gh-36861: Use lualatex for better unicode support
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes #1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->
to support https://github.com/sagemath/sage/pull/36857.
There have been numerous problems due to limited support of unicode in
pdflatex. I see no reason why we should not switch to modern tex engine
lualatex, as suggested in
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-
latex_engine
We set lualatex as the default engine for
- building the sage documentation, in `sage_docbuild/`
- rendering pdf images, in `src/sage/misc/latex.py`
In `src/sage/misc/latex.py`, the default engine is determined by
availability of the engines with the order of preference: lualatex,
xelatex, pdflatex.
Along the way, we
- remove latex-related code deprecated in #32650.
- make lots of cosmetic edits in `src/sage/misc/latex.py`
- add support "lualatex" as an alternative to "[pdf|xe]latex" in
`src/sage/misc/latex.py`
We add optional (dummy) packages `texlive_luatex`, `free_fonts`, `xindy`
as new dependencies of `sagemath_doc_pdf` in addition to `texlive`
optional package. It seems that depending on the version and the
platform, `texlive` may already include the new dependencies. If not,
you need to install the new dependencies (as `_recommended` by the dummy
package)
On Ubuntu, the requirement is fulfilled by
```
sudo apt install texlive texlive-luatex fonts-freefont-otf xindy
```
The built pdf doc is available here: https://deploy-livedoc--
sagemath.netlify.app
To test `view` via lualatex, for example,
```
latex.extra_preamble(r"\usepackage{fontspec}\setmainfont{Arial}\setmonof
ont{Arial}")
view('Εύρηκα')
```
you should build sage on your local platform with this PR. You may need
to install `texlive-full` before testing. It seems that `texlive` (2019)
is not enough even for the `view` via pdftex.
sage-devel thread seeking Unicode testers:
https://groups.google.com/g/sage-devel/c/tG2LK6Jvw0I
<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes #12345". -->
Resolves #18370
<!-- If your change requires a documentation PR, please link it
appropriately. -->
### :memo: Checklist
<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->
- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.
### :hourglass: Dependencies
<!-- List all open PRs that this PR logically depends on
- #12345: short description why this is a dependency
- #34567: ...
-->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
URL: https://github.com/sagemath/sage/pull/36861
Reported by: Kwankyu Lee
Reviewer(s): Dima Pasechnik, Kwankyu Lee, Matthias Köppe