Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vertical line with every quotation

Tags:

latex

I often want to tell some comments inside of the text, which aren't so closely related to the discussed topic. Usually for this purpose I use the quotation environment, because of its large indent on the left. The comment can be large, it can include formulas, code listings, nested quotations, and so on.

How can I make quotation environment to draw a long vertical line on the left of all its content? You can often find this style on the Web with the actual quotes.

Google has found one solution:

\begin{flushleft}
\hbox{%
\vrule\hspace{.5em}\parbox{.9\textwidth}%
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi id hendrerit 
nunc. Sed scelerisque lacus vitae erat eleifend eleifend. Donec eros mi, placerat
in porta eleifend, placerat a urna. Pellentesque venenatis neque non turpis
convallis vehicula. Aliquam aliquet ultricies tincidunt.}}
\end{flushleft}

But it cannot deal with code listings etc. inside of the text.

Thank you for your advice. Sorry if my English wasn't understandable enough.

like image 559
Skiminok Avatar asked Oct 25 '10 20:10

Skiminok


2 Answers

I would suggest using framedbox/leftbar:

\usepackage{framed}
\newenvironment{quotationb}%
{\begin{leftbar}\begin{quotation}}%
{\end{quotation}\end{leftbar}}

Then you can use \begin{quotationb}......\end{quotationb}

like image 192
Victor P. Avatar answered Sep 19 '22 13:09

Victor P.


Have you tried using a tabular environment?

Here is some code that creates a vertical line for the text you have given above,

\begin{tabular}{|p{10cm}}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi id hendrerit 
nunc. Sed scelerisque lacus vitae erat eleifend eleifend. Donec eros mi, placerat
in porta eleifend, placerat a urna. Pellentesque venenatis neque non turpis
convallis vehicula. Aliquam aliquet ultricies tincidunt.\\
\end{tabular}

You need the p{10cm} to define the width of the column for the text to wrap, otherwise it goes off the page. You can change the value depending on your margins and paper format.

Here is the result,

Vertical Line Quote

And as far as I know, tabular environment accepts the code listings package.

like image 29
nbz Avatar answered Sep 20 '22 13:09

nbz