2

In the following LuaLaTeX MWE I am using protrusion, but it doesn't work for the cyrillic dash "--- (it is a babel shortand) while working for the normal one.

\documentclass[10pt,draft]{scrbook}

\usepackage[showframe,textwidth=5cm]{geometry}

\usepackage{polyglossia}


\defaultfontfeatures{Ligatures=TeX}
\setmainlanguage[babelshorthands=true]{russian}

\usepackage[protrusion=true,expansion=true,final]{microtype}

\setmainfont{STIX Two Text}

\SetProtrusion[%
name        =   *]{%
    encoding    =   {*},
    family      =   {*}
}{%
    \textemdash         =   {0,250},% ~---
}

\begin{document}

    \noindent%
    ББББББББ ББББББ БББ ББББ "--- ГГГГ

    \noindent%
    ББББББББ ББББББ БББ ББББ~--- ГГГГ

\end{document}

The output is the following:

enter image description here

If I insert the line \cyrdash={0,250} in the protusion list, I get the warning

Package microtype Warning: Unknown slot number of character
(microtype)                `\cyrdash '
(microtype)                in font encoding `TU' in protrusion list
(microtype)                `*'.
2

The construction "--- ultimately becomes \cyrdash, which is defined to be

\hbox to 0.8em{--\hss--}

which means two en-dashes superimposed to occupy a space of 0.8em.

If you set protrusion for the en-dash, you get also protrusion for \cyrdash.

Here the value is exaggerated in order to show that protrusion is done.

\documentclass[10pt,draft]{scrbook}

\usepackage[showframe,textwidth=5cm]{geometry}

\usepackage{polyglossia}

\setmainlanguage[babelshorthands=true]{russian}

\usepackage[protrusion=true,expansion=true,final]{microtype}

\setmainfont{STIX Two Text}

\SetProtrusion[name = *]{
  encoding = {*},
  family   = {*}
}{
  \textemdash = {0,250},
  \textendash = {0,1000}, % 1000 is obviously too much!
}

\begin{document}

\noindent%
ББББББББ ББББББ БББ ББББ "--- ГГГГ

\noindent
ББББББББ ББББББ БББ ББББ~--- ГГГГ

\end{document}

enter image description here

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.