6
  • I want to mix Chinese an English in one document.
  • For each languages, I will use paragraphs (not just short sentences).
  • I want to use Google's Noto fonts.
  • The problem is, that the Latin characters look different when I use English within a Chinese environment.
  • When I replace \babelfont{rm}{Noto Serif} with \babelfont{english}{Noto Serif}, then the result is different but still not ok.
  • My goal is, to have the same Latin characters (same font) in both, English and Chinese environment

\documentclass{article}

\usepackage[english]{babel}
% babelprovide for *english* (default language of the document)
\babelprovide[
    main,
    import,
    language = Default]
    {english}

% babelprovide for *chinese-simplified*
\babelprovide[
    import,
    language = Chinese Simplified]
    {chinese-simplified}

%% Choose actual fonts for different font variants.
\babelfont{rm}{Noto Serif}
%\babelfont{english}{Noto Serif}
\babelfont[chinese-simplified]{rm}{Noto Serif CJK SC}

\begin{document}

\selectlanguage{english}ABCabc
\selectlanguage{chinese-simplified}ABCabc

\end{document}

enter image description here


%\babelfont{rm}{Noto Serif}
\babelfont{english}{Noto Serif}

enter image description here


Related: babel: Mixing English and Chinese Using Google NotoFonts

4 Answers4

3

You could try the (new) multiscript option. But you will get a few warning from fontspec:

\documentclass{article}


\usepackage[english]{babel}
% babelprovide for *english* (default language of the document)
\babelprovide[
    main,
    import,
    language = Default]
    {english}

% babelprovide for *chinese-simplified*
\babelprovide[
    import,
    language = Chinese Simplified]
    {chinese-simplified}
\directlua{
luaotfload.add_multiscript
 ("latn-hani",
  {
    Hani = "Noto Serif CJK SC:mode=node;script=hani;",
  }
 )
}
\babelfont{rm}[RawFeature={multiscript=latn-hani}]{Noto Serif}


\begin{document}

\selectlanguage{english}ABCabc 你好
\selectlanguage{chinese-simplified}ABCabc 你好

\end{document}

enter image description here

Ulrike Fischer
  • 327,261
  • Thanks for the answer. Can you explain why I get the described problem? Or, is there another (best practice) way without luaotfload.add_multiscript? I am still hoping, that there is a "easy" solution :). Maybe if I only use the Chinese font for English and Chinese?! – Dr. Manuel Kuehner Mar 02 '20 at 20:03
  • 1
    well obviously Noto Serif and Noto Serif CJK SC are different. If you want the same font you will have to use the same font. Always using Noto Serif CJK SC will probably work too. – Ulrike Fischer Mar 02 '20 at 20:05
  • I see. Do you understand why \babelfont{rm} and \babelfont{english} give a different result? – Dr. Manuel Kuehner Mar 02 '20 at 20:24
  • 2
    \babelfont{english}{Noto Serif} is the wrong syntax, you meant \babelfont[english]{rm}{Noto Serif} – Ulrike Fischer Mar 02 '20 at 20:35
  • Thanks - that's embarrassing for me... I wait if there's another approach before I accept your answer. I am still confused, that the Noto font uses different Latin "fonts". – Dr. Manuel Kuehner Mar 02 '20 at 20:37
  • I accepted the answer from the babel maintainer. I really appreciate your help. – Dr. Manuel Kuehner Mar 07 '20 at 10:19
3

It is indeed the case that the Latin glyphs from "Noto Serif CJK SC" is notably lighter than the corresponding weights from "Noto Serif". I am not aware of any documents explaining this design choice. However, it is worth noting that the Latin glyphs from "Noto Serif" would look like a (slight) emphasis within a span of Chinese text. One can see this in Ulrike's answer. An alternative is to explicitly mark the Latin characters with a language:

ABCabc

{\selectlanguage{chinese-simplified} 简化字总表 ABCabc 简化字总表}

