linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Akira Yokosawa <akiyks@gmail.com>
To: mchehab+huawei@kernel.org
Cc: corbet@lwn.net, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, Akira Yokosawa <akiyks@gmail.com>
Subject: Re: [PATCH 05/11] docs: conf.py: fix some troubles for LaTeX output
Date: Wed, 20 Aug 2025 17:16:11 +0900	[thread overview]
Message-ID: <bf58f8ef-5fe8-435c-a2d5-efe0f2fd2ebd@gmail.com> (raw)
In-Reply-To: <ceaa9512336444bd148511a4a3bbc336ca317757.1755256868.git.mchehab+huawei@kernel.org>

Hi Mauro,

Looks like my word choice annoyed you.  Apologies again.

I've just realized your response while composing this, but I'm sending
it anyway.  Please see below.

On Fri, 15 Aug 2025 13:36:21 +0200, Mauro Carvalho Chehab wrote:
> While PDF docs work fine on RPM-based distros, it causes conflicts
> on Debian & friends:
> 
> Documentation/output/process/latex/process.log:
> 
> 	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
> 
> Change some logic inside latex_elements to avoid such issues,
> following the example from Sphinx documentation:
> 
> 	https://www.sphinx-doc.org/en/master/latex.html
> 

I spotted a wrong looking LaTeX macro use.  See below:

> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> ---
>  Documentation/conf.py | 39 +++++++++++++++++++++++----------------
>  1 file changed, 23 insertions(+), 16 deletions(-)
> 
> diff --git a/Documentation/conf.py b/Documentation/conf.py
> index 6e12c7d8e07e..712e0a016727 100644
> --- a/Documentation/conf.py
> +++ b/Documentation/conf.py
> @@ -9,6 +9,8 @@ import os
>  import shutil
>  import sys
>  
> +from  textwrap import dedent
> +
>  import sphinx
>  
>  # If extensions (or modules to document with autodoc) are in another directory,
> @@ -454,19 +456,38 @@ htmlhelp_basename = "TheLinuxKerneldoc"
>  latex_elements = {
>      # The paper size ('letterpaper' or 'a4paper').
>      "papersize": "a4paper",
> +    "passoptionstopackages": dedent(r"""
> +        \PassOptionsToPackage{svgnames}{xcolor}
> +        % Avoid encoding troubles when creating indexes
> +        \PassOptionsToPackage{xindy}{language=english,codepage=utf8,noautomatic}
> +    """),

This use of \PassOptionsToPackage{}{} looks very wrong, because its 1st
argument is the option string you would like to pass to a latex package
given in the 2nd argument.

See: https://latexref.xyz/_005cPassOptionsToClass-_0026-_005cPassOptionsToPackage.html

Furthermore, as there is no such latex package named "xindy",
this will have any effect even if you reverse the argument order.

I imagine you had some illusion and believed it would fix some issue
you had observed.

Also, I don't see the need of \PassOptionsToPackage{svgnames}{xcolor}.
Please clarify who needs that color namespace option in the changelog.

>      # The font size ('10pt', '11pt' or '12pt').
>      "pointsize": "11pt",
> +    # Needed to generate a .ind file
> +    'printindex': r'\footnotesize\raggedright\printindex',

I would mention this as an improvement in the changelog.

And the following changes look good to me.

Thanks, Akira

>      # Latex figure (float) alignment
>      # 'figure_align': 'htbp',
>      # Don't mangle with UTF-8 chars
> +    "fontenc": "",
>      "inputenc": "",
>      "utf8extra": "",
> +    'fontpkg': dedent(r'''
> +        \usepackage{fontspec}
> +        \setmainfont{DejaVu Serif}
> +        \setsansfont{DejaVu Sans}
> +        \setmonofont{DejaVu Sans Mono}
> +        \newfontfamily\headingfont{DejaVu Serif}
> +    '''),
>      # Set document margins
> -    "sphinxsetup": """
> +    "sphinxsetup": dedent(r"""
>          hmargin=0.5in, vmargin=1in,
>          parsedliteralwraps=true,
>          verbatimhintsturnover=false,
> -    """,
> +    """),
> +    "preamble": dedent(r"""
> +        % Load kerneldoc specific LaTeX settings
> +        \input{kerneldoc-preamble.sty}
> +    """),
>      #
>      # Some of our authors are fond of deep nesting; tell latex to
>      # cope.
> @@ -474,22 +495,8 @@ 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": """
> -        % Use some font with UTF-8 support with XeLaTeX
> -        \\usepackage{fontspec}
> -        \\setsansfont{DejaVu Sans}
> -        \\setromanfont{DejaVu Serif}
> -        \\setmonofont{DejaVu Sans Mono}
> -    """,
>  }
>  
> -# Load kerneldoc specific LaTeX settings
> -latex_elements["preamble"] += """
> -        % Load kerneldoc specific LaTeX settings
> -        \\input{kerneldoc-preamble.sty}
> -"""
> -
>  # This will be filled up by config-inited event
>  latex_documents = []
>  

  reply	other threads:[~2025-08-20  8:16 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-15 11:36 [PATCH 00/11] Fix PDF doc builds on major distros Mauro Carvalho Chehab
2025-08-15 11:36 ` [PATCH 01/11] docs: Makefile: Fix LaTeX paper size settings Mauro Carvalho Chehab
2025-08-15 11:36 ` [PATCH 02/11] docs: conf.py: better handle latex documents Mauro Carvalho Chehab
2025-08-15 11:36 ` [PATCH 03/11] docs: conf.py: fix doc name with SPHINXDIRS Mauro Carvalho Chehab
2025-08-15 11:36 ` [PATCH 04/11] docs: conf.py: rename some vars at latex_documents logic Mauro Carvalho Chehab
2025-08-15 11:36 ` [PATCH 05/11] docs: conf.py: fix some troubles for LaTeX output Mauro Carvalho Chehab
2025-08-20  8:16   ` Akira Yokosawa [this message]
2025-08-15 11:36 ` [PATCH 06/11] scripts: sphinx-pre-install: fix PDF build issues on Ubuntu Mauro Carvalho Chehab
2025-08-15 11:36 ` [PATCH 07/11] scripts: sphinx-pre-install: add missing gentoo pdf dependencies Mauro Carvalho Chehab
2025-08-15 11:36 ` [PATCH 08/11] scripts: sphinx-pre-install: fix PDF dependencies for openSuse Mauro Carvalho Chehab
2025-08-15 11:36 ` [PATCH 09/11] scripts: sphinx-pre-install: fix dependencies for OpenMandriva Mauro Carvalho Chehab
2025-08-15 11:36 ` [PATCH 10/11] scripts: sphinx-pre-install: fix pdf dependencies for Mageia 9 Mauro Carvalho Chehab
2025-08-15 11:36 ` [PATCH 11/11] scripts: sphinx-pre-install: fix PDF dependencies for gentoo Mauro Carvalho Chehab
2025-08-16  5:06 ` [PATCH 00/11] Fix PDF doc builds on major distros Akira Yokosawa
2025-08-16 11:55   ` Mauro Carvalho Chehab
2025-08-17  9:46     ` Akira Yokosawa
2025-08-17 11:36       ` Mauro Carvalho Chehab
2025-08-17 12:24         ` Akira Yokosawa
2025-08-17 13:45           ` Mauro Carvalho Chehab
2025-08-17 16:07             ` Akira Yokosawa
2025-08-18  0:44               ` Akira Yokosawa
2025-08-18  9:42                 ` Mauro Carvalho Chehab
2025-08-18 10:06                   ` Akira Yokosawa
2025-08-18 11:35                     ` Mauro Carvalho Chehab
2025-08-18 12:00                       ` Akira Yokosawa
2025-08-18 17:07               ` Jonathan Corbet
2025-08-18 23:26                 ` Akira Yokosawa
2025-08-19  1:02                   ` Mauro Carvalho Chehab
2025-08-19  2:16                     ` Akira Yokosawa
2025-08-19 13:32                       ` Mauro Carvalho Chehab
2025-08-19 23:54                         ` Akira Yokosawa
2025-08-20  7:15                           ` Mauro Carvalho Chehab
2025-08-20 11:41                             ` Akira Yokosawa
2025-08-20 16:48                               ` Mauro Carvalho Chehab
2025-08-20 23:53                                 ` Akira Yokosawa
2025-08-21  0:09                                   ` Akira Yokosawa
2025-08-21  7:52                                     ` Mauro Carvalho Chehab
2025-08-21  7:56                                       ` Mauro Carvalho Chehab
2025-08-21  9:12                                     ` Inkscape - Was: " Mauro Carvalho Chehab
2025-08-18 16:59       ` Jonathan Corbet
2025-08-17 15:32 ` Vegard Nossum
2025-08-18  8:33   ` 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=bf58f8ef-5fe8-435c-a2d5-efe0f2fd2ebd@gmail.com \
    --to=akiyks@gmail.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab+huawei@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).