41

How can I make a horizontal dashed line in LaTeX?

Just writing lots of single dashes results in a continuous horizontal line.

3 Answers 3

40

You can look at the dashrule package, for example.

2
  • Nice... a lot of flexibility :)
    – meep.meep
    Commented Mar 3, 2011 at 10:26
  • 5
    It would also be great if this answer included a simple example of how to use dashrule.
    – g33kz0r
    Commented Apr 21, 2016 at 18:08
16

With Plain leaders, for example:

\def\dashfill{\cleaders\hbox{-}\hfill}
\hbox to \hsize{\dashfill\hfil}
\bye

Changing the spacing is then a matter of redefining the dashfill's hbox:

\def\dashfill{\cleaders\hbox to 2em{-}\hfill}
2

What about adding spaces between the dashes: - - - - - - ? When I try it, it works just fine. Or do you want something else?

You must log in to answer this question.

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