{\selectlanguage{chinese-simplified} 简化字总表 \foreignlanguage{english}{ABCabc} 简化字总表}

ABCabc

enter image description here

In the second line, the Latin text blends into the Chinese text while it stands out in the third line.

Now Noto comes win many different weights. If CJK-Regular is lighter than Latin-Regular, we can try to combine CJK-Regular with Latin-Light:

\documentclass{article}

\usepackage[english]{babel}
% babelprovide for *english* (default language of the document)
\babelprovide[
    main,
    import,
    language = Default]
    {english}

% babelprovide for *chinese-simplified*
\babelprovide[
    import,
    language = Chinese Simplified]
    {chinese-simplified}

%% Choose actual fonts for different font variants.
\babelfont{rm}[
  UprightFont=*-Light,
  BoldFont=*-Medium,
]{Noto Serif}
\babelfont[chinese-simplified]{rm}{Noto Serif CJK SC}

\begin{document}

ABCabc

{\selectlanguage{chinese-simplified} 简化字总表 ABCabc 简化字总表}

{\selectlanguage{chinese-simplified} 简化字总表 \foreignlanguage{english}{ABCabc} 简化字总表}

ABCabc

\end{document}

enter image description here

The match is not perfect, but quite close. In principle it would also be possible to choose a slightly darker CJK. I do not have those installed right now, though.

Ralf Stubner
  • 2,614
3

To expand on the latin-in-chinese topic:

Two parts:

The first part is that Babel does not change the font according to which Unicode block the glyphs are in, like package ucharclasses does. Addendum: But see the comment about recent Babel.

The second part is that Noto Serif CJK SC contains some non-CJK glyphs as well.

Noto Serif has glyphs for Latin, Cyrillic, Greek, and a few other things.

Noto Serif CJK SC has the main parts of Latin, Cyrillic and Greek, as well as hiragana, katakana, hangul, bopomofo, and of course a large part of CJK.

noto compare

ucharclasses:

ucharclasses

MWE

\documentclass[12pt]{article}
\usepackage{xcolor}
\pagecolor{red!3}
\usepackage{fontspec}
\newfontface\fcjk{Noto Serif CJK SC}
\newfontfamily\feng{Noto Serif}

\usepackage[CJK]{ucharclasses}
\setTransitionsForCJK{\fcjk}{\feng}

\begin{document}
\large
{\color{blue}Noto Serif}

\feng 
\begin{tabular}{rl}
Latin & ABC abc \\
Currency symbols & ₣₤₥₦₧₨ \\
Cyrillic  & ЄДФЦжцабвг \\
Greek & ΣΤΥΦζεδγβα  \\
IPA \& Phonetic & ɐɠɰʁ ᴟᴞᴣᴇᴈᴗ \\
Letterlike Symbols & ℜℏ℈℃ℓℒ™ℵ⅀ \\
Modifier Tones & ꜀꜂꜈꜉꜊꜋꜌ꜗꜘꜙ \\
etc & ... \\
\end{tabular} 
\bigskip

\rmfamily
{\color{blue}Noto Serif CJK SC}

\fcjk
\begin{tabular}{rl}
Bopomofo & ㄆㄇㄈㄉㄊ \\
Box Drawing & ┢┤┩╆ \\
CJK & 㑣㐦㐧㕔 \\
some Latin & ABC abc \\
some Cyrillic  & ЄДФЦжцабвг \\
some Greek & ΣΤΥΦζεδγβα  \\
Hangul &  ᅣᅦᄄᆻ \\
Hiragana & あいいうえおかが \\
Katakana & アイウエオカガ \\
Letterlike Symbols & ℜℏ℈℃ℓℒ™ℵ⅀ \\
etc & ... \\
\end{tabular} 
\bigskip

