linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Jonathan Corbet <corbet@lwn.net>,
	Linux Doc Mailing List <linux-doc@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	"Mauro Carvalho Chehab" <mchehab+huawei@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 06/14] docs: conf.py: fix some troubles for LaTeX output
Date: Thu, 21 Aug 2025 10:16:42 +0200	[thread overview]
Message-ID: <8104ce56a5ea3509fbb56a8163b779d38a6aaa9c.1755763127.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <cover.1755763127.git.mchehab+huawei@kernel.org>

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>
---
 Documentation/conf.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Documentation/conf.py b/Documentation/conf.py
index 628af81e6879..5888e2988b4f 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}
     """)
-- 
2.50.1


  parent reply	other threads:[~2025-08-21  8:17 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-21  8:16 [PATCH v2 00/14] Fix PDF doc builds on major distros Mauro Carvalho Chehab
2025-08-21  8:16 ` [PATCH v2 01/14] docs: Makefile: Fix LaTeX paper size settings Mauro Carvalho Chehab
2025-08-21  8:16 ` [PATCH v2 02/14] docs: conf.py: better handle latex documents Mauro Carvalho Chehab
2025-08-21  8:16 ` [PATCH v2 03/14] docs: conf.py: fix doc name with SPHINXDIRS Mauro Carvalho Chehab
2025-08-21  8:16 ` [PATCH v2 04/14] docs: conf.py: rename some vars at latex_documents logic Mauro Carvalho Chehab
2025-08-21  8:16 ` [PATCH v2 05/14] docs: conf.py: use dedent and r-strings for LaTeX macros Mauro Carvalho Chehab
2025-08-21  8:16 ` Mauro Carvalho Chehab [this message]
2025-08-21  8:16 ` [PATCH v2 07/14] docs: conf.py: extra cleanups and fixes Mauro Carvalho Chehab
2025-08-22 12:01   ` Akira Yokosawa
2025-08-22 13:27     ` Mauro Carvalho Chehab
2025-08-22 22:34       ` Jonathan Corbet
2025-08-25 12:07         ` Mauro Carvalho Chehab
2025-08-25 12:15           ` Jonathan Corbet
2025-08-25 17:11             ` Mauro Carvalho Chehab
2025-08-21  8:16 ` [PATCH v2 08/14] scripts: sphinx-pre-install: fix PDF build issues on Ubuntu Mauro Carvalho Chehab
2025-08-21  8:16 ` [PATCH v2 09/14] scripts: sphinx-pre-install: add missing gentoo pdf dependencies Mauro Carvalho Chehab
2025-08-21  8:16 ` [PATCH v2 10/14] scripts: sphinx-pre-install: fix PDF dependencies for openSuse Mauro Carvalho Chehab
2025-08-21  8:16 ` [PATCH v2 11/14] scripts: sphinx-pre-install: fix dependencies for OpenMandriva Mauro Carvalho Chehab
2025-08-21  8:16 ` [PATCH v2 12/14] scripts: sphinx-pre-install: fix pdf dependencies for Mageia 9 Mauro Carvalho Chehab
2025-08-21  8:16 ` [PATCH v2 13/14] scripts: sphinx-pre-install: fix PDF dependencies for gentoo Mauro Carvalho Chehab
2025-08-21  8:16 ` [PATCH v2 14/14] scripts/sphinx-pre-install: fix Archlinux PDF dependencies Mauro Carvalho Chehab
2025-08-21 19:22 ` [PATCH v2 00/14] Fix PDF doc builds on major distros Jonathan Corbet
2025-08-21 19:43   ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8104ce56a5ea3509fbb56a8163b779d38a6aaa9c.1755763127.git.mchehab+huawei@kernel.org \
    --to=mchehab+huawei@kernel.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).