Linking quotation environment with citation styles

I was just wondering if it is possible to combine citation commands (preferably of biblatex) with quotation environments.

The reason is this:

In German language papers you often have two choices (besides some formal ones).

1. You either use a paraphrase/summary and add the source with the abbreviation "Vgl." (engl. compare).
2. Or you use a direct quotation with quotation marks and a source without "Vgl.".

Linking them together would save the author some work because it would avoid the need for manual adjustments.

Two examples:

This is a summary. (Vgl. Bauer 2009)

"This is a quotation" (Bauer 2009)

My question is:
Is it possible to define the \cite command in a quotation sensitive way that

1. automatically generates a Vgl.-less output (for example "(Bauer 2009)") when used in a quotation environment? And that
2. generates a Vgl. output (for example "(Vgl. Bauer 2009)") when used without quotation mark?
-
Please be aware with phrases like: In German language papers you usually have two choices. The basic rules are defined in DIN 1505 Teil 3. –  Marco Daniel May 26 '12 at 10:33
And, to add to @MarcoDaniel’s comment, there are numerous citation styles in Germany (and elsewhere), depending on the field you work in – and in some fields every journal or department has its own style guide. –  domwass May 27 '12 at 11:46

Assuming that a) "quotation environment" actually stands for text enclosed in quotation marks b) you are willing to use the csquotes package to handle quotation marks (note that its use is recommended for biblatex), you may do the following:

• Declare a new boolean switch withintextquote (which is initially set to false);

• Patch biblatex' prenote bibmacro so that it will add the (new) bibliography string compare plus a space if the withintextquote switch is set to false;

• Patch csquotes' internal \csq@tquote@i macro so that it will set the withintextquote switch locally to true.

EDIT: The automatic compare prenote is now overridden if the user adds an explicite prenote to the citation command.

\documentclass{article}

\usepackage[ngerman]{babel}

\usepackage[style=authoryear]{biblatex}

\NewBibliographyString{compare}
\DefineBibliographyStrings{ngerman}{%
}

\usepackage{csquotes}
\SetCiteCommand{\autocite}

% \usepackage{etoolbox}% loaded by biblatex

\newbool{withintextquote}

\makeatletter
\patchcmd{\csq@tquote@i}{\begingroup}{\begingroup\booltrue{withintextquote}}{}{}
\makeatother

\renewbibmacro*{prenote}{%
\iffieldundef{prenote}{%
\ifbool{withintextquote}{%
}{%
}%
}
{\printfield{prenote}%
\setunit{\prenotedelim}}}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha},
}
\end{filecontents}

\begin{document}

This is a paraphrase \autocite{A01}

This is a paraphrase with prenote \autocite[siehe hierzu auch][]{A01}

\textcquote{A01}{This is a direct quotation}

\printbibliography

\end{document}


-
I suppose it works. But in my case it doesnt. The console (of TexShop 2.43) is telling me this: <argument> \ExplFileName l.30 ...e}{\ExplFileVersion}{\ExplFileDescription} –  Philip May 27 '12 at 9:52
@Philip Your version of LaTeX3 packages may be too old for xpatch. I removed the xpatch dependency in my answer. –  lockstep May 27 '12 at 10:01
Thanks. It works perfectly. –  Philip May 27 '12 at 11:36