Received: by 2002:a19:ef0c:0:0:0:0:0 with SMTP id n12csp951412lfh; Tue, 1 Feb 2022 12:54:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJx6ThXpb2Y88GPWdGR7jnK7mXAZYWJWyAqsP8V8tN3iIoA32xg7y2XkpAVnnu6CH2FCxssV X-Received: by 2002:a17:90b:4c06:: with SMTP id na6mr4437336pjb.37.1643748858355; Tue, 01 Feb 2022 12:54:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643748858; cv=none; d=google.com; s=arc-20160816; b=z/8BKi7nMZ4e/LsFXaEoZ4v2kiQ+8VJGPHMpCSFxOI7iNmGxdfNlfsae7oFW8hPK+x oCDsT8ZmJCkkaSyb3qR6USIJg/0dehRb8g4Kk04RGAJZCZ4tu7E2GMRPouK6yi6U2eL/ jQ1H9Neh7LNFnyqTMJBPXCnSe7rAV4gelCzCGDMS53HSHbklK1NM43/AFrbPHwmtNLuV b/QohXjRIHdXGiuw5AhIYgMew0R13Tgrcbv4vv6pgnzSwrj1faJ+a1uu2cws8eqAL39n q+uptrHrZGyS2e35I5vRVJS8e1eSNvhiiM5Bf6WIFHDwS+XYFRwysq5uneptAPNtGu+2 6aWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=pOvdxwNu0aCxPhjOkTQG4+wa9GYqirD+kwvDetyDjpk=; b=KH5AdmOUhcN/pRW4QXzdA+GMC0cLvVmkNrHyqw3mALduq4xSRLaFj6NVk1a+BN21Ge 9XU093SeewIlohTOhxrXv+CwkL+eB/wNaekXGI7Hz5P+d6S/fllvoYIGsbCSzIzsSBHv C7hIboXkBTd3RSJobrOZEukaTAYa/Rqjo6ZPGiRI9HbX/JNw0OC0mQb13qDuGEYAPltU 1BwxfqfX1zUQPINr4yukFNemskfv1DA9mcnMeOm3EdCtmvyq7BKy8WFbUD6q3m8+yy7/ jF7R1uG2r5GEbgirZ5psfbSHa5Ps8NhQrqsWJDZdbCHScC1SHMa/5INs4AeEoAdXcGro F/zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Sho7e8/e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s17si17492906pgm.852.2022.02.01.12.54.06; Tue, 01 Feb 2022 12:54:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Sho7e8/e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229891AbiBAAAF (ORCPT + 99 others); Mon, 31 Jan 2022 19:00:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229820AbiBAAAE (ORCPT ); Mon, 31 Jan 2022 19:00:04 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15CB3C061714; Mon, 31 Jan 2022 16:00:04 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id i65so14268728pfc.9; Mon, 31 Jan 2022 16:00:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=pOvdxwNu0aCxPhjOkTQG4+wa9GYqirD+kwvDetyDjpk=; b=Sho7e8/eoHtTyCU8+A18o2EYGFcGkbVajS2+AUq75ecTJ/FzwIqwCO7QtCmbkP3D6C C90Fy9K+cyhpDJxx1vH3bXofZNiiGBhM52AotrcPLpmZTA+ASOsTWH2ru6qxNvFEdZgU egeVWjrqnpTqgmnoKT3rdp2DGmSVjI5Y519e+X6bHrEnwNW/U0s18vRI19ff7Szq4AWL M3XmbBX3yJXMLhOJn123ykp+GU7gANfpA51V7iRnf+nB9z/ZImbpj/l/gxQMjUpZL37S uY5nG4N55laW66tTHtOh2uu4d40BmmSLT1l3tNjR0isuchF++R/rWpS9btrSkI3CzUxf RI0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=pOvdxwNu0aCxPhjOkTQG4+wa9GYqirD+kwvDetyDjpk=; b=Vhv9IgrV1uRkpJdWZU4bhtYVxQyTJn7WdwHO4Yu/EIYyVkaDRthUXbiVdXSQIErB2X wiGEjpzphhvlHImESuFfNOuFZukKXgZkdLBtDDeH2Rx8kiJCUyMO7rJ3nTNsyIxhfsFe TAVuraXriVkNfMQOYQbl3uMAduFlia5VrTnTz45N86JVnFuqo+fZh952tJ8Ym4t6pCvw acDjB/WtKqewhU2+mrtuYgulspu/yCd4fb9gQ0yrLiycShQchsdLh7x5WMRUsk3ddHMX CTXwH+w+WpicH2VTrBDpbfHmRuyrk9sP2tPt3MpuYKTZcqggT+mEk3T6aa9LJBQCvJGy zu3w== X-Gm-Message-State: AOAM530UzFqqbGIRtHlgbpiEcfEghMxfPuCV8kRu+iMa0Eb112lKng92 pfnA1zMLWYLfWb4fzqARnGMZtiMBrAI= X-Received: by 2002:a62:15c3:: with SMTP id 186mr22294832pfv.59.1643673603549; Mon, 31 Jan 2022 16:00:03 -0800 (PST) Received: from [192.168.11.5] (KD106167171201.ppp-bb.dion.ne.jp. [106.167.171.201]) by smtp.gmail.com with ESMTPSA id pc4sm437936pjb.3.2022.01.31.16.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Jan 2022 16:00:02 -0800 (PST) Message-ID: Date: Tue, 1 Feb 2022 08:59:58 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: [PATCH 1/5] docs: pdfdocs: Tweak width params of TOC Content-Language: en-US To: Jonathan Corbet Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Akira Yokosawa References: From: Akira Yokosawa In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sphinx has its own set of width parameters of Table of Contents (TOC) for LaTeX defined in its class definition of sphinxmanual.cls. It also inherits parameters for chapter entries from report.cls of original LaTeX base. However, they are optimized assuming small documents with tens of pages and chapters/sections of less than 10. To cope with some of kernel-doc documents with more than 1000 pages and several tens of chapters/sections, definitions of those parameters need to be adjusted. Unfortunately, those parameters are hard coded in the class definitions and need low-level LaTeX coding tricks to redefine. As Sphinx 1.7.9 does not have \sphinxtableofcontentshook, which defines those parameters in later Sphinx versions, for compatibility with both pre-1.8 and later Sphinx versions, empty the hook altogether and redefine \@pnumwidth, \l@chapter, \l@section, and \@subsection commands originally defined in report.cls. Summary of parameter changes: Width of page number (\@pnumwidth): 1.55em -> 2.7em Width of chapter number: 1.5em -> 1.8em Indent of section number: 1.5em -> 1.8em Width of section number: 2.6em -> 3.2em Indent of subsection number: 4.1em -> 5em Width of subsection number: 3.5em -> 4.3em Notes: 1. Parameters for subsection become relevant only when ":maxdepth: 3" is specified under "toctree::" (e.g., RCU/index.rst). They can hold subsection numbers up to 5 digits such as "18.7.13" (in RCU.pdf). 2. Number of chapters in driver-api.pdf is getting closer to 100. When it reaches 100, another set of tweaks will be necessary. 3. The low-level LaTeX trick is mentioned in "Unofficial LaTeX2e reference manual" at: http://latexref.xyz/Table-of-contents-etc_002e.html Signed-off-by: Akira Yokosawa Cc: Jonathan Corbet --- Documentation/conf.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Documentation/conf.py b/Documentation/conf.py index f07f2e9b9f2c..e5c13dee2de8 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -409,6 +409,37 @@ latex_elements = { # Additional stuff for the LaTeX preamble. 'preamble': ''' + % Custom width parameters for TOC --- Redefine low-level commands + % defined in report.cls + \\makeatletter + %% Redefine \\@pnumwidth (page number width) + \\renewcommand*\\@pnumwidth{2.7em} + %% Redefine \\l@chapter (chapter list entry) + \\renewcommand*\\l@chapter[2]{% + \\ifnum \\c@tocdepth >\\m@ne + \\addpenalty{-\\@highpenalty}% + \\vskip 1.0em \\@plus\\p@ + \\setlength\\@tempdima{1.8em}% + \\begingroup + \\parindent \\z@ \\rightskip \\@pnumwidth + \\parfillskip -\\@pnumwidth + \\leavevmode \\bfseries + \\advance\\leftskip\\@tempdima + \\hskip -\\leftskip + #1\\nobreak\\hfil + \\nobreak\\hb@xt@\\@pnumwidth{\\hss #2% + \\kern-\\p@\\kern\\p@}\\par + \\penalty\\@highpenalty + \\endgroup + \\fi} + %% Redefine \\l@section and \\l@subsection + \\renewcommand*\\l@section{\\@dottedtocline{1}{1.8em}{3.2em}} + \\renewcommand*\\l@subsection{\\@dottedtocline{2}{5em}{4.3em}} + \\makeatother + %% Sphinx < 1.8 doesn't have \\sphinxtableofcontentshook + \\providecommand{\\sphinxtableofcontentshook}{} + %% Undefine it for compatibility with Sphinx 1.7.9 + \\renewcommand{\\sphinxtableofcontentshook}{} % Empty the hook % Prevent column squeezing of tabulary. \\setlength{\\tymin}{20em} % Use some font with UTF-8 support with XeLaTeX -- 2.17.1