Vertical line with every quotation
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开发者_JAVA技巧. 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.
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,
And as far as I know, tabular environment accepts the code listings package.
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}
精彩评论