linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] docs: Activate xeCJK only in CJK chapters
@ 2021-05-22  7:28 Akira Yokosawa
  2021-05-22 16:56 ` Wu X.C.
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Akira Yokosawa @ 2021-05-22  7:28 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Jonathan Corbet, linux-doc, linux-kernel, Akira Yokosawa

Activating xeCJK in English or Italian-translation documents
results in sub-optimal typesetting with wide-looking apostrophes
and quotation marks.

The xeCJK package provides macros for enabling and disabling its
effect in the middle of a document, namely \makexeCJKactive and
\makexeCJKinactive.

So the goal of this change is to activate xeCJK in the relevant
chapters in translations.

To do this:

    o Define custom macros in the preamble depending on the
      availability of the "Noto Sans CJK" font so that those
      macros can be embedded in translations.tex after the fact.
      By default, xeCJK is inactive.

    o Add a script retouch-translations.sh to embed the on/off
      macros in translations.tex where necessary.
      The patterns in the script are ad-hoc by nature, and will
      need updates when the chapter organization changes.

    o Invoke the script at the final step of target "latexdocs".


Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
Hi Mauro,

Good news.
xeCJK can be activated/deactivated inside a document.
Which means we can activate xeCJK only in the CJK chapters
of the translations document.

This patch is an attempt to do so.

I think there still is ad-hoc aspect in this approach, but it
also fixed the build error of s390.pdf I encountered yesterday
(with the CJK font installed).

"make pdfdocs" now completes successfully both with and without
the CJK font installed.

Can you try this?
Any feedback is welcome!

        Thanks, Akira
--
 Documentation/Makefile                       |  2 ++
 Documentation/conf.py                        | 11 ++++++++
 Documentation/sphinx/retouch-translations.sh | 29 ++++++++++++++++++++
 3 files changed, 42 insertions(+)
 create mode 100755 Documentation/sphinx/retouch-translations.sh

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 9c42dde97671..31ca4d268fa0 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -96,6 +96,8 @@ linkcheckdocs:
 latexdocs:
 	@$(srctree)/scripts/sphinx-pre-install --version-check
 	@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,latex,$(var),latex,$(var)))
+	@find $(BUILDDIR) -name translations.tex -exec \
+	sh $(srctree)/Documentation/sphinx/retouch-translations.sh \{\} \;
 
 ifeq ($(HAVE_PDFLATEX),0)
 
diff --git a/Documentation/conf.py b/Documentation/conf.py
index 879e86dbea66..b3ab8b6017af 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -371,6 +371,17 @@ if cjk_cmd.find("Noto Sans CJK SC") >= 0:
 	% This is needed for translations
         \\usepackage{xeCJK}
         \\setCJKmainfont{Noto Sans CJK SC}
+	% Define custom macro to on/off CJK
+	\\newcommand{\\kerneldocCJKon}{\\makexeCJKactive}
+	\\newcommand{\\kerneldocCJKoff}{\\makexeCJKinactive}
+	% CJK off by default
+	\\kerneldocCJKoff
+     '''
+else:
+    latex_elements['preamble']  += '''
+	% Dummy custom macro to on/off CJK
+	\\newcommand{\\kerneldocCJKon}{}
+	\\newcommand{\\kerneldocCJKoff}{}
      '''
 
 # Fix reference escape troubles with Sphinx 1.4.x
diff --git a/Documentation/sphinx/retouch-translations.sh b/Documentation/sphinx/retouch-translations.sh
new file mode 100755
index 000000000000..edbfde42b1a5
--- /dev/null
+++ b/Documentation/sphinx/retouch-translations.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# Copyright 2021 Akira Yokosawa <akiyks@gmail.com>
+#
+# Retouch translations.tex to add CJK on/off macros.
+# The substitution rules need updates when there is some change in
+# the ordering of chapters.
+#
+# Path of the file to be retouched is passed in command argument $1
+# from docs Makefile.
+# If there is no need of retouch, do nothing.
+
+retouch=$1
+
+if [ -e $retouch ]; then
+	if grep -q 'kerneldocCJKon\\chapter' $retouch ; then
+		exit 0
+	fi
+	sed -i -e 's/\(\\sphinxtableofcontents\)/\\kerneldocCJKon\1/' \
+	    -e 's/\(\\chapter{中文\)/\\kerneldocCJKon\1/' \
+	    -e 's/\(\\chapter{Traduzione[^}]*}\)/\1\\kerneldocCJKoff/' \
+	    -e 's/\(\\chapter{한국어\)/\\kerneldocCJKon\1/' \
+	    -e 's/\(\\chapter{Disclaimer[^}]*}\)/\1\\kerneldocCJKoff/' \
+	    $retouch
+	echo "$retouch retouched."
+	exit 0
+else
+	exit 0
+fi
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] docs: Activate xeCJK only in CJK chapters
  2021-05-22  7:28 [PATCH] docs: Activate xeCJK only in CJK chapters Akira Yokosawa
@ 2021-05-22 16:56 ` Wu X.C.
  2021-05-22 23:35   ` Akira Yokosawa
  2021-05-22 18:14 ` Mauro Carvalho Chehab
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Wu X.C. @ 2021-05-22 16:56 UTC (permalink / raw)
  To: Akira Yokosawa
  Cc: Mauro Carvalho Chehab, Jonathan Corbet, linux-doc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1321 bytes --]

On Sat, May 22, 2021 at 04:28:55PM +0900, Akira Yokosawa wrote:
> Activating xeCJK in English or Italian-translation documents
> results in sub-optimal typesetting with wide-looking apostrophes
> and quotation marks.
> 
> The xeCJK package provides macros for enabling and disabling its
> effect in the middle of a document, namely \makexeCJKactive and
> \makexeCJKinactive.
> 
> So the goal of this change is to activate xeCJK in the relevant
> chapters in translations.
> 
> To do this:
> 
>     o Define custom macros in the preamble depending on the
>       availability of the "Noto Sans CJK" font so that those
>       macros can be embedded in translations.tex after the fact.
>       By default, xeCJK is inactive.
> 
>     o Add a script retouch-translations.sh to embed the on/off
>       macros in translations.tex where necessary.
>       The patterns in the script are ad-hoc by nature, and will
>       need updates when the chapter organization changes.
> 
>     o Invoke the script at the final step of target "latexdocs".
> 
> 
> Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
> ---

