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.

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.

Thanks in advance...

share|improve this question
1  
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
2  
@jfbu my answer now includes both options. –  Gonzalo Medina Dec 10 '12 at 17:24
add comment

1 Answer

up vote 6 down vote accepted

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}

enter image description here

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}

enter image description here

share|improve this answer
1  
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
1  
@jfbu yes, apparently the first line of the first paragraph is not indented by design. –  Gonzalo Medina Dec 10 '12 at 17:37
2  
@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
add comment

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.