# 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

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.

This entry was posted in latex. Bookmark the permalink.

### One Response to Em dash in LaTeX

1. Nice little macro. I like how you use \unskip to remove any interword glue that appears beforehand. The use of \thinspace before the dash prevents a line break at that point – could that be a problem? Also, why \ignorespaces at the end? Wouldn’t that prevent explicit spaces such as “\ “?