Hi Akira,

Test this patch with Noto Sans SC font, worked well.
“” use right font in western language docs now.

Tested-by: Wu XiangCheng <bobwxc@email.cn>

Thanks,
Wu X.C.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] docs: Activate xeCJK only in CJK chapters
  2021-05-22  7:28 [PATCH] docs: Activate xeCJK only in CJK chapters Akira Yokosawa
  2021-05-22 16:56 ` Wu X.C.
@ 2021-05-22 18:14 ` Mauro Carvalho Chehab
  2021-05-22 23:21   ` Akira Yokosawa
  2021-05-25 11:17 ` [PATCH v2] docs: Activate exCJK " Akira Yokosawa
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Mauro Carvalho Chehab @ 2021-05-22 18:14 UTC (permalink / raw)
  To: Akira Yokosawa; +Cc: Jonathan Corbet, linux-doc, linux-kernel

Em Sat, 22 May 2021 16:28:55 +0900
Akira Yokosawa <akiyks@gmail.com> escreveu:

> Activating xeCJK in English or Italian-translation documents
> results in sub-optimal typesetting with wide-looking apostrophes
> and quotation marks.
> 
> The xeCJK package provides macros for enabling and disabling its
> effect in the middle of a document, namely \makexeCJKactive and
> \makexeCJKinactive.
> 
> So the goal of this change is to activate xeCJK in the relevant
> chapters in translations.
> 
> To do this:
> 
>     o Define custom macros in the preamble depending on the
>       availability of the "Noto Sans CJK" font so that those
>       macros can be embedded in translations.tex after the fact.
>       By default, xeCJK is inactive.
> 
>     o Add a script retouch-translations.sh to embed the on/off
>       macros in translations.tex where necessary.
>       The patterns in the script are ad-hoc by nature, and will
>       need updates when the chapter organization changes.
> 
>     o Invoke the script at the final step of target "latexdocs".

Interesting solution, but there are probably an easy/better
way of doing something similar to it.

There is an extension called:

	Documentation/sphinx/load_config.py

Which allows using a per-document conf.py file. While it can also be
used to have a "nitpick" version where extra warnings are enabled,
the main usage were to have separated PDF documents. 

We ended finding a better solution, so most conf.py got removed
on this patch: 9fc3a18a942f ("docs: remove extra conf.py files").

Anyway, perhaps we could simply add a Documentation/translations/conf.py
that would add the CJK font only there.

Even better, we could even improve it in a way that each translation
would generate a separated book, and then use CJK only for the
non-Latin translations.

Regards,
Mauro

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] docs: Activate xeCJK only in CJK chapters
  2021-05-22 18:14 ` Mauro Carvalho Chehab
@ 2021-05-22 23:21   ` Akira Yokosawa
  0 siblings, 0 replies; 12+ messages in thread
From: Akira Yokosawa @ 2021-05-22 23:21 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Jonathan Corbet, linux-doc, linux-kernel, Akira Yokosawa

On Sat, 22 May 2021 20:14:39 +0200, Mauro Carvalho Chehab wrote:
> Em Sat, 22 May 2021 16:28:55 +0900
> Akira Yokosawa <akiyks@gmail.com> escreveu:
> 
>> Activating xeCJK in English or Italian-translation documents
>> results in sub-optimal typesetting with wide-looking apostrophes
>> and quotation marks.
>>
>> The xeCJK package provides macros for enabling and disabling its
>> effect in the middle of a document, namely \makexeCJKactive and
>> \makexeCJKinactive.
>>
>> So the goal of this change is to activate xeCJK in the relevant
>> chapters in translations.
>>
>> To do this:
>>
>>     o Define custom macros in the preamble depending on the
>>       availability of the "Noto Sans CJK" font so that those
>>       macros can be embedded in translations.tex after the fact.
>>       By default, xeCJK is inactive.
>>
>>     o Add a script retouch-translations.sh to embed the on/off
>>       macros in translations.tex where necessary.
>>       The patterns in the script are ad-hoc by nature, and will
>>       need updates when the chapter organization changes.
>>
>>     o Invoke the script at the final step of target "latexdocs".
> 
> Interesting solution, but there are probably an easy/better
> way of doing something similar to it.
> 
> There is an extension called:
> 
> 	Documentation/sphinx/load_config.py
> 
> Which allows using a per-document conf.py file. While it can also be
> used to have a "nitpick" version where extra warnings are enabled,
> the main usage were to have separated PDF documents. 
> 
> We ended finding a better solution, so most conf.py got removed
> on this patch: 9fc3a18a942f ("docs: remove extra conf.py files").
> 
> Anyway, perhaps we could simply add a Documentation/translations/conf.py
> that would add the CJK font only there.

Ah, that sounds like the way to go!

But I have no idea how I can load that extra conf.py for translations.

Simply putting the following as Documentation/translations/conf.py
doesn't work.

----
# -*- coding: utf-8; mode: python -*-

# translations have Asian characters
# which are only displayed if xeCJK is used

cjk_cmd = check_output(['fc-list', '--format="%{family[0]}\n"']).decode('utf-8', 'ignore')
if cjk_cmd.find("Noto Sans CJK SC") >= 0:
    print ("translations: enabling CJK for LaTeX builder")
    latex_elements['preamble']  += '''
	% This is needed for translations
        \\usepackage{xeCJK}
        \\setCJKmainfont{Noto Sans CJK SC}
     '''
----

What am I missing?

Note: I'm not good at python.

       Thanks, Akira
> 
> Even better, we could even improve it in a way that each translation
> would generate a separated book, and then use CJK only for the
> non-Latin translations.
> 
> Regards,
> Mauro
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] docs: Activate xeCJK only in CJK chapters
  2021-05-22 16:56 ` Wu X.C.
@ 2021-05-22 23:35   ` Akira Yokosawa
  0 siblings, 0 replies; 12+ messages in thread
