I want to emulate a feature from a few word processing programs (e.g. Microsoft Word, LibreOffice Writer) where I could (somewhat) arbitrarily insert a bottom border below any text/paragraph. How can I do this in LaTeX?

Edit: Just to clarify, what I want is pretty much a horizontal line across the page just below the text. Like this:

Bottom border

  • By "border", do you mean a horizontal line (since you want it "below" text/paragraph)? If not, post a screen grab from your MS Office/LibreOffice Writer as part of your question, almost like presenting an MWE.
    – Werner
    Oct 9, 2011 at 1:22
  • Yes, a horizontal line right below the text. I'll add a screengrab just to make sure it's clear.
    – kibibyte
    Oct 9, 2011 at 1:28
  • Related Question: End of paragraph with ornament. Sep 26, 2012 at 19:25

3 Answers 3


There are probably many ways to do this. Have you tried issuing the command


on a line by itself?

  • Didn't realize it was that simple. Thanks!
    – kibibyte
    Oct 9, 2011 at 1:42

With a slight modification from @egreg's answer to Shift horizontal line to the left, the following minimal working example (MWE) provides \myrule[<thickness>][<gap>][<color>], that places a rule of thickness <thickness> between paragraphs (default is 1pt). Additionally, the second optional argument allows you to increase the gap between the line and the preceding/succeeding paragraph (default is 3pt). Finally, the last optional argument allows you to change the colour of the line to <color> (default is black). Colour is provided by means of \color from the xcolor package.

\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{xparse}% http://ctan.org/pkg/xparse
\NewDocumentCommand{\myrule}{O{1pt} O{3pt} O{black}}{%
  \par\nobreak % don't break a page here
  \kern\the\prevdepth % don't take into account the depth of the preceding line
  \kern#2 % space before the rule
  {\color{#3}\hrule height #1 width\hsize} % the rule
  \kern#2 % space after the rule
  \nointerlineskip % no additional space after the rule








enter image description here


Here's another approach using an environment. The advantage of this approach is that you can decorate the content of the environment globally in your preamble. You could combine this idea with Werner's to make the border more colourful.

I have used the needspace package to make sure that the \hrule doesn't get separated from the last line of the paragraph.


\usepackage{lipsum}     % needed for sample text
\usepackage{needspace}  % provides the \needspace command
{}  % code to be processed before the environment begins
{\needspace{\baselineskip}\hrule} % code to be processed after the environment ends


  • Using this approach, you could, for example, add an \hrule before the environment begins as well.
    – cmhughes
    Oct 9, 2011 at 2:14

You must log in to answer this question.

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