4

I’m writing a multilingual document using XeLaTeX, the scrreprt document class, and the XeCJK and microtype packages (loaded in that order).

MWE (with the font properly installed on my system):

\documentclass{scrreprt}
\usepackage{xeCJK}
\setCJKmainfont{Noto Serif CJK SC}
\usepackage{microtype}
\begin{document}
This sentence is short.
这句话很短。
\end{document}

I get the following warning (but only when there’s Chinese text):

Package microtype Warning: One or more slots in the configuration are unknown.
(microtype)                Make sure that no text commands are used.
(microtype)                See the documentation for details (the note
(microtype)                on `xeCJK' in section 9: `Hints and caveats').

The relevant part of the note (microtype documentation p. 27) reads:

When used with the xeCJK package or the luatexja package, text commands (e.g., \’A, \textless) in the configuration will not be understood. You therefore have to ensure that microtype will encounter none of them. This requires, firstly, that the glyphs be specified only as single (possibly Unicode) characters, as numbers, or as glyph names (cf. section 5); and secondly, if you are using a font for which pre-defined settings do not exist, that you create these settings yourself (because otherwise, the default settings will be loaded, which do contain text commands). Furthermore, you should load microtype late.

While “slots” are defined thusly (p. 12):

The characters may be specified either as a single letter (A), as a text symbol command (\textquoteleft), or as a slot number (resp. Unicode number for LuaTeX or XeTeX): three or more digits for decimal notation, prefixed with " for hexadecimal, with ’ for octal numerals (e.g., the ‘fl’ ligature in T1 encoding: 029, "1D, ’35).

Every single character in my MWE is input in UTF-8 encoding, and as far as I understand the above passages, microtype should have nothing to complain about. What is meant by “One or more slots in the configuration are unknown” and by “text commands”? Could the following section be the root of the problem?

if you are using a font for which pre-defined settings do not exist, that you create these settings yourself (because otherwise, the default settings will be loaded, which do contain text commands).

How can I know if pre-defined settings exist, or how can I create such settings, or how can I otherwise solve the issue?

6

You can setup the protrusion for your font, then microtype won't try to use the setting for the roman font instead (and don't have your font here, so I used another one):

\documentclass{scrreprt}
\usepackage{xeCJK}
\setCJKmainfont{Microsoft YaHei}
\usepackage{microtype}

\SetProtrusion
   { encoding = {TU},
     family   = Microsoft YaHei }
   {}

\begin{document}
This sentence is short.
这句话很短。
\end{document}

Edit

The Noto font has a different character set and with it one should also overwrite the inheritance list:

\documentclass{scrreprt}
\usepackage{xeCJK}
\setCJKmainfont{Noto Serif CJK SC}%{NotoSerifCJKsc-Regular.otf}[NFSSFamily=notofamily]
\usepackage{microtype}
\DeclareCharacterInheritance
   { encoding = {TU},
    family = NotoSerifCJKSC }
   {}

\SetProtrusion
   { encoding = {TU},
     family   = NotoSerifCJKSC
   }
   {}
\begin{document}

This sentence is short. 
这句话很短。
\end{document}

The settings can be put in a file named mt-NotoSerifCJKSC.cfg.

  • I do not have that font, and the solution did not work on my system when I replaced Microsoft YaHei with Noto Serif CJK SC. Maybe it is a problem with my font configuration (though the font is displayed correctly). – Philipp May 4 '18 at 14:00
  • I can check with the Noto font in a few minutes when I'm on another pc. – Ulrike Fischer May 4 '18 at 14:02
  • I edited the answer for the Noto font. – Ulrike Fischer May 4 '18 at 15:07
  • Thank you for your time and effort! This solution works in the MWE, but not in my real document. There, it remains as before. It must have to do with my configuration. – Philipp May 4 '18 at 19:50
  • There probably is a conflict somewhere in the preamble, but this would exceed this site’s purpose. Since the fonts do work despite the warning, I’ll ignore the warning from here on. – Philipp May 5 '18 at 7:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.