From: Akira Yokosawa @ 2021-05-22 23:35 UTC (permalink / raw)
  To: Wu X.C.
  Cc: Mauro Carvalho Chehab, Jonathan Corbet, linux-doc, linux-kernel,
	Akira Yokosawa

On Sun, 23 May 2021 00:56:06 +0800, Wu X.C. wrote:
> On Sat, May 22, 2021 at 04:28:55PM +0900, Akira Yokosawa wrote:
>> Activating xeCJK in English or Italian-translation documents
>> results in sub-optimal typesetting with wide-looking apostrophes
>> and quotation marks.
>>
>> The xeCJK package provides macros for enabling and disabling its
>> effect in the middle of a document, namely \makexeCJKactive and
>> \makexeCJKinactive.
>>
>> So the goal of this change is to activate xeCJK in the relevant
>> chapters in translations.
>>
>> To do this:
>>
>>     o Define custom macros in the preamble depending on the
>>       availability of the "Noto Sans CJK" font so that those
>>       macros can be embedded in translations.tex after the fact.
>>       By default, xeCJK is inactive.
>>
>>     o Add a script retouch-translations.sh to embed the on/off
>>       macros in translations.tex where necessary.
>>       The patterns in the script are ad-hoc by nature, and will
>>       need updates when the chapter organization changes.
>>
>>     o Invoke the script at the final step of target "latexdocs".
>>
>>
>> Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
>> ---
> 
> Hi Akira,
> 
> Test this patch with Noto Sans SC font, worked well.
> “” use right font in western language docs now.> 
> Tested-by: Wu XiangCheng <bobwxc@email.cn>

Thank you for testing!
As Mauro has a simpler and better idea to do this, I need to do
a respin.  I'll add you in the CC list.

        Thanks, Akira

> 
> Thanks,
> Wu X.C.
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2] docs: Activate exCJK only in CJK chapters
  2021-05-22  7:28 [PATCH] docs: Activate xeCJK only in CJK chapters Akira Yokosawa
  2021-05-22 16:56 ` Wu X.C.
  2021-05-22 18:14 ` Mauro Carvalho Chehab
@ 2021-05-25 11:17 ` Akira Yokosawa
  2021-05-25 12:30   ` Wu X.C.
  2021-05-25 13:38 ` [PATCH v3] " Akira Yokosawa
  2021-05-25 15:25 ` [PATCH v4] " Akira Yokosawa
  4 siblings, 1 reply; 12+ messages in thread
From: Akira Yokosawa @ 2021-05-25 11:17 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Jonathan Corbet, linux-doc, linux-kernel, Wu X.C., Akira Yokosawa

Activating xeCJK in English and Italian-translation documents
results in sub-optimal typesetting with wide-looking apostrophes
and quotation marks.

The xeCJK package provides macros for enabling and disabling its
effect in the middle of a document, namely \makexeCJKactive and
\makexeCJKinactive.

So the goal of this change is to activate xeCJK in the relevant
chapters in translations.

To do this:

    o Define custom macros in the preamble depending on the
      availability of the "Noto Sans CJK" font so that those
      macros can be used regardless of the use of xeCJK package.

    o Patch \sphinxtableofcontents so that xeCJK is inactivated
      after table of contents.

    o Embed those custom macros in each language's index.rst file
      as a ".. raw:: latex" construct.

Note: A CJK chapter needs \kerneldocCJKon in front of its chapter
heading, while a non-CJK chapter should have \kerneldocCJKoff
below its chapter heading.

This is to make sure the CJK font is available to CJK chapter's
heading and ending page's footer.

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
Hi all,

I'm still unable to manage the per-directory conf.py idea to work,
but as far as activation/inactivation of xeCJK is concerned,
the custom LaTeX macros can be embedded in each language's
index.rst.

Also note that the on/off macros added here are still useful
when the xeCJK related settings are moved into per-directory
conf.py, because of the Disclaimer in English.

I think per-directory conf.py can be tried as a follow-up
change after this patch is applied.

Thoughts?

        Thanks, Akira
--
 Documentation/conf.py                      | 13 +++++++++++++
 Documentation/translations/index.rst       |  4 ++++
 Documentation/translations/it_IT/index.rst |  4 ++++
 Documentation/translations/ja_JP/index.rst |  5 +++--
 Documentation/translations/ko_KR/index.rst |  5 +++--
 Documentation/translations/zh_CN/index.rst |  1 +
 6 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/Documentation/conf.py b/Documentation/conf.py
index 879e86dbea66..25aa00c707b0 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -371,6 +371,19 @@ if cjk_cmd.find("Noto Sans CJK SC") >= 0:
 	% This is needed for translations
         \\usepackage{xeCJK}
         \\setCJKmainfont{Noto Sans CJK SC}
