lkml.org 
[lkml]   [2022]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/3] docs: pdfdocs: Pull LaTeX preamble part out of conf.py
From
On Thu, 24 Feb 2022 12:33:25 -0700,
Jonathan Corbet wrote:
> Akira Yokosawa <akiyks@gmail.com> writes:
>
>> Quote from Jon's remark [1]:
>>
>> I do notice that Documentation/conf.py is getting large and
>> unapproachable. At some future point, it might be nice to pull
>> all of the latex stuff out into a separate file where it won't
>> scare people who stumble into it by accident.
>>
>> Pull LaTeX preamble settings added since commit 3b4c963243b1 ("docs:
>> conf.py: adjust the LaTeX document output") out into
>> sphinx/kerneldoc-preamble.sty.
>>
>> It will be copied to the build directory by the added
>> "latex_additional_files" setting in conf.py.
>>
>> As a bonus, LaTeX/TeX code can be maintained without escaping backslashes.
>
> I've applied the set, thanks. Still testing the pdfdocs build (and will
> be for some time, naturally)
>
> One little note, since you mentioned the need for backslash escapes:
>
>> +# Load kerneldoc specific LaTeX settings
>> +latex_elements['preamble'] += '''
>> + % Load kerneldoc specific LaTeX settings
>> + \\input{kerneldoc-preamble.sty}
>> +'''
>
> You can avoid that problem in Python code with the use of raw strings:
>
> latex_elements['preamble'] += r'''
> % Load kerneldoc specific LaTeX settings
> \input{kerneldoc-preamble.sty}
> '''
>
> (note the "r" on the first line). Something for future reference.

Thank you for the tip.

It turns out that I unknowingly used a raw string in commit
77abc2c230b1 ("docs: pdfdocs: One-half spacing for CJK translations").

I think I copy-pasted an example from "extrapackages" key documentation.

Now I understand the use of raw string.
I will convert remaining LaTeX code in conf.py to raw string(s)
when I need to edit it in the future.

Thanks, Akira

>
> Thanks,
>
> jon

\
 
 \ /
  Last update: 2022-02-26 02:35    [W:0.050 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site