6

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.

  • @cmhughes The tag quoting doesn't need an additional tag environment, same as we don't add environment to every question about align, itemize etc. – lockstep Feb 27 '14 at 21:04
  • I initially used the 'environments' tag because I thought the question had a big part on how to (re)define an environment. – brita_ Feb 28 '14 at 10:50
5

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}
}
  • Thank you, this answer covers about everything. I guess the double '{{' is what make the full author's name appear? Also, how can I indent paragraphs? (this is not in the original question) – brita_ Feb 28 '14 at 10:53
  • @brita_ glad it helped :) have a look at Indenting a whole paragraph for the paragraph thing – cmhughes Feb 28 '14 at 19:29
7

I would discourage you from redefining the quote environment, particularly if you change its syntax to want a mandatory argument.

Since this seems to be used for particular purposes, it's better to define a new environment.

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

\documentclass{article}
\usepackage{xparse}
\usepackage[backend=biber]{biblatex}
\usepackage{quoting}

\usepackage{kantlipsum}

\usepackage[colorlinks=true,linkcolor=blue]{hyperref}

\addbibresource{\jobname.bib}

\NewDocumentEnvironment{citequote}{m}
 {%
  \begin{quoting}[indentfirst=false,font=itshape]
  \bigquotes{r}{``}\ignorespaces
 }
 {%
  \unskip\bigquotes{l}{''}%
  \item\relax\hspace*{\fill}\citeauthor{#1}\ \textup{\cite{#1}}%
   \end{quoting}
 }
\newcommand{\bigquotes}[2]{%
  \makebox[0pt][#1]{%
    \raisebox{\dimexpr\fontcharht\font`A-\height}{\Large\bfseries#2}%
  }%
}

\begin{document}
\kant[1]
\begin{citequote}{kn:gnus}
\kant*[2]
And so it ends.
\end{citequote}

Now is the time.
\nocite{*}

\printbibliography

\end{document}

(I shamelessly used cmhughes reference and structure.)

The quoting environment provided by the package with the same name can be easily customized.

Note also that I changed the height of the big quotes; the closing ones would make the leading between the last two lines before the citation too far apart if left as they would be naturally. They are both “hanging”, it's sufficient to remove the \makebox[0pt] part to avoid hanging.

enter image description here

  • Thank you, I have taken the good suggestions of making a new environment instead and on better defining the quotes. – brita_ Feb 28 '14 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.