+	% Define custom macros to on/off CJK
+	\\newcommand{\\kerneldocCJKon}{\\makexeCJKactive}
+	\\newcommand{\\kerneldocCJKoff}{\\makexeCJKinactive}
+	% To customize \sphinxtableofcontents
+	\\usepackage{etoolbox}
+	% Inactivate CJK after tableofcontents
+	\\apptocmd{\\sphinxtableofcontents}{\\kerneldocCJKoff}{}{}
+     '''
+else:
+    latex_elements['preamble']  += '''
+	% Custom macros to on/off CJK (Dummy)
+	\\newcommand{\\kerneldocCJKon}{}
+	\\newcommand{\\kerneldocCJKoff}{}
      '''
 
 # Fix reference escape troubles with Sphinx 1.4.x
diff --git a/Documentation/translations/index.rst b/Documentation/translations/index.rst
index e446e5ed00a6..f07eb317cfba 100644
--- a/Documentation/translations/index.rst
+++ b/Documentation/translations/index.rst
@@ -18,6 +18,10 @@ Translations
 Disclaimer
 ----------
 
+.. raw:: latex
+
+	\kerneldocCJKoff	
+
 Translation's purpose is to ease reading and understanding in languages other
 than English. Its aim is to help people who do not understand English or have
 doubts about its interpretation. Additionally, some people prefer to read
diff --git a/Documentation/translations/it_IT/index.rst b/Documentation/translations/it_IT/index.rst
index bb8fa7346939..e80a3097aa57 100644
--- a/Documentation/translations/it_IT/index.rst
+++ b/Documentation/translations/it_IT/index.rst
@@ -4,6 +4,10 @@
 Traduzione italiana
 ===================
 
+.. raw:: latex
+
+	\kerneldocCJKoff
+
 :manutentore: Federico Vaga <federico.vaga@vaga.pv.it>
 
 .. _it_disclaimer:
diff --git a/Documentation/translations/ja_JP/index.rst b/Documentation/translations/ja_JP/index.rst
index 2f91b895e3c2..f94ba62d41c3 100644
--- a/Documentation/translations/ja_JP/index.rst
+++ b/Documentation/translations/ja_JP/index.rst
@@ -1,7 +1,8 @@
 .. raw:: latex
 
-        \renewcommand\thesection*
-        \renewcommand\thesubsection*
+	\renewcommand\thesection*
+	\renewcommand\thesubsection*
+	\kerneldocCJKon
 
 Japanese translations
 =====================
diff --git a/Documentation/translations/ko_KR/index.rst b/Documentation/translations/ko_KR/index.rst
index b9e27d20b039..6ae258118bdf 100644
--- a/Documentation/translations/ko_KR/index.rst
+++ b/Documentation/translations/ko_KR/index.rst
@@ -1,7 +1,8 @@
 .. raw:: latex
 
-        \renewcommand\thesection*
-        \renewcommand\thesubsection*
+	\renewcommand\thesection*
+	\renewcommand\thesubsection*
+	\kerneldocCJKon
 
 한국어 번역
 ===========
diff --git a/Documentation/translations/zh_CN/index.rst b/Documentation/translations/zh_CN/index.rst
index a736057da41f..1f953d3439a5 100644
--- a/Documentation/translations/zh_CN/index.rst
+++ b/Documentation/translations/zh_CN/index.rst
@@ -4,6 +4,7 @@
 
 	\renewcommand\thesection*
 	\renewcommand\thesubsection*
+	\kerneldocCJKon
 
 .. _linux_doc_zh:
 
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] docs: Activate exCJK only in CJK chapters
  2021-05-25 11:17 ` [PATCH v2] docs: Activate exCJK " Akira Yokosawa
@ 2021-05-25 12:30   ` Wu X.C.
  2021-05-25 12:55     ` Akira Yokosawa
  0 siblings, 1 reply; 12+ messages in thread
From: Wu X.C. @ 2021-05-25 12:30 UTC (permalink / raw)
  To: Akira Yokosawa
  Cc: Mauro Carvalho Chehab, Jonathan Corbet, linux-doc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2760 bytes --]

On Tue, May 25, 2021 at 08:17:26PM +0900, Akira Yokosawa wrote:
> Activating xeCJK in English and Italian-translation documents
> results in sub-optimal typesetting with wide-looking apostrophes
> and quotation marks.
> 
> The xeCJK package provides macros for enabling and disabling its
> effect in the middle of a document, namely \makexeCJKactive and
> \makexeCJKinactive.
> 
> So the goal of this change is to activate xeCJK in the relevant
> chapters in translations.
> 
> To do this:
> 
>     o Define custom macros in the preamble depending on the
>       availability of the "Noto Sans CJK" font so that those
>       macros can be used regardless of the use of xeCJK package.
> 
>     o Patch \sphinxtableofcontents so that xeCJK is inactivated
>       after table of contents.
> 
>     o Embed those custom macros in each language's index.rst file
>       as a ".. raw:: latex" construct.
> 
> Note: A CJK chapter needs \kerneldocCJKon in front of its chapter
> heading, while a non-CJK chapter should have \kerneldocCJKoff
> below its chapter heading.
> 
> This is to make sure the CJK font is available to CJK chapter's
> heading and ending page's footer.
> 
> Signed-off-by: Akira Yokosawa <akiyks@gmail.com>

Test it, worked well.

Tested-by: Wu XiangCheng <bobwxc@email.cn>

And one warning when am patch:

    .git/rebase-apply/patch:62: trailing whitespace.
	    \kerneldocCJKoff


> I think per-directory conf.py can be tried as a follow-up
> change after this patch is applied.

Agree, I think it's enough for this problem.
If we need more complex customization, per-directory conf.py then worth. 

> --- a/Documentation/translations/index.rst
> +++ b/Documentation/translations/index.rst
> @@ -18,6 +18,10 @@ Translations
>  Disclaimer
>  ----------
>  
> +.. raw:: latex
> +
> +	\kerneldocCJKoff	
> +
>  Translation's purpose is to ease reading and understanding in languages other
>  than English. Its aim is to help people who do not understand English or have
>  doubts about its interpretation. Additionally, some people prefer to read
> diff --git a/Documentation/translations/it_IT/index.rst b/Documentation/translations/it_IT/index.rst
> index bb8fa7346939..e80a3097aa57 100644
> --- a/Documentation/translations/it_IT/index.rst
> +++ b/Documentation/translations/it_IT/index.rst
> @@ -4,6 +4,10 @@
>  Traduzione italiana
>  ===================
>  
> +.. raw:: latex
> +
> +	\kerneldocCJKoff
> +
>  :manutentore: Federico Vaga <federico.vaga@vaga.pv.it>
>  
>  .. _it_disclaimer:

And for above two, maybe better to put "raw:: latex" block above the
title, more beautiful, and CJKoff will be done before enter "Italiana"
chapter.

Thanks,
	Wu X.C.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] docs: Activate exCJK only in CJK chapters
  2021-05-25 12:30   ` Wu X.C.
@ 2021-05-25 12:55     ` Akira Yokosawa
  2021-05-25 13:39       ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 12+ messages in thread
From: Akira Yokosawa @ 2021-05-25 12:55 UTC (permalink / raw)
  To: Wu X.C.
  Cc: Mauro Carvalho Chehab, Jonathan Corbet, linux-doc, linux-kernel,
	Akira Yokosawa

On Tue, 25 May 2021 20:30:12 +0800, Wu X.C. wrote:
> On Tue, May 25, 2021 at 08:17:26PM +0900, Akira Yokosawa wrote:
>> Activating xeCJK in English and Italian-translation documents
>> results in sub-optimal typesetting with wide-looking apostrophes
>> and quotation marks.
>>
>> The xeCJK package provides macros for enabling and disabling its
>> effect in the middle of a document, namely \makexeCJKactive and
>> \makexeCJKinactive.
>>
>> So the goal of this change is to activate xeCJK in the relevant
>> chapters in translations.
>>
>> To do this:
>>
>>     o Define custom macros in the preamble depending on the
>>       availability of the "Noto Sans CJK" font so that those
>>       macros can be used regardless of the use of xeCJK package.
>>
>>     o Patch \sphinxtableofcontents so that xeCJK is inactivated
>>       after table of contents.
>>
>>     o Embed those custom macros in each language's index.rst file
>>       as a ".. raw:: latex" construct.
>>
>> Note: A CJK chapter needs \kerneldocCJKon in front of its chapter
>> heading, while a non-CJK chapter should have \kerneldocCJKoff
>> below its chapter heading.
>>
>> This is to make sure the CJK font is available to CJK chapter's
>> heading and ending page's footer.
>>
>> Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
> 
> Test it, worked well.
> 
> Tested-by: Wu XiangCheng <bobwxc@email.cn>

Thanks!

> 
> And one warning when am patch:
> 
>     .git/rebase-apply/patch:62: trailing whitespace.
> 	    \kerneldocCJKoff

Oops, will fix and post v3 soon, with your Tested-by: appended

> 
> 
>> I think per-directory conf.py can be tried as a follow-up
>> change after this patch is applied.
> 
> Agree, I think it's enough for this problem.
> If we need more complex customization, per-directory conf.py then worth. 
> 
>> --- a/Documentation/translations/index.rst
>> +++ b/Documentation/translations/index.rst
>> @@ -18,6 +18,10 @@ Translations
>>  Disclaimer
>>  ----------
>>  
>> +.. raw:: latex
>> +
>> +	\kerneldocCJKoff	
>> +
>>  Translation's purpose is to ease reading and understanding in languages other
>>  than English. Its aim is to help people who do not understand English or have
>>  doubts about its interpretation. Additionally, some people prefer to read
>> diff --git a/Documentation/translations/it_IT/index.rst b/Documentation/translations/it_IT/index.rst
>> index bb8fa7346939..e80a3097aa57 100644
>> --- a/Documentation/translations/it_IT/index.rst
>> +++ b/Documentation/translations/it_IT/index.rst
>> @@ -4,6 +4,10 @@
>>  Traduzione italiana
>>  ===================
>>  
>> +.. raw:: latex
>> +
>> +	\kerneldocCJKoff
>> +
>>  :manutentore: Federico Vaga <federico.vaga@vaga.pv.it>
>>  
>>  .. _it_disclaimer:
> 
> And for above two, maybe better to put "raw:: latex" block above the
> title, more beautiful, and CJKoff will be done before enter "Italiana"
> chapter.

These two are placed there intentionally.

As mentioned in the change log:

>> Note: A CJK chapter needs \kerneldocCJKon in front of its chapter
>> heading, while a non-CJK chapter should have \kerneldocCJKoff
>> below its chapter heading.
>>
>> This is to make sure the CJK font is available to CJK chapter's
>> heading and ending page's footer.

If they are put above chapter titles in the .rst files,
Chinese translation's final page's footer won't be rendered properly.

        Thanks, Akira

> 
> Thanks,
> 	Wu X.C.
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v3] docs: Activate exCJK only in CJK chapters
  2021-05-22  7:28 [PATCH] docs: Activate xeCJK only in CJK chapters Akira Yokosawa
                   ` (2 preceding siblings ...)
  2021-05-25 11:17 ` [PATCH v2] docs: Activate exCJK " Akira Yokosawa
@ 2021-05-25 13:38 ` Akira Yokosawa
  2021-05-25 15:25 ` [PATCH v4] " Akira Yokosawa
  4 siblings, 0 replies; 12+ messages in thread
From: Akira Yokosawa @ 2021-05-25 13:38 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Jonathan Corbet
  Cc: linux-doc, linux-kernel, Wu X.C., Akira Yokosawa

Activating xeCJK in English and Italian-translation documents
results in sub-optimal typesetting with wide-looking apostrophes
and quotation marks.

The xeCJK package provides macros for enabling and disabling its
effect in the middle of a document, namely \makexeCJKactive and
\makexeCJKinactive.

So the goal of this change is to activate xeCJK in the relevant
chapters in translations.

To do this:

    o Define custom macros in the preamble depending on the
      availability of the "Noto Sans CJK" font so that those
      macros can be used regardless of the use of xeCJK package.

    o Patch \sphinxtableofcontents so that xeCJK is inactivated
      after table of contents.

    o Embed those custom macros in each language's index.rst file
      as a ".. raw:: latex" construct.

Note: A CJK chapter needs \kerneldocCJKon in front of its chapter
heading, while a non-CJK chapter should have \kerneldocCJKoff
below its chapter heading.

This is to make sure the CJK font is available to CJK chapter's
heading and ending page's footer.

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
Tested-by: Wu XiangCheng <bobwxc@email.cn>
Link: https://lore.kernel.org/lkml/2061da0a-6ab1-35f3-99c1-dbc415444f37@gmail.com
---
v2 -> v3:

    o Fixed trailing white space
    o Added Tested-By from Wu XiangCheng

--
 Documentation/conf.py                      | 13 +++++++++++++
 Documentation/translations/index.rst       |  4 ++++
 Documentation/translations/it_IT/index.rst |  4 ++++
 Documentation/translations/ja_JP/index.rst |  5 +++--
 Documentation/translations/ko_KR/index.rst |  5 +++--
 Documentation/translations/zh_CN/index.rst |  1 +
 6 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/Documentation/conf.py b/Documentation/conf.py
index 879e86dbea66..25aa00c707b0 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -371,6 +371,19 @@ if cjk_cmd.find("Noto Sans CJK SC") >= 0:
 	% This is needed for translations
         \\usepackage{xeCJK}
         \\setCJKmainfont{Noto Sans CJK SC}
+	% Define custom macros to on/off CJK
+	\\newcommand{\\kerneldocCJKon}{\\makexeCJKactive}
+	\\newcommand{\\kerneldocCJKoff}{\\makexeCJKinactive}
+	% To customize \sphinxtableofcontents
+	\\usepackage{etoolbox}
+	% Inactivate CJK after tableofcontents
+	\\apptocmd{\\sphinxtableofcontents}{\\kerneldocCJKoff}{}{}
+     '''
+else:
+    latex_elements['preamble']  += '''
+	% Custom macros to on/off CJK (Dummy)
+	\\newcommand{\\kerneldocCJKon}{}
+	\\newcommand{\\kerneldocCJKoff}{}
      '''
 
 # Fix reference escape troubles with Sphinx 1.4.x
diff --git a/Documentation/translations/index.rst b/Documentation/translations/index.rst
index e446e5ed00a6..556b050884fc 100644
--- a/Documentation/translations/index.rst
+++ b/Documentation/translations/index.rst
@@ -18,6 +18,10 @@ Translations
 Disclaimer
 ----------
 
+.. raw:: latex
+
+	\kerneldocCJKoff
+
 Translation's purpose is to ease reading and understanding in languages other
 than English. Its aim is to help people who do not understand English or have
 doubts about its interpretation. Additionally, some people prefer to read
diff --git a/Documentation/translations/it_IT/index.rst b/Documentation/translations/it_IT/index.rst
index bb8fa7346939..e80a3097aa57 100644
--- a/Documentation/translations/it_IT/index.rst
+++ b/Documentation/translations/it_IT/index.rst
@@ -4,6 +4,10 @@
 Traduzione italiana
 ===================
 
+.. raw:: latex
+
+	\kerneldocCJKoff
+
 :manutentore: Federico Vaga <federico.vaga@vaga.pv.it>
 
 .. _it_disclaimer:
diff --git a/Documentation/translations/ja_JP/index.rst b/Documentation/translations/ja_JP/index.rst
index 2f91b895e3c2..f94ba62d41c3 100644
--- a/Documentation/translations/ja_JP/index.rst
+++ b/Documentation/translations/ja_JP/index.rst
@@ -1,7 +1,8 @@
 .. raw:: latex
 
-        \renewcommand\thesection*
-        \renewcommand\thesubsection*
+	\renewcommand\thesection*
+	\renewcommand\thesubsection*
+	\kerneldocCJKon
 
 Japanese translations
 =====================
diff --git a/Documentation/translations/ko_KR/index.rst b/Documentation/translations/ko_KR/index.rst
index b9e27d20b039..6ae258118bdf 100644
--- a/Documentation/translations/ko_KR/index.rst
+++ b/Documentation/translations/ko_KR/index.rst
@@ -1,7 +1,8 @@
 .. raw:: latex
 
-        \renewcommand\thesection*
-        \renewcommand\thesubsection*
+	\renewcommand\thesection*
+	\renewcommand\thesubsection*
+	\kerneldocCJKon
 
 한국어 번역
 ===========
diff --git a/Documentation/translations/zh_CN/index.rst b/Documentation/translations/zh_CN/index.rst
index a736057da41f..1f953d3439a5 100644
--- a/Documentation/translations/zh_CN/index.rst
+++ b/Documentation/translations/zh_CN/index.rst
@@ -4,6 +4,7 @@
 
 	\renewcommand\thesection*
 	\renewcommand\thesubsection*
+	\kerneldocCJKon
 
 .. _linux_doc_zh:
 
-- 
2.17.1




