Em dash in LaTeX

My friend Daniel Reeves was recently discussing different ways to typeset em dashes. Here is the way I like to do it in LaTeX.

\documentclass{minimal}
%this sets up a new command \dash, which makes nice dashes
\DeclareRobustCommand\dash{%
\unskip\nobreak\thinspace\textemdash\thinspace\ignorespaces}
\begin{document}
Let's test out several different variants on making an em dash using the
\LaTeX typesetting system --- this one uses \verb|---| with spaces around it

Let's test out several different variants on making an em dash using the
\LaTeX typesetting system---this one uses \verb|---| with no spaces around it

Let's test out several different variants on making an em dash using the
\LaTeX typesetting system \dash this one uses my \verb|\dash| command
\begin{verbatim}
\DeclareRobustCommand\dash{%
\unskip\nobreak\thinspace\textemdash\thinspace\ignorespaces}
\end{verbatim}

\end{document}

Here is the resulting output:

Different ways to make em dashes in LaTeX
Different ways to make em dashes in LaTeX

Notice how using spaces around the --- can result in a dash at the end of a line, which is not desirable. And using no spaces around the --- doesn’t look nice, and can also result in problems when copying and pasting. The \dash command solves both of these issues. I did not come up with it myself, but I cannot remember where I found it.

Join 164 other subscribers

Archives

  • 2024 (5)
  • 2023 (8)
  • 2022 (15)
  • 2021 (19)
  • 2020 (1)
  • 2019 (1)
  • 2018 (2)
  • 2017 (1)
  • 2016 (2)
  • 2015 (5)
  • 2014 (5)
  • 2013 (2)
  • 2011 (7)
  • 2010 (10)
  • 2009 (50)
  • 2008 (28)
  • 2007 (31)
  • 2006 (8)

Category