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?
-
Could you please add your code and an image? I did not understand well what you ask.– SebastianoCommented Jan 27, 2017 at 17:46
-
@Sebastiano See babel-russian package documentation.– ConstructorCommented Jan 27, 2017 at 17:54
-
See at the link tex.stackexchange.com/questions/139748/… or tex.stackexchange.com/questions/344829/…. I think that these are similar at your question.– SebastianoCommented Jan 27, 2017 at 17:59
1 Answer
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
"---
issues\@Acdash
;"--~
issues\@Bcdash
;"--*
issues\@Cdash
;- 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}
-
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.– egregCommented 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 inT2A
and some other cyrillic encodings and points to a slot in font files from LH bundle. Commented Sep 26, 2017 at 5:43