^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] docs: Activate exCJK only in CJK chapters
  2021-05-25 12:55     ` Akira Yokosawa
@ 2021-05-25 13:39       ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 12+ messages in thread
From: Mauro Carvalho Chehab @ 2021-05-25 13:39 UTC (permalink / raw)
  To: Akira Yokosawa; +Cc: Wu X.C., Jonathan Corbet, linux-doc, linux-kernel

Em Tue, 25 May 2021 21:55:53 +0900
Akira Yokosawa <akiyks@gmail.com> escreveu:

> On Tue, 25 May 2021 20:30:12 +0800, Wu X.C. wrote:
> > On Tue, May 25, 2021 at 08:17:26PM +0900, Akira Yokosawa wrote:  
> >> Activating xeCJK in English and Italian-translation documents
> >> results in sub-optimal typesetting with wide-looking apostrophes
> >> and quotation marks.
> >>
> >> The xeCJK package provides macros for enabling and disabling its
> >> effect in the middle of a document, namely \makexeCJKactive and
> >> \makexeCJKinactive.
> >>
> >> So the goal of this change is to activate xeCJK in the relevant
> >> chapters in translations.
> >>
> >> To do this:
> >>
> >>     o Define custom macros in the preamble depending on the
> >>       availability of the "Noto Sans CJK" font so that those
> >>       macros can be used regardless of the use of xeCJK package.
> >>
> >>     o Patch \sphinxtableofcontents so that xeCJK is inactivated
> >>       after table of contents.
> >>
> >>     o Embed those custom macros in each language's index.rst file
> >>       as a ".. raw:: latex" construct.
> >>
> >> Note: A CJK chapter needs \kerneldocCJKon in front of its chapter
> >> heading, while a non-CJK chapter should have \kerneldocCJKoff
> >> below its chapter heading.
> >>
> >> This is to make sure the CJK font is available to CJK chapter's
> >> heading and ending page's footer.
> >>
> >> Signed-off-by: Akira Yokosawa <akiyks@gmail.com>  
> > 
> > Test it, worked well.
> > 
> > Tested-by: Wu XiangCheng <bobwxc@email.cn>  
> 
> Thanks!
> 
> > 
> > And one warning when am patch:
> > 
> >     .git/rebase-apply/patch:62: trailing whitespace.
> > 	    \kerneldocCJKoff  
> 
> Oops, will fix and post v3 soon, with your Tested-by: appended

You can also add:

Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

(but see below)


> 
> > 
> >   
> >> I think per-directory conf.py can be tried as a follow-up
> >> change after this patch is applied.  
> > 
> > Agree, I think it's enough for this problem.
> > If we need more complex customization, per-directory conf.py then worth. 

Well, this change seems good enough to me and it avoids the
need of adding a separate conf.py.

The only thing that concerns me is if this logic works with
all Sphinx versions. I guess it should, but there were some
changes in the past with the LaTeX output module which
broke on newer versions, as different versions of Sphinx use
different .

So, this patch needs to be tested against the minimal version recommended
for PDF output (2.4.4) and against the latest one, to be 100% sure that
it won't cause any breakages.

You can test it with something like:

	$ /usr/bin/python3 -m venv sphinx_foo
	$ . sphinx_foo/bin/activate
	$ pip install docutils Sphinx==2.4.4 sphinx_rtd_theme
	$ make pdfdocs
...
	# Should install Latest version, e. g. currently, Sphinx 4.0.2
	$ pip uninstall Sphinx
	$ pip install docutils Sphinx sphinx_rtd_theme
	$ make pdfdocs

(That's said, I didn't test version 4.0 yet... not sure if
everything would work fine, even without this change)

Regards,
Mauro

> >   
> >> --- a/Documentation/translations/index.rst
> >> +++ b/Documentation/translations/index.rst
> >> @@ -18,6 +18,10 @@ Translations
> >>  Disclaimer
> >>  ----------
> >>  
> >> +.. raw:: latex
> >> +
> >> +	\kerneldocCJKoff	
> >> +
> >>  Translation's purpose is to ease reading and understanding in languages other
> >>  than English. Its aim is to help people who do not understand English or have
> >>  doubts about its interpretation. Additionally, some people prefer to read
> >> diff --git a/Documentation/translations/it_IT/index.rst b/Documentation/translations/it_IT/index.rst
> >> index bb8fa7346939..e80a3097aa57 100644
> >> --- a/Documentation/translations/it_IT/index.rst
> >> +++ b/Documentation/translations/it_IT/index.rst
> >> @@ -4,6 +4,10 @@
> >>  Traduzione italiana
> >>  ===================
> >>  
> >> +.. raw:: latex
> >> +
> >> +	\kerneldocCJKoff
> >> +
> >>  :manutentore: Federico Vaga <federico.vaga@vaga.pv.it>
> >>  
> >>  .. _it_disclaimer:  
> > 
> > And for above two, maybe better to put "raw:: latex" block above the
> > title, more beautiful, and CJKoff will be done before enter "Italiana"
> > chapter.  
> 
> These two are placed there intentionally.
> 
> As mentioned in the change log:
> 
> >> Note: A CJK chapter needs \kerneldocCJKon in front of its chapter
> >> heading, while a non-CJK chapter should have \kerneldocCJKoff
> >> below its chapter heading.
> >>
> >> This is to make sure the CJK font is available to CJK chapter's
> >> heading and ending page's footer.  
> 
> If they are put above chapter titles in the .rst files,
> Chinese translation's final page's footer won't be rendered properly.
> 
>         Thanks, Akira
> 
> > 
> > Thanks,
> > 	Wu X.C.
> >   



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v4] docs: Activate exCJK only in CJK chapters
  2021-05-22  7:28 [PATCH] docs: Activate xeCJK only in CJK chapters Akira Yokosawa
                   ` (3 preceding siblings ...)
  2021-05-25 13:38 ` [PATCH v3] " Akira Yokosawa
@ 2021-05-25 15:25 ` Akira Yokosawa
  2021-05-27 16:00   ` Jonathan Corbet
  4 siblings, 1 reply; 12+ messages in thread
From: Akira Yokosawa @ 2021-05-25 15:25 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Jonathan Corbet
  Cc: linux-doc, linux-kernel, Wu X.C., Akira Yokosawa

Activating xeCJK in English and Italian-translation documents
results in sub-optimal typesetting with wide-looking apostrophes
and quotation marks.

The xeCJK package provides macros for enabling and disabling its
effect in the middle of a document, namely \makexeCJKactive and
\makexeCJKinactive.

So the goal of this change is to activate xeCJK in the relevant
chapters in translations.

To do this:

    o Define custom macros in the preamble depending on the
      availability of the "Noto Sans CJK" font so that those
      macros can be used regardless of the use of xeCJK package.

    o Patch \sphinxtableofcontents so that xeCJK is inactivated
      after table of contents.

    o Embed those custom macros in each language's index.rst file
      as a ".. raw:: latex" construct.

Note: A CJK chapter needs \kerneldocCJKon in front of its chapter
heading, while a non-CJK chapter should have \kerneldocCJKoff
below its chapter heading.

This is to make sure the CJK font is available to CJK chapter's
heading and ending page's footer.

Tested against Sphinx versions 2.4.4 and 4.0.2.

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
Tested-by: Wu XiangCheng <bobwxc@email.cn>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/lkml/2061da0a-6ab1-35f3-99c1-dbc415444f37@gmail.com
---
v3 -> v4: (Change log update)

    o Added Reviewed-by from Mauro
    o Added note on Sphinx versions (2.4.4 and 4.0.2) tested against

v2 -> v3:

    o Fixed trailing white space
    o Added Tested-By from Wu XiangCheng
--
 Documentation/conf.py                      | 13 +++++++++++++
 Documentation/translations/index.rst       |  4 ++++
 Documentation/translations/it_IT/index.rst |  4 ++++
 Documentation/translations/ja_JP/index.rst |  5 +++--
 Documentation/translations/ko_KR/index.rst |  5 +++--
 Documentation/translations/zh_CN/index.rst |  1 +
 6 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/Documentation/conf.py b/Documentation/conf.py
index 879e86dbea66..25aa00c707b0 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -371,6 +371,19 @@ if cjk_cmd.find("Noto Sans CJK SC") >= 0:
 	% This is needed for translations
         \\usepackage{xeCJK}
         \\setCJKmainfont{Noto Sans CJK SC}
+	% Define custom macros to on/off CJK
+	\\newcommand{\\kerneldocCJKon}{\\makexeCJKactive}
+	\\newcommand{\\kerneldocCJKoff}{\\makexeCJKinactive}
+	% To customize \sphinxtableofcontents
+	\\usepackage{etoolbox}
+	% Inactivate CJK after tableofcontents
+	\\apptocmd{\\sphinxtableofcontents}{\\kerneldocCJKoff}{}{}
+     '''
+else:
+    latex_elements['preamble']  += '''
+	% Custom macros to on/off CJK (Dummy)
+	\\newcommand{\\kerneldocCJKon}{}
+	\\newcommand{\\kerneldocCJKoff}{}
      '''
 
 # Fix reference escape troubles with Sphinx 1.4.x
diff --git a/Documentation/translations/index.rst b/Documentation/translations/index.rst
index e446e5ed00a6..556b050884fc 100644
--- a/Documentation/translations/index.rst
+++ b/Documentation/translations/index.rst
@@ -18,6 +18,10 @@ Translations
 Disclaimer
 ----------
 
+.. raw:: latex
+
+	\kerneldocCJKoff
+
 Translation's purpose is to ease reading and understanding in languages other
 than English. Its aim is to help people who do not understand English or have
 doubts about its interpretation. Additionally, some people prefer to read
diff --git a/Documentation/translations/it_IT/index.rst b/Documentation/translations/it_IT/index.rst
index bb8fa7346939..e80a3097aa57 100644
--- a/Documentation/translations/it_IT/index.rst
+++ b/Documentation/translations/it_IT/index.rst
@@ -4,6 +4,10 @@
 Traduzione italiana
 ===================
 
+.. raw:: latex
+
+	\kerneldocCJKoff
+
 :manutentore: Federico Vaga <federico.vaga@vaga.pv.it>
 
 .. _it_disclaimer:
diff --git a/Documentation/translations/ja_JP/index.rst b/Documentation/translations/ja_JP/index.rst
index 2f91b895e3c2..f94ba62d41c3 100644
--- a/Documentation/translations/ja_JP/index.rst
+++ b/Documentation/translations/ja_JP/index.rst
@@ -1,7 +1,8 @@
 .. raw:: latex
 
-        \renewcommand\thesection*
-        \renewcommand\thesubsection*
+	\renewcommand\thesection*
+	\renewcommand\thesubsection*
+	\kerneldocCJKon
 
 Japanese translations
 =====================
diff --git a/Documentation/translations/ko_KR/index.rst b/Documentation/translations/ko_KR/index.rst
index b9e27d20b039..6ae258118bdf 100644
--- a/Documentation/translations/ko_KR/index.rst
+++ b/Documentation/translations/ko_KR/index.rst
@@ -1,7 +1,8 @@
 .. raw:: latex
 
-        \renewcommand\thesection*
-        \renewcommand\thesubsection*
+	\renewcommand\thesection*
+	\renewcommand\thesubsection*
+	\kerneldocCJKon
 
 한국어 번역
 ===========
diff --git a/Documentation/translations/zh_CN/index.rst b/Documentation/translations/zh_CN/index.rst
index a736057da41f..1f953d3439a5 100644
--- a/Documentation/translations/zh_CN/index.rst
+++ b/Documentation/translations/zh_CN/index.rst
@@ -4,6 +4,7 @@
 
 	\renewcommand\thesection*
 	\renewcommand\thesubsection*
+	\kerneldocCJKon
 
 .. _linux_doc_zh:
 
-- 
2.17.1




^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v4] docs: Activate exCJK only in CJK chapters
  2021-05-25 15:25 ` [PATCH v4] " Akira Yokosawa
