Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
    
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 '11 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 '11 at 1:28
    
Related Question: End of paragraph with ornament. –  Peter Grill Sep 26 '12 at 19:25

3 Answers 3

up vote 11 down vote accepted

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

\hrule

on a line by itself?

share|improve this answer
    
Didn't realize it was that simple. Thanks! –  kibibyte Oct 9 '11 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.

\documentclass{article}
\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
}
\begin{document}
\lipsum[1]

\myrule

\lipsum[2]

\myrule[10pt][5pt]

\lipsum[3]

\myrule[5pt][5pt][orange]

\lipsum[4]

\end{document}

enter image description here

share|improve this answer

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.

\documentclass{article}

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

\begin{bottomborder}
\lipsum[1-3] 
\end{bottomborder}

\end{document}
share|improve this answer
    
Using this approach, you could, for example, add an \hrule before the environment begins as well. –  cmhughes Oct 9 '11 at 2:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.