Linking quotation environment with citation styles
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 stringcompare
plus a space if thewithintextquote
switch is set to false;Patch
csquotes
' internal\csq@tquote@i
macro so that it will set thewithintextquote
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}{%
compare = {vgl\adddot},
}
\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}{%
}{%
\bibstring{compare}\addspace
}%
}
{\printfield{prenote}%
\setunit{\prenotedelim}}}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\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}