@ 2021-05-27 16:00   ` Jonathan Corbet
  0 siblings, 0 replies; 12+ messages in thread
From: Jonathan Corbet @ 2021-05-27 16:00 UTC (permalink / raw)
  To: Akira Yokosawa, Mauro Carvalho Chehab
  Cc: linux-doc, linux-kernel, Wu X.C., Akira Yokosawa

Akira Yokosawa <akiyks@gmail.com> writes:

> Activating xeCJK in English and Italian-translation documents
> results in sub-optimal typesetting with wide-looking apostrophes
> and quotation marks.
>
> The xeCJK package provides macros for enabling and disabling its
> effect in the middle of a document, namely \makexeCJKactive and
> \makexeCJKinactive.
>
> So the goal of this change is to activate xeCJK in the relevant
> chapters in translations.
>
> To do this:
>
>     o Define custom macros in the preamble depending on the
>       availability of the "Noto Sans CJK" font so that those
>       macros can be used regardless of the use of xeCJK package.
>
>     o Patch \sphinxtableofcontents so that xeCJK is inactivated
>       after table of contents.
>
>     o Embed those custom macros in each language's index.rst file
>       as a ".. raw:: latex" construct.
>
> Note: A CJK chapter needs \kerneldocCJKon in front of its chapter
> heading, while a non-CJK chapter should have \kerneldocCJKoff
> below its chapter heading.
>
> This is to make sure the CJK font is available to CJK chapter's
> heading and ending page's footer.
>
> Tested against Sphinx versions 2.4.4 and 4.0.2.
>
> Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
> Tested-by: Wu XiangCheng <bobwxc@email.cn>
> Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> Link: https://lore.kernel.org/lkml/2061da0a-6ab1-35f3-99c1-dbc415444f37@gmail.com

I've applied this, thanks.

jon

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-05-27 16:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-22  7:28 [PATCH] docs: Activate xeCJK only in CJK chapters Akira Yokosawa
2021-05-22 16:56 ` Wu X.C.
2021-05-22 23:35   ` Akira Yokosawa
2021-05-22 18:14 ` Mauro Carvalho Chehab
2021-05-22 23:21   ` Akira Yokosawa
2021-05-25 11:17 ` [PATCH v2] docs: Activate exCJK " Akira Yokosawa
2021-05-25 12:30   ` Wu X.C.
2021-05-25 12:55     ` Akira Yokosawa
2021-05-25 13:39       ` Mauro Carvalho Chehab
2021-05-25 13:38 ` [PATCH v3] " Akira Yokosawa
2021-05-25 15:25 ` [PATCH v4] " Akira Yokosawa
2021-05-27 16:00   ` Jonathan Corbet

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).