20

Is there a method just write --- to get an em-dash, putting a thinspace both before and after it? The situation about break is similar with the original ---.

0

1 Answer 1

22

You can use microtype:

\documentclass{article}

\usepackage[kerning=true]{microtype}
\SetExtraKerning
    {encoding =  {OT1,T1,T2A,LY1,OT4,QX,T5,TS1,EU1,EU2}} % all text
    {
        \textemdash  = {167,167} % thinspace = 1/6 em
    }

\begin{document}

Single hyphen in text mode: text-text, and in math mode: $a-b$.

Double hyphen in text mode: text--text, and in math mode: $a--b$.

Triple hyphen in text mode: text---text, and in math mode: $a---b$.

Quadruple hyphen in text mode: text----text, and in math mode: $a----b$.

\end{document}

Compiled:
compiled example

400% zoom:
compiled example - zoom

If you do not like other microtype features (i.e., protrusion and expansion), you can disable them by adding respective options to \usepackage.

5
  • 4
    For a thin space is should be {167,167}, as 1000 refers to the em in the current font and the normal width of the thin space is 1/6 em.
    – egreg
    Apr 17, 2013 at 10:45
  • @egreg Where is \thinspace defined as 1/6 em? (Not that I don't believe you.) Apr 17, 2013 at 11:02
  • 1
    @SvendTveskæg texdef -t latex thinspace says \kern 1.66667em
    – egreg
    Apr 17, 2013 at 11:04
  • @egreg, you're rigth. Corrected and added zoom. @SvendTveskæg, latex.ltx says \def\thinspace{\kern .16667em } Apr 17, 2013 at 11:09
  • Should one really list TS1? It gives a warning: Package microtype Warning: Unknown slot number of character (microtype) `\textemdash ' (microtype) in font encoding `TS1' in kerning list (microtype) `thesis-main.tex/32'. Jul 24, 2017 at 21:35

You must log in to answer this question.

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