[Tex/LaTex] Add a black border to block quotations

framedmarkdownpandocquoting

I have a Markdown file that I'm converting to PDF with Pandoc. And I'd like that the block quotation of the Markdown file get a 1px black border around them in the PDF.

I already managed to edit the style of code blocks with \lstset, but I'm not sure how to do the same for block quotations.

Best Answer

Following a similar technique than the one in Pandoc: Markdown to PDF, without cutting off code block lines that are too long you can write a file named, for example quote-setup.tex containing:

\usepackage{framed}
\let\oldquote=\quote
\let\endoldquote=\endquote
\renewenvironment{quote}{\begin{framed}\begin{oldquote}}{\end{oldquote}\end{framed}}

and compile with:

pandoc example.md -H quote-setup.tex -o example.pdf

IMHO, the frame is "too agressive" visually. I would prefer a more subtle effect such as a shaded background. This can be achieved with:

\usepackage{framed}
\usepackage{xcolor}
\let\oldquote=\quote
\let\endoldquote=\endquote
\colorlet{shadecolor}{orange!15}
\renewenvironment{quote}{\begin{shaded*}\begin{oldquote}}{\end{oldquote}\end{shaded*}}

So, for example:

# Example section

Now, a quote:

> Proin iaculis tellus sed fringilla elementum. Suspendisse porta tincidunt magna. 
> Mauris cursus pharetra lacinia. Mauris ac auctor nibh. Duis laoreet scelerisque 
> leo, ac pellentesque lorem feugiat tempus. In eu rhoncus velit. Ut bibendum nibh
> ut feugiat semper.

will produce:

Result