Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?
share|improve this question
    
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
1  
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
add comment

1 Answer

up vote 7 down vote accepted

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}{%
  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}

enter image description here

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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