# Tight horizontal lines around a block of text

I wish to create a block of text with tight horizontal lines above and below, e.g.

This is a paragraph.

The following example seems to produce more space between the paragraph and the horizontal line below than the horizontal line above.

\noindent\rule{\linewidth}{0.4pt}

\noindent This is a paragraph, possibly with more than 1 line of text.\\ \noindent\rule{\linewidth}{0.4pt}


As far as I understand, this behaviour is due to the way rules are formatted in LaTeX. I would prefer a solution that gives me the same space between the paragraph and both lines and have the lines fairly close to the paragraph. Ideally, the solution should not make use of any additional packages and be robust to changes in font, font size, text formatting, and line spacing. I have read that \offinterlineskip may solve this problem, but wanted to check if this is indeed the preferred solution and how to implement it to avoid breaking anything else.

• How would you integrate this in your text? – egreg Sep 29 '13 at 14:32
• @egreg I am using this as part of a dedicated chapter title page, where I provide a short summary of the chapter. The solution by David Carlisle provides some nice options. – Rob Hall Sep 29 '13 at 14:45

Whether or not there is "more space" depends on where you measure from. If (as in your example) the rules are placed on equally spaced baselines, then there is less space between the tops of the letters and the top rule than from the bottoms of the letters and the bottom rule. However it does mean that the space between the rules depends only on the number of lines, not on the content of the text.

You can remove the equal baseline requirement but then the top rule position moves if there are no uppercase letters on the first line, and the bottom moves if there are descenders.

There are of course variants where you adjust the space one way or another, but first you have to define "tight".

\documentclass{article}
\setlength\parindent{0pt}
\setlength\textwidth{5cm}
\begin{document}

\rule{\linewidth}{0.4pt}

1 This is a paragraph, possibly with more than 1 line of text.

\rule{\linewidth}{0.4pt}

\bigskip

\rule{\linewidth}{0.4pt}

\nointerlineskip
2 This is a paragraph, possibly with more than 1 line of text.

\nointerlineskip
\rule{\linewidth}{0.4pt}

\bigskip

\rule{\linewidth}{0.4pt}

3 This is a paragraph, possibly with more than 1 ggg.

\rule{\linewidth}{0.4pt}

\bigskip

\rule{\linewidth}{0.4pt}

\nointerlineskip
4 This is a paragraph, possibly with more than 1 ggg.

\nointerlineskip
\rule{\linewidth}{0.4pt}

\bigskip

\rule{\linewidth}{0.4pt}

5 this is a paragraph, possibly with more than 1 line of text.

\rule{\linewidth}{0.4pt}

\bigskip

\rule{\linewidth}{0.4pt}

\nointerlineskip
6 this is a paragraph, possibly with more than 1 line of text.

\nointerlineskip
\rule{\linewidth}{0.4pt}

\end{document}