[Tex/LaTex] How to configure/redefine the quotation environment to cite

biblatexquoting

I want to redefine the quotation or quote environment so that I have a different presentation style, such as big quotes or all italics, right aligned, etc.

I also want to cite the source (a real cite, or authorcite …).

This is what I have:

\renewenvironment{quote} %[1]
{
  {\rightmargin\leftmargin}
  \relax
  {\Large\textbf{``}}
}
{
  {\Large\textbf{''}}
  %\hfill\citeauthor{#1} \cite{#1}
}

My problems:

  • {\rightmargin\leftmargin} to center in less than full width is not working, I copied this from the original quote environment. The quotation env. used the list environment to do this, but that alters the paragraph spacing too, and I do not want that. What is the right way to define the width I want and where I want to center?
  • The commented out parts for the citation itself are not working, I wanted to use this as \begin{quote}{someBibRef}Some bla bla bla.\end{quote}
    The argument is being passed correctly and I can print it, but I can not use it with cite commands. The output looks like ##1 [##1] and the error log says Illegal parameter number in definition of \endquote }
  • How can I make \citeauthor display the author's full name, not just the last?
  • I wanted this last part to appear in a newline, at right, I haven't found a way to do this simultaneously.

I am using biblatex with biber as backend.

Best Answer

Here's a solution that redefines the quote environment using NewDocumentEnvironment from the xparse package.

\let\oldquote\quote
\let\endoldquote\endquote

\RenewDocumentEnvironment{quote}{m}{%
    \oldquote
    \itshape
    \setlength{\rightmargin}{\leftmargin}
    {\Large\textbf{``}}
}
{%
    {\Large\textbf{''}}
    \item[]\mbox{}\hfill\cite{#1}\citeauthor{#1}
    \endoldquote
}

It was necessary to use this package because, as noted in Why can't the end code of an environment contain an argument?, we can't use #1 at the end of a regular latex environment.

Note that I have used the original definition of the quote environment and added the line

    \setlength{\rightmargin}{\leftmargin}

which sets the margin (as you noted, the quote environment is defined in terms of a list). I also added

    \item[]\mbox{}\hfill\cite{#1}\citeauthor{#1}

to the end of the environment to add the citation as you wished. You might need to add some code if you're worried about page breaks in between items.

screenshot

% arara: pdflatex
% arara: biber
% arara: pdflatex
% !arara: indent: {overwrite: yes}
\documentclass{article}
\usepackage{lipsum}
\usepackage{xparse}
\usepackage[backend=biber]{biblatex}
\usepackage[colorlinks=true,linkcolor=blue]{hyperref}
\addbibresource{mybib.bib}

\let\oldquote\quote
\let\endoldquote\endquote

\RenewDocumentEnvironment{quote}{m}{%
    \oldquote
    \itshape
    \setlength{\rightmargin}{\leftmargin}
    {\Large\textbf{``}}
}
{%
    {\Large\textbf{''}}
    \item[]\mbox{}\hfill\cite{#1}\citeauthor{#1}
    \endoldquote
}

\begin{document}
\lipsum[1]
\begin{quote}{kn:gnus}
    \lipsum[1]
    finishing text
\end{quote}

Now is the time.
\nocite{*}

\printbibliography

\end{document}

mybib.bib

@online{kn:gnus,
author= {{David Arnold}},
title= {Writing Scientific Papers in \LaTeX},
url = {http://msemac.redwoods.edu/~darnold/math55/WritingScientificPapers/project_latex.pdf}
}