\feng
\textit{ucharclasses}: {\small Changing fonts without having to insert font-changing code} -- Latin text. Chinese text: 紫薇北斗星  Modern Greek: Διαμ πριμα εσθ ατ, κυο πχιλωσοπηια Ancient Greek: Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος. And regular latin text.

\end{document}
Cicada
  • 10,129
  • Thanks a lot, I like the red!3 for the page color. Can I combine your approach with the standard babel usage (changing default values for "Figure" etc. and for hyphenations)? – Dr. Manuel Kuehner Mar 03 '20 at 13:51
  • 2
    The following is no longer true: “The first part is that Babel does not change the font according to which Unicode block the glyphs are in”. From 3.38 on it changes not only the font but also the line breaking rules. – Javier Bezos Mar 03 '20 at 15:38
  • 1
    @Dr.ManuelKuehner Try it. (The Latin glyphs in Noto Serif CJK SC are different to the Latin glyphs in Noto Serif - that's all. They are designed for use in the Chinese locale, I expect, whereas your locale is a Western one. Same with the Greek and Cyrillic glyphs.) – Cicada Mar 04 '20 at 12:04
  • I accepted the answer from the babel maintainer. I really appreciate your help. – Dr. Manuel Kuehner Mar 07 '20 at 10:18
2

With a recent babel (see What's new in babel-3.38), you just have to tell it to switch the language (the line breaking rules) and the font based on the script in the following way :

\documentclass{article}

\usepackage[english]{babel}

% Don't reload english, just modify it to switch the language and the
% font depending of the script:    
\babelprovide[onchar=ids fonts]{english}

\babelprovide[
    import,
    language = Chinese Simplified]
    {chinese-simplified}

%% Choose actual fonts for different font variants.
\babelfont{rm}{Noto Serif}
\babelfont[chinese-simplified]{rm}{Noto Serif CJK SC}

\begin{document}

\selectlanguage{english}ABCabc
\selectlanguage{chinese-simplified}ABCabc

\end{document}
Javier Bezos
  • 10,003
  • +1: I don't have access to a computer at the moment. I will test it out. – Dr. Manuel Kuehner Mar 03 '20 at 15:39
  • Will the Latin letters look the same? – Dr. Manuel Kuehner Mar 03 '20 at 15:40
  • What happens for chars which are shared between scripts, e.g. punctuation? – Ulrike Fischer Mar 03 '20 at 15:45
  • @UlrikeFischer They will be those in the current language as set by the babel selectors. If for some reason you want to reassign them, you can use \babelcharproperty. – Javier Bezos Mar 03 '20 at 15:48
  • 1
    @Dr.ManuelKuehner Sure, because the font is the same. Actually, you can switch the font in the English part to the Chinese one, too, if you add onchar=ids fonts to the second \babelprovide. – Javier Bezos Mar 03 '20 at 15:55
  • Nice to have, not important: Can you add a shot explanation of onchar=ids fonts? I can look it up myself once I have computer access again. – Dr. Manuel Kuehner Mar 03 '20 at 16:18
  • 1
    From the manual, about onchar: This option is much like an ‘event’ called when a character belonging to the script of this locale is found. There are currently two ‘actions’ [...]: with ids the \language and the \localeid are set to the values of this locale; with fonts, the fonts are changed to those of this locale (as set with \babelfont). – Javier Bezos Mar 03 '20 at 16:24
  • Does babel have the possibility to donate some money, PayPal for example? – Dr. Manuel Kuehner Mar 03 '20 at 16:37
  • Last question: Would it be worth to open a new question in which I would like to ask babel not to interfere with the toc file? See https://tex.stackexchange.com/questions/522123/babel-babeltoc-causing-problem – Dr. Manuel Kuehner Mar 03 '20 at 16:39
  • 1
    @Dr.ManuelKuehner Donations are most welcome, of course. babel is part of the LaTeX Project. See https://www.tug.org/donate.html . – Javier Bezos Mar 03 '20 at 17:00