I've (mis)used LaTeX on and off for the past 10 years and am now trying out ConTeXt, mostly because it allows alignment to a baseline grid. I'd like to produce a rule (line) below some text such that the rule:

  • is some distance (1pt, let's say) below the baseline of the text (assume the text fits on one line),
  • is as wide as the text area (\textwidth), and
  • terminates on the right end with a small black square vertically centered on the rule.

In LaTeX, I can do something like this:


This text sits on the fancy rule.

Which gives me this:

Text on a fancy rule

How can I do something similar in ConTeXt? I've tried overlays and \blackrule, but I don't know how to move a \blackrule vertically. I'm open to any solution whether it involves overlays and \blackrules or something else, but I would like the text to align to the baseline grid if possible.

2 Answers 2


There are many other ways to do this in ConTeXt, but a literal translation of your method will be the following:


\rlap{\lower 1pt \blackrule[width=\dimexpr\textwidth-4pt\relax, height=0.4pt]%
      \lower 2.6pt \blackrule[width=4pt, height=4pt]}%
This text sits on the fancy rule.


which gives

enter image description here

  • And what would be best practice? The ConTeXt way of doing it?
    – DG'
    Jun 9, 2015 at 7:23
  • 1
    @DG' see metafox's solution.
    – Aditya
    Jun 9, 2015 at 14:04

You can use the \framed command to draw the line as a background graphic for your text. When you create a new \framed command with \defineframed you have to apply all the settings only once.

  draw (0,StrutDepth)--(OverlayWidth,StrutDepth) withpen pensquare scaled .4pt ;
  drawdot (OverlayWidth,StrutDepth) withpen pensquare scaled 4pt ;
  setbounds currentpicture to OverlayBox ;



\FancyRule{This text sits on the fancy rule.}

Fancy rule below a line of text.

  • Thanks, this method has a definite elegance to it. Is there an easy way to make it align to the baseline grid? Is it possible to separate the rule from the baseline of the text by 1 pt?
    – lefthander
    Jun 9, 2015 at 13:25
  • 1
    @lefthander: Change StrutDepth to StrutDepth -1pt
    – Aditya
    Jun 9, 2015 at 14:11

You must log in to answer this question.

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