Skip to content

Commit 77abc2c

Browse files
akiyksJonathan Corbet
authored andcommitted
docs: pdfdocs: One-half spacing for CJK translations
CJK documents are much easier to read with a wider baseline stretch. Applying onehalfspacing option of "setspace" package looks reasonable. Note: \usepackage{setspace} needs to be before that of hyperref in the preamble. The 'extrapackages' key (available since Sphinx 2.3) is for this purpose. For systems with Sphinx < 2.3, dummy commands of \onehalfspacing and \singlespacing are provided instead. One-half spacing is not effective in LaTeX sources generated by such revisions of Sphinx. Signed-off-by: Akira Yokosawa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Corbet <[email protected]>
1 parent a90dad8 commit 77abc2c

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

Documentation/conf.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,9 @@
341341
verbatimhintsturnover=false,
342342
''',
343343

344+
# For CJK One-half spacing, need to be in front of hyperref
345+
'extrapackages': r'\usepackage{setspace}',
346+
344347
# Additional stuff for the LaTeX preamble.
345348
'preamble': '''
346349
% Prevent column squeezing of tabulary.
@@ -404,9 +407,12 @@
404407
}
405408
\\newCJKfontfamily[JPsans]\\jpsans{Noto Sans CJK JP}
406409
\\newCJKfontfamily[JPmono]\\jpmono{Noto Sans Mono CJK JP}
410+
% Dummy commands for Sphinx < 2.3 (no 'extrapackages' support)
411+
\\providecommand{\\onehalfspacing}{}
412+
\\providecommand{\\singlespacing}{}
407413
% Define custom macros to on/off CJK
408-
\\newcommand{\\kerneldocCJKon}{\\makexeCJKactive}
409-
\\newcommand{\\kerneldocCJKoff}{\\makexeCJKinactive}
414+
\\newcommand{\\kerneldocCJKon}{\\makexeCJKactive\\onehalfspacing}
415+
\\newcommand{\\kerneldocCJKoff}{\\makexeCJKinactive\\singlespacing}
410416
\\newcommand{\\kerneldocBeginSC}{%
411417
\\begingroup%
412418
\\scmain%
@@ -437,6 +443,8 @@
437443
\\renewcommand{\\CJKttdefault}{JPmono}%
438444
}
439445
\\newcommand{\\kerneldocEndJP}{\\endgroup}
446+
% Single spacing in literal blocks
447+
\\fvset{baselinestretch=1}
440448
% To customize \\sphinxtableofcontents
441449
\\usepackage{etoolbox}
442450
% Inactivate CJK after tableofcontents

Documentation/translations/ja_JP/howto.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.. raw:: latex
2+
3+
\kerneldocCJKoff
4+
15
NOTE:
26
This is a version of Documentation/process/howto.rst translated into Japanese.
37
This document is maintained by Tsugikazu Shibata <[email protected]>
@@ -11,6 +15,10 @@ try to update the original English file first.
1115

1216
----------------------------------
1317

18+
.. raw:: latex
19+
20+
\kerneldocCJKon
21+
1422
この文書は、
1523
Documentation/process/howto.rst
1624
の和訳です。

Documentation/translations/ko_KR/howto.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.. raw:: latex
2+
3+
\kerneldocCJKoff
4+
15
NOTE:
26
This is a version of Documentation/process/howto.rst translated into korean
37
This document is maintained by Minchan Kim <[email protected]>
@@ -11,6 +15,10 @@ try to update the original English file first.
1115

1216
----------------------------------
1317

18+
.. raw:: latex
19+
20+
\kerneldocCJKon
21+
1422
이 문서는
1523
Documentation/process/howto.rst
1624
의 한글 번역입니다.

0 commit comments

Comments
 (0)