It's just as the title says.


  • Some details could be helpful. I understand »sections« as headings thus a part of the document structure. Perhaps you mean the place between two paragraphs. Oct 13 '10 at 10:11
  • @Thorsten: Yes, you are right. I changed the title.
    – Neves
    Oct 13 '10 at 10:36
  • 1
    Also see: How do I insert a border below text?
    – Werner
    Dec 8 '11 at 18:47

In ConTeXt, \blackrule gives a horizontal line. By default, the width of the line 1em wide and 1ex tall. The width, height, and depth are changed using the respective options. For example:

\blackrule[width=\hsize, height=1pt, depth=0.5ex]
  • Despite its name, \blackrule also draws colored rules.

  • \setupblackrules specifies the options for all \blackrules.

  • As a bonus, \blackrules (notice the plural) draws multiple horizontal rules. For example:

    \blackrules[n=6, width=\hsize, distance=0.5ex]

    draws 6 rules separated by a distance of 0.5ex.

  • 1
    I think that everyone would agree that this is now the best answer.
    – Neves
    Oct 14 '10 at 3:42

How does this look:

alt text

Whilst I generally favour TikZ for anything vaguely graphical, this was achieved with a simple \rule:







You can thicken the line by changing the 1pt to something else (or make it thinner, I guess). Perhaps style purists would want to change the before and after spacing a little.

(Added in edit: in the comments, Style Purist Will recommends adding a little height, and as it's so easy to do - I'd forgotten about the optional argument, myself - I thought it worth adding in the demonstration. He also used \linewidth rather than \textwidth - my original choice - which is a little more robust as it will vary correctly in lists and other environments where the linewidth can get altered.)

  • @Andrew: Very nice. Just what I needed. Thanks.
    – Neves
    Oct 13 '10 at 11:03
  • I'd recommend raising that rule a little with something like \rule[0.5ex]{\linewidth}{1pt}. I guess that makes me a style purist, whatever that is ;) Oct 13 '10 at 12:54
  • @Andrew: you'd have gotten hella downvotes if you actually had written up a TiKZ answer. =) Oct 13 '10 at 14:06
  • 7
    It embarasses you on stackexchange when it's too late to edit your post to fix your dumb typo, that's what it does. ;)
    – frabjous
    Oct 13 '10 at 23:54
  • 3
    Needing the \noindent with \rule seems strange. I wonder why it wasn't written to just work in either h mode or v mode. Looking at the definition of \@rule, it'd be a trivial modification: remove \leavevmode\hbox and replace \vrule with \ifvmode\hrule\else\vrule\fi
    – TH.
    Oct 14 '10 at 9:10

This is more for myself, but I just used \hrule where I was trying to use \hline in text mode a document, since of course a line is never as simple as just a line. That's LaTeX.


I typically use \hrulefill or \noindent\hrulefill to achieve a horizontal line.

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.