Is there a way to get a custom-length horizontal line that appears like a "longer em-dash", if you will?

  • 1
    I removed the xetex tag because the question is not XeTeX-specific. – lockstep Dec 20 '11 at 19:08

I defined a \threeemdash macro for use in bibliographies. A more general \xdash version accepts the dash length as optional argument.





Some text: \threeemdash

Some text: \xdash

Some text: \xdash[6em]


enter image description here


If you're specifically interested in duplicating the en-dash look (which differs from a typical horizontal \rule), you could use leaders.

enter image description here

Some text: -- \par
Some text: \varendash \par \medskip

Some text: --- \par
Some text: \varendash[10pt] \par \medskip

Some text: {---}{---}{---}{---}{---} \par
Some text: \varendash[50pt]

The above MWE provides \varendash[<len>] which typesets an en-dash -- within the space <len> (default is 5pt). Since the standard en-dash (--) has width 5pt, and em-dash (---) has width 10pt, using multiples of 5pt works best.

You could also define \varemdash in a similar context:


if this is your default usage. However, two en-dashes yield one em-dash.

For more on leaders, see Want to fill line with repeating string. For have a line filled to the end of the text block (like \hrulefill), consider using the xhfill package.

  • While I'd like to have a closer (and font-specific) emulation of dashes, your solution results in tiny spaces between the various dash fragments. – lockstep Dec 20 '11 at 19:18
  • @lockstep: Yes, there is a tiny gap in the PDF view, but this does not show up in print (just checked). Alternatively, using \leaders\hbox{--\kern-0.01pt}\hfill\kern0pt would remove the visual gap, but leave up to (probably) 4.99pt gap shorter than the specified length <len>, depending on the leader length. Do you know the actual thickness of an en-dash (or em-dash) in order to match that of the text character(s)? – Werner Dec 20 '11 at 20:09
  • No, I don't. The 0.55pt I used in my answer are more suited for Palatino (with thicker dashes) than for Computer Modern, though. – lockstep Dec 20 '11 at 20:29

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.