-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
DOC: Fix latexpdf build #18948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOC: Fix latexpdf build #18948
Conversation
This commit reactivates original latex_elements['preamble'] key which was shadowed by the bug about latex_elements being defined twice in the conf.py. It removes from this latex preamble the loading of amsmath, amssymb, amsfonts as this is already added by Sphinx, and of txfonts because this is not compatible with fontspec and the already executed command \setmainfont{DejaVu Serif}. Memo: expdlist package breaks PDF build if a description list ends up in a table cell, as happens actually with Matplotlib.tex file. But, by luck, the enumitem LaTeX package modifications of LaTeX description lists masks the expdlist potential breakage.
But removing enumitem package reveals a bug in expdlist. Import the fix from the SciPy and NumPy projects. numpy/numpy#15028 scipy/scipy@c881fde
XITS has all the Unicode mathematical symbols glyphs needed for the section of the documentation related to Mathtext. (DejaVu Serif was missing 134 of them, and GNU FreeFont 19 of them) XITS Math (and unicode-math) is needed for \mathbb supporting letters b, c, d, there is one \mathbb{blackboard} once in the documentation. It also gives better calligraphy font. The Ubuntu package texlive-fonts-extra provides these latex dependencies.
modified: doc/conf.py
modified: doc/conf.py
This appears unnecessary in mathtext, but LaTeX requires the dimension.
Limit math symbol table columns to number of symbols. In Hebrew, there are only 4 symbols, but the table is 6 columns with two extra empty columns. Fix Delimiters table as pipe and backslash need to be escaped. Replace the `get_n` function with a simpler `range` operation.
When the Glossary existed, they would go in there, but now they are stuck at the end of the Developer Guide. Neither was really correct, so now they are in their own Part.
@@ -94,7 +94,7 @@ | |||
|
|||
.. math:: | |||
|
|||
\frac{3}{4} \binom{3}{4} \genfrac{}{}{0}{}{3}{4} | |||
\frac{3}{4} \binom{3}{4} \genfrac{}{}{0pt}{}{3}{4} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This dimension appears to be required by LaTeX, but not our parser. I couldn't find anything in the parser that could require it, (if we wanted to do that)?
cc @anntzer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, \genfrac
behaves differently between mathtext and TeX: TeX wants (quite reasonably) a unit whereas we have not implemented support for it. I don't actually know what's the unit we implicitly use?
I guess adding support for units there is not "too" hard (mostly just figuring out the right multiplier); but in the meantime I guess you could just exclude that from the pdf build using .. only::
or .. ifconfig::
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well this is in .. math::
; according to the build here, it works fine with the unit in regular HTML builds, too. It's just inconsistent with the Matplotlib version in the plain text source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you should mostly just open an issue for supporting {0pt}
on our side? (which seems like a reasonable request) Or did I miss something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, as it seems I didn't miss anything, #19001.
This is failing for me on arch with
I do have the XITS-Regular file on my system:
If I go through the darwin code path then it builds cleanly so I think we need to be a bit more precise about sorting out how to specify the fonts than just if we are on darwin :(. |
That's unfortunate; I was hoping to avoid figuring out how to query |
Not really sure what you exactly need here but is it something along the lines of |
Maybe. @tacaswell what is the output of |
on arch:
on ubuntu
|
On macOS, xelatex uses the system font directories, but MacTeX fonts are not added there. However, these files can be found by specifying the file name instead of the font name, so do so on macOS. On Linux, it is mostly better to continue to specify the font name, as different distros ship different extensions. This should still work on systems that don't do this, using the same fallback as macOS.
I spent a while trying to get this to work with |
I tested that this now builds cleanly for me on an Arch box. |
Merged on a single review because this configuration to build the latex docs and some of these commits came from the OP. @jfbu Thank you for getting this work started! |
@tacaswell @QuLogic great to hear that you seem to have solved tricky multi-platform issues there! |
PR Summary
This is a rebase of #15797, plus additional fixes for new errors and a patch for macOS font paths.
PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).