2

There is the command "--- (Cyrillic emdash) defined in the babel package (for the Russian language). It is shorter than the usual English dash --- and has shorter spaces around it (also they are non-breaking as I can see). What is the width of such spaces? Is it equal to the width of the \, space?

3

1 Answer 1

4

The command \cyrdash is responsible of printing the dash; when the current language is Russian, it prints character 22 (the same slot as the em-dash, but in T2A encoded fonts it is shorter) or does

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

when the current encoding is not T2A, which means it superimposes two en-dashes so that the overall width is 0.8em (so changing with the font). The definition of "- is a bit complicated:

\declare@shorthand{russian}{"-}{%
  \def\russian@sh@tmp{%
    \if\russian@sh@next-\expandafter\russian@sh@emdash
    \else\expandafter\russian@sh@hyphen\fi}%
  \futurelet\russian@sh@next\russian@sh@tmp}
\def\russian@sh@hyphen{\nobreak\-\bbl@allowhyphens}
\def\russian@sh@emdash#1#2{\cdash-#1#2}
\def\cdash#1#2#3{\def\tempx@{#3}%
\def\tempa@{-}\def\tempb@{~}\def\tempc@{*}%
 \ifx\tempx@\tempa@\@Acdash\else
  \ifx\tempx@\tempb@\@Bcdash\else
   \ifx\tempx@\tempc@\@Ccdash\else
    \errmessage{Wrong usage of cdash}\fi\fi\fi}
\def\@Acdash{\ifdim\lastskip>\z@\unskip\nobreak\hskip.2em\fi
  \cyrdash\hskip.2em\ignorespaces}%
\def\@Bcdash{\leavevmode\ifdim\lastskip>\z@\unskip\fi
 \nobreak\cyrdash\penalty\exhyphenpenalty\hskip\z@skip\ignorespaces}%
\def\@Ccdash{\leavevmode
 \nobreak\cyrdash\nobreak\hskip.35em\ignorespaces}%

Basically it means that "- produces \russian@sh@hyphen, whereas "-- does \russian@sh@emdash.

The former issues \nobreak so the preceding word part can be hyphenated; then inserts a discretionary hyphen, allowing the following word part to be hyphenated.

The latter looks at the next two tokens (the first is still -); there are four cases according to the third character

  1. "--- issues \@Acdash;
  2. "--~ issues \@Bcdash;
  3. "--* issues \@Cdash;
  4. None of the above, so "-- is followed by (ignored) spaces and another token than -, ~ or ~.

In the fourth case the error Wrong usage of cdash is raised.

  • The case "--- removes a preceding space if present and, in this case, inserts a nonbreaking space of width 0.2em, followed by \cyrdash and a further nonbreaking space of width 0.2em.

  • The case "--~ removes a preceding space if present, inserts \cyrdash and then a penalty like for an explicit hyphen, ignoring following spaces.

  • The case "--* is for “dialogues”: no space before and the \cyrdash is followed by a space of 0.35em, ignoring following spaces.

There is an error in the definitions: "--- at the beginning of a paragraph can produce unexpected results. There should be \leavevmode at the beginning like for the other two macros.

\documentclass{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}

%% fix the error
\makeatletter
\def\@Acdash{\leavevmode\ifdim\lastskip>\z@\unskip\nobreak\hskip.2em\fi
  \cyrdash\hskip.2em\ignorespaces}%
\makeatother

\begin{document}

\verb|"-|: a"-b

\verb|"---|: a"---b a "--- b

\verb|"--~|: a"--~b a "--~ b

\verb|"--*|: "--*a "--* a

\end{document}

enter image description here

3
  • Thank you for your detailed answer! Is 0.2em more or less than the width of the \, space? Commented Jan 28, 2017 at 10:24
  • @Constructor In text mode, \, does \thinspace which inserts a 0.16667em kern.
    – egreg
    Commented Jan 28, 2017 at 11:12
  • One correction. \cyrdash is provided in the Russian Language Definition File for the case if \cyrdash is not defened elesewere. In particular \cyrdash is defined in T2A and some other cyrillic encodings and points to a slot in font files from LH bundle. Commented Sep 26, 2017 at 5:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .