Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2252578pxj; Sat, 22 May 2021 16:33:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZatFvH/dW0ailejqT+gzMrgA3l+1qAN2GDEJmwbBhXbATwlc5rbulmJEaA9WOqaxPTUCD X-Received: by 2002:a5e:c742:: with SMTP id g2mr7252735iop.40.1621726432950; Sat, 22 May 2021 16:33:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621726432; cv=none; d=google.com; s=arc-20160816; b=drWZdfAP3Zwf/ioWYsJrkFmOaLFyfttq3LNjY0jyzCE03bBpj56wEkAP/G3wL8rquC CI/HTGiNoNDfJ1N7mOKpfbwyickDS5HVgazxpi1fYbxgKEA3tKaP3X/kC3lYNYbiLPHz ypphvqqBcolcP0gzGIkJVk1oIbTnfMIlvQIgUhpk4YfPiZp4Owy7aiYv545MRWzGDyy2 d9AJdsFHg0q8uHnRrzMqS7C3tRvNRXELXpNj78MM6ugGmCadVB6qmnyeLxhuKd2Y+hqN yCfY419///dnN5/O7ulu0i/RtaAeKN4aY9tB+PQuAUrrbMDgyU/H/ezx8g69LKctwHCd XR7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=UZUgAfQG09nzgaNT4bquHKxvVYQl+/q8c6+ebXr3LM0=; b=cohuel5YLT7mSwjQ6VOezXVVentIP0+rCGXT90Y5TheJijuIU4ZGlteFEaAoBKoLAO QF8SCbbUTJP9WIVCe93veCIbpRSkwD8NCdFaGtV4hIV3KiGyustaaQcqmHNPU1n03UhF zchJ+KvcVJ7Z8szRynMQViW69DX15CYc+ljO5juBcEtMhvU6Um7qboFBXHaOGCZ9nE/t J3qTnxA1O+qsrxDJmQK9bucm1DUoRwvtIpdnAgFuRZ66imugKSw73bE/K/9DyqlktwWC 1sm8qOFcjJ/6frFsBv1Wndk6gqrbK6cSRCgbMp49nYeBNwJvtdhYsem4XrzJYC35hy4h mEYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DPRmeXsi; 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 t10si9816730ilj.54.2021.05.22.16.33.08; Sat, 22 May 2021 16:33:52 -0700 (PDT) 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=20161025 header.b=DPRmeXsi; 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 S231458AbhEVXXL (ORCPT + 99 others); Sat, 22 May 2021 19:23:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231451AbhEVXXK (ORCPT ); Sat, 22 May 2021 19:23:10 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28862C061574; Sat, 22 May 2021 16:21:44 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id j12so17246134pgh.7; Sat, 22 May 2021 16:21:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=UZUgAfQG09nzgaNT4bquHKxvVYQl+/q8c6+ebXr3LM0=; b=DPRmeXsijRUjcD/4rGNFdCr2+NmFXQJdgToQjAauX0OAqs0tgF1fLY6YkKUMDJXxUO iNnZVFoCrZuveD1mQRm/OendTSfMkWwOraKY8DIcgbx4J2fityuNnI53ljCyBprd5l3V MBvfj3/qNujiSeSiLQbYJYWrg8Bf+HlE9QPDstQHM+91LvDo4rLMbR9Ab2fv7kpJf/PI +xax/4Wdx7kPRURnawYwrouEdPY7+hqH/2JsP4c9rCdU7HQt60FHWKAu5CNIYZ0fywII oREvnHE5LxSZQeegy+INvMx/R1yh4LeDD8Aog8FyUix9uRlk0g4CTODByd1L/7yMAuQo dvnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=UZUgAfQG09nzgaNT4bquHKxvVYQl+/q8c6+ebXr3LM0=; b=mDDFAYiutgEKhnUNUZdhZzrmjrS91qX3bxUT/lcXJzb5Gh7kjQwQkgeuUm7IzPxCA1 3pvx0HPmfyAp3Cw4yAYUiQGFHDErSEv2wY9sScHo7nEUvFYwqS5za9hwTpBVya4z/6ZO NGffU63AWIQyTK4SN0j7gAnlcvTz0vcBUnLd8ZSXbS2xtivhrV0YSzRw1tLxriH+9eza f4z+RgNzk0kz+EXwy8W9PaK62WU4PLoOnZYNhi7VxFAskahnk2Mzy92hvx1zYAhwq8bf /YqC3+SnkArNf0s5ISvtC7Q+TnXeV3YuzYi2iFJGLc54XstkR9sOJnLqgHijwRihnBb3 21bg== X-Gm-Message-State: AOAM531uf89D+swcjpCMi30/5z6/8yWkjq7dz1y9TpChrurWgbEM90cO wjjgQfZcRBt/CYQ5oULpdqc= X-Received: by 2002:a05:6a00:2394:b029:2e0:a27:ba26 with SMTP id f20-20020a056a002394b02902e00a27ba26mr17190265pfc.63.1621725704227; Sat, 22 May 2021 16:21:44 -0700 (PDT) Received: from [192.168.11.2] (KD106167171201.ppp-bb.dion.ne.jp. [106.167.171.201]) by smtp.gmail.com with ESMTPSA id o24sm7804591pgl.55.2021.05.22.16.21.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 22 May 2021 16:21:43 -0700 (PDT) Subject: Re: [PATCH] docs: Activate xeCJK only in CJK chapters To: Mauro Carvalho Chehab Cc: Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Akira Yokosawa References: <2061da0a-6ab1-35f3-99c1-dbc415444f37@gmail.com> <20210522201439.156bded8@coco.lan> From: Akira Yokosawa Message-ID: <1bb6a68a-70cb-3f3a-462b-5ad124d0253e@gmail.com> Date: Sun, 23 May 2021 08:21:40 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210522201439.156bded8@coco.lan> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 22 May 2021 20:14:39 +0200, Mauro Carvalho Chehab wrote: > Em Sat, 22 May 2021 16:28:55 +0900 > Akira Yokosawa 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 >