-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
LaTeX: new 'fontpkgmath' key of latex_elements, use unicode-math #12753
base: master
Are you sure you want to change the base?
Conversation
texlive-unicode-math [platform:rpm] | ||
texlive-xits [platform:rpm] |
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.
Actually, it seems all are "subpackages" of texlive
which we require earlier in this bindep.txt for Fedora, see also here, so I am not sure we really need this and/or any of the other lines.
As per Ubuntu, unicode-math is part of texlive-latex-recommended, and XITS Math of texlive-fonts-extras which we both require already.
I had prepared some screenshots which I almost forgot to post: Currently with xelatex engine (and very similar with pdflatex engine, except that the bold Gamma 𝚪 in last displayed equation would show and not a boxed question mark) With this PR and xelatex engine EDIT: the "bad match of math with text" in upper screenshot is most visible on letters such as |
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.
Due to reasons of stix2
being basically unmaintained and having some bugs, it may be more reasonable to only provide some advice on how to possibly use it but not make it the default for Sphinx with 'pdflatex'
. Users of Sphinx making intensive use of math mode will be advised to use 'xelatex'
rather. Which raises other issues because it is known there are some problems with math mode with 'xelatex'
and also 'xelatex'
does not look to be actively maintained nowadays;
% Make subscripts a bit larger for legibility | ||
\def\defaultscriptratio{.8} | ||
\def\defaultscriptscriptratio{.6} | ||
\DeclareMathSizes{9}{9}{7}{5} | ||
\DeclareMathSizes{\@xpt}{\@xpt}{8}{6} | ||
\DeclareMathSizes{\@xipt}{\@xipt}{8.76}{6.57} | ||
\DeclareMathSizes{\@xiipt}{\@xiipt}{9.6}{7.2} | ||
\DeclareMathSizes{\@xivpt}{\@xivpt}{11.52}{8.64} |
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 brings legibility benefits. When time will come at Sphinx 9 for using stix2
in place of amssymb
for pdflatex
engine, these settings will be re-used probably identically and are then completely necessary to work around some obvious rendering problems with stix2
such as stipub/stix_type1#4.
doc/latex.rst
Outdated
|
||
- ``r'\usepackage{unicode-math}'`` for ``'xelatex'`` and ``'lualatex'`` | ||
with extras to set the math font to XITS Math (which is an excellent | ||
match to FreeSerif text font). It also makes mark-up such as |
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.
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.
An alternative to XITS Math (which is now frozen and will not change, and was a fork of STIX fixing a number of problems) might be with STIX Two Math. But it has seemingly no bold weight variant. So one has to use additional declarations with fontspec using |
6805d44
to
d5ba3ba
Compare
HTML + MathJax does the expected thing too.
Feature or Bugfix
all three of
\mathbf{\Lambda}
is ok with pdflatex and uplatex, not with xelatex or lualatex #12714\usepackage{amssymb}
a bit later in preamble. Do not use if for Unicode engines.Relates
amssymb
but to load it earlier than the contents oflatex_elements['fontpkg']
which could for example useunicode-math
. This potential conflict is solved in another way by this PR.I have for a very long time being perhaps too much procrastinating usage of
unicode-math
with Unicode engines. Work on SymPy project forced me to invest some more time into this and obtain a correct way to use it. Alas, one should not think using it as per what you will find on LaTeX discussion groups is actually the good way for Sphinx, in particular because we must make sure that HTML+MathJax renders the same for the same input.