-
-
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?
Changes from all commits
d5ba3ba
43e2e48
998177b
21a4c93
d12e60d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,10 @@ | |
\renewcommand{\ttdefault}{txtt} | ||
''' | ||
|
||
PDFLATEX_DEFAULT_FONTPKGMATH = r''' | ||
\usepackage{amssymb}% may become stix2 at some future version | ||
''' | ||
|
||
PDFLATEX_DEFAULT_FONTSUBSTITUTION = r''' | ||
\expandafter\ifx\csname T@LGR\endcsname\relax | ||
\else | ||
|
@@ -58,12 +62,54 @@ | |
] | ||
''' | ||
|
||
XELATEX_DEFAULT_FONTPKGMATH = r''' | ||
\usepackage{unicode-math} | ||
\setmathfont{XITSMath-Regular.otf}[ | ||
StylisticSet=1,% choice of shape for "\mathcal" | ||
BoldFont=XITSMath-Bold.otf, | ||
ItalicFont=XITS-Italic.otf,% text only (\mathit) | ||
BoldItalicFont=XITS-BoldItalic.otf,% text only | ||
NFSSFamily=XITS, | ||
] | ||
\makeatletter | ||
\AtBeginDocument{% | ||
% work around unicode-math problems with \mathbf{\Gamma} et al. | ||
\SetMathAlphabet{\mathrm}{normal}{TU}{XITS}{m}{n} | ||
\SetMathAlphabet{\mathit}{normal}{TU}{XITS}{m}{it} | ||
\SetMathAlphabet{\mathbf}{normal}{TU}{XITS}{b}{n} | ||
\SetMathAlphabet{\mathrm}{bold}{TU}{XITS}{b}{n} | ||
\SetMathAlphabet{\mathit}{bold}{TU}{XITS}{b}{it} | ||
\SetMathAlphabet{\mathbf}{bold}{TU}{XITS}{b}{n} | ||
\def\Gamma{Γ} | ||
\def\Delta{Δ} | ||
\def\Theta{Θ} | ||
\def\Lambda{Λ} | ||
\def\Xi{Ξ} | ||
\def\Pi{Π} | ||
\def\Sigma{Σ} | ||
\def\Upsilon{Υ} | ||
\def\Phi{Φ} | ||
\def\Psi{Ψ} | ||
\def\Omega{Ω} | ||
% 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} | ||
Comment on lines
+94
to
+101
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
} | ||
\makeatother | ||
''' | ||
|
||
XELATEX_GREEK_DEFAULT_FONTPKG = (XELATEX_DEFAULT_FONTPKG + | ||
'\n\\newfontfamily\\greekfont{FreeSerif}' + | ||
'\n\\newfontfamily\\greekfontsf{FreeSans}' + | ||
'\n\\newfontfamily\\greekfonttt{FreeMono}') | ||
|
||
LUALATEX_DEFAULT_FONTPKG = XELATEX_DEFAULT_FONTPKG | ||
LUALATEX_DEFAULT_FONTPKGMATH = XELATEX_DEFAULT_FONTPKGMATH | ||
|
||
DEFAULT_SETTINGS: dict[str, Any] = { | ||
'latex_engine': 'pdflatex', | ||
|
@@ -82,11 +128,12 @@ | |
'utf8extra': '', | ||
'cmappkg': '\\usepackage{cmap}', | ||
'fontenc': '\\usepackage[T1]{fontenc}', | ||
'amsmath': '\\usepackage{amsmath,amssymb,amstext}', | ||
'amsmath': '\\usepackage{amsmath,amstext}', | ||
jfbu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
'multilingual': '', | ||
'babel': '\\usepackage{babel}', | ||
'polyglossia': '', | ||
'fontpkg': PDFLATEX_DEFAULT_FONTPKG, | ||
'fontpkgmath': PDFLATEX_DEFAULT_FONTPKGMATH, | ||
'fontsubstitution': PDFLATEX_DEFAULT_FONTSUBSTITUTION, | ||
'substitutefont': '', | ||
'textcyrillic': '', | ||
|
@@ -142,6 +189,7 @@ | |
'fontenc': ('\\usepackage{fontspec}\n' | ||
'\\defaultfontfeatures[\\rmfamily,\\sffamily,\\ttfamily]{}'), | ||
'fontpkg': XELATEX_DEFAULT_FONTPKG, | ||
'fontpkgmath': XELATEX_DEFAULT_FONTPKGMATH, | ||
'fvset': '\\fvset{fontsize=\\small}', | ||
'fontsubstitution': '', | ||
'textgreek': '', | ||
|
@@ -155,6 +203,7 @@ | |
'fontenc': ('\\usepackage{fontspec}\n' | ||
'\\defaultfontfeatures[\\rmfamily,\\sffamily,\\ttfamily]{}'), | ||
'fontpkg': LUALATEX_DEFAULT_FONTPKG, | ||
'fontpkgmath': LUALATEX_DEFAULT_FONTPKGMATH, | ||
'fvset': '\\fvset{fontsize=\\small}', | ||
'fontsubstitution': '', | ||
'textgreek': '', | ||
|
@@ -166,6 +215,7 @@ | |
'babel': '', | ||
'classoptions': ',dvipdfmx', | ||
'fontpkg': PDFLATEX_DEFAULT_FONTPKG, | ||
'fontpkgmath': PDFLATEX_DEFAULT_FONTPKGMATH, | ||
'fontsubstitution': '', | ||
'textgreek': '', | ||
'fncychap': '', | ||
|
@@ -176,6 +226,7 @@ | |
'babel': '', | ||
'classoptions': ',dvipdfmx', | ||
'fontpkg': PDFLATEX_DEFAULT_FONTPKG, | ||
'fontpkgmath': PDFLATEX_DEFAULT_FONTPKGMATH, | ||
'fontsubstitution': '', | ||
'textgreek': '', | ||
'fncychap': '', | ||
|
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.