# Adding vertical lines to each side of a paragraph

How can I add vertical lines to each side of a paragraph?

To illustrate, what I need is:

 some paragraphs...

|My paragraph begins|
|here and goes like |
|this... ~~~~~~~~~~~|
|~~~~~~~~~~~~~~~~~~~|
|~~~~~~~~~~~~~~~~~~~|
|~~~~~~~~~~~~~~~~~~~|
|~~~~~~~~~~~~~~~~~~~|
--------------------- <- Here is a page break
|~~~~~~~~~~~~~~~~~~~|
|~~~~~~~~~~~~~~~~~~~|
|~~~~~~~~~~~~~~~~~~~|
|~~~~~~~~~~~~~~~~~~~|
|The paragraph ends |
|here.              |

Some other paragraphs...


I could not use any tabular or boxing commands since they don't allow page breaks inside.

-
do you want the vertical lines in the margin or as in Gonzalo's answer inside the text area? –  jfbu Dec 10 '12 at 16:43
@jfbu my answer now includes both options. –  Gonzalo Medina Dec 10 '12 at 17:24

You can use the mdframed package; a little example:

\documentclass{article}
\usepackage{mdframed}
\usepackage{lipsum}% just to generate text for the example

\newmdenv[
topline=false,
bottomline=false,
skipabove=\topsep,
skipbelow=\topsep
]{siderules}

\begin{document}

\lipsum[4]
\begin{siderules}
\lipsum[1-5]
\end{siderules}
\lipsum[4]

\end{document}


Here's a simplemodification placing the rules in the margin (now the text width inside the environment is equal to the default \textwidth):

\documentclass{article}
\usepackage{mdframed}
\usepackage{lipsum}% just to generate text for the example

\newmdenv[
topline=false,
bottomline=false,
skipabove=\topsep,
skipbelow=\topsep,
leftmargin=-10pt,
rightmargin=-10pt,
innertopmargin=0pt,
innerbottommargin=0pt
]{siderules}

\begin{document}

\lipsum[4]
\begin{siderules}
\lipsum[1-5]
\end{siderules}
\lipsum[4]

\end{document}


-
the first paragraphs in both cases are not indented, is this an after-effect of the use of mdframed? –  jfbu Dec 10 '12 at 17:29
@jfbu yes, apparently the first line of the first paragraph is not indented by design. –  Gonzalo Medina Dec 10 '12 at 17:37
@jfbu to get the first line indented, one can add \mbox{}\indent right after \begin{siderules}. –  Gonzalo Medina Dec 10 '12 at 17:49
That's what I was really looking for. Thank you so much.. –  Alper Dec 11 '12 at 12:22