summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2025-08-21 10:16:42 +0200
committerJonathan Corbet <corbet@lwn.net>2025-08-21 14:08:53 -0600
commitd3265de62fb7e9f30c6ad1195d0bf12edcf3d20f (patch)
tree10f497cfcf28b10d44e21fcda171e1341bebbde1
parente7880da7ed881c160a60784b6e011ad8b16aeb33 (diff)
docs: conf.py: fix some troubles for LaTeX output
While PDF docs work fine on RPM-based distros, it causes conflicts on Debian & friends. There are multiple root causes here: - the latex_elements still resambles the one from Sphinx 1.x times, where font configurations were stored under "preamble". It doesn't follow the current recommended way from Sphinx documentation: https://www.sphinx-doc.org/en/master/latex.html - instead of setting the main font, from where other fonts are derivated, it sets romanfont; - "fontenc" is not set. This allows the *.tex output file to contain an UTF-8 incompatible fontset: \usepackage[T1]{fontenc} Address such issues to help preventing incompatible usage of both T1 font and UTF-8 ones that comes from DejaVu font family. On some distros, this even generate a LaTeX font warning about corrupted NFSS tables like this (I got it when running it in interactive mode): Package: fontenc 2021/04/29 v2.0v Standard LaTeX package LaTeX Font Info: Trying to load font information for T1+lmr on input line 11 6. LaTeX Font Info: No file T1lmr.fd. on input line 116. LaTeX Font Warning: Font shape `T1/lmr/m/n' undefined (Font) using `T1/lmr/m/n' instead on input line 116. ! Corrupted NFSS tables. wrong@fontshape ...message {Corrupted NFSS tables} error@fontshape else let f... l.116 ...\familydefault\seriesdefault\shapedefault Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Link: https://lore.kernel.org/r/8104ce56a5ea3509fbb56a8163b779d38a6aaa9c.1755763127.git.mchehab+huawei@kernel.org
-rw-r--r--Documentation/conf.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Documentation/conf.py b/Documentation/conf.py
index e00ec8f59f25..020ecfa05a07 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -461,6 +461,7 @@ latex_elements = {
# Latex figure (float) alignment
# 'figure_align': 'htbp',
# Don't mangle with UTF-8 chars
+ "fontenc": "",
"inputenc": "",
"utf8extra": "",
# Set document margins
@@ -476,13 +477,14 @@ latex_elements = {
"maxlistdepth": "10",
# For CJK One-half spacing, need to be in front of hyperref
"extrapackages": r"\usepackage{setspace}",
- # Additional stuff for the LaTeX preamble.
- "preamble": dedent(r"""
- % Use some font with UTF-8 support with XeLaTeX
+ "fontpkg": dedent(r"""
\usepackage{fontspec}
+ \setmainfont{DejaVu Serif}
\setsansfont{DejaVu Sans}
- \setromanfont{DejaVu Serif}
\setmonofont{DejaVu Sans Mono}
+ \newfontfamily\headingfont{DejaVu Serif}
+ """),
+ "preamble": dedent(r"""
% Load kerneldoc specific LaTeX settings
\input{kerneldoc-preamble.sty}
""")