15

I am trying to get an en-dash by using two '-' characters, but instead of appearing as one long en-dash symbol, I'm getting --. Any idea how I can get an unbroken en-dash?

  • 3
    Please post a minimal example and which engine and format you are using (LaTeX, pdfLaTeX, XeLaTeX, ...) It could be a problem with ligatures, font, or just with your viewer. Zoom in, try a different viewer or print it. – Stefan Kottwitz Aug 7 '11 at 22:02
  • 2
    You should get an unbroken endash by default. Are you using xelatex or special font package, etc.? – frabjous Aug 7 '11 at 22:02
  • Try \textendash although I get an endash using two '-' characters. And, while we're on the topic, an even longer dash is produced by the \textemdash command – DJP Aug 8 '11 at 1:20
  • Apparently '--' doesn't produce an en-dash in math-mode; it works fine in text mode. – Isaac Kleinman Aug 8 '11 at 1:40
29

Are you perhaps trying to do this within math mode? If, so that needs special attention:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

Outside of math mode  13--17 works.

In math mode this does not work as the dashes represent a minus operation:
\[a = d\ 17--21\]

In math mode you need to:
\[a = d \hbox{ 17--21}\]
or if you have the amsmath pacakge:
\[a = d \text{ 16--19}\]
\end{document}
  • Yes, I realized my mistake, I was trying to get the en-dash from within math mode; it works fine in text mode. – Isaac Kleinman Aug 8 '11 at 1:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.