# Biblatex: Problems with *vgl.* and numbering in dynamic quotation command

In Biblatex: Automatic Vgl. & automatic quote indenting (depending on quote length) lockstep creates a quotation command based on previous contribitions by lockstep and Martin Scharrer that

1. Whenever it exceeds a certain number of lines in the output (preferably 3), it will be typeset indented.

2. The citation will automatically be typeset without "Vgl." -- regardless of whether it is the short or the long form.

3. When the output is a paraphrase or summary (in other words: when the output is no citation) it is typeset with the prenote "Vgl".

4. It works in biblatex.

The main purpose is to automize both the vgl. (engl. compare) and the line indention.

After using this command for quite a while two minor problems occured.

1. Whenever you use \autocites{}{} with more than one source you will get something like vgl. Grice (1989); vgl. Levinson (2000). including more than one vgl.. The question: Is it possible to have a vgl. just one time in the beginning and suppress it for all following sources of the same \autocite{}{}, thus generating vgl. Grice (1989); Levinson (2000). without any additional vgl..

2. When you use this command with autocite=footnote the counter will "jump" two steps with every \autocite that is embedded in a \cquotation{}, e.g. whenever you have something like this \cquotation{text text text \autocite{}.} the counter will add two instead of one.

Does anyone know how to solve these problems?

Below you find locksteps code. To produce my particular problem I added autocite=footnote and Ì added This is a paraphrase \autocite{A01}{A01} twice in the beginning.

\documentclass{article}

\usepackage[ngerman]{babel}

\usepackage[style=authoryear,autocite=footnote]{biblatex} % Here, Philip added "autocite=footnote"

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

\newbool{withintextquote}

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

\makeatletter
\newcommand{\cquotation}[1]{%
\begingroup
\booltrue{withintextquote}%
% \settowidth doesn't like paragraphs
\setbox\@tempboxa\hbox{%
\def\par{\hspace{3\linewidth}}% If a paragraph is included force long form
%\let\par\space  % Ignore paragraphs
#1}%
\ifdim\wd\@tempboxa>3\linewidth
\begin{quote}
\itshape
#1
\end{quote}
\else
{\itshape #1}%
\fi
\endgroup}
\makeatother

\usepackage{filecontents}

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

\begin{document}

This is a paraphrase \autocites{A01}{A01} % Added by Philip

This is a paraphrase \autocites{A01}{A01} % Added by Philip

\cquotation{This is a short direct quotation. \autocite{A01}}

\cquotation{This is a long direct quotation. This is a long direct
quotation. This is a long direct quotation. This is a long direct
quotation. This is a long direct quotation. This is a long direct
quotation. This is a long direct quotation. This is a long direct
quotation.\autocite{A01}}

This is a paraphrase \autocite{A01}

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

\printbibliography

\end{document}


You might like the following modifications

Problem 1 is addressed by redefining the multicite multiprenote bibmacro. If we are in a prenote situation, we redefine the multiprenote to add the "vgl" note and redefine the normal prenote not to do so.

Problem 2 can be dealt with by disabling the footnote command within the box used to evaluate the length of the text. The command cquotation typesets the text in its argument twice: once invisible to check its length (to decide what to do with the text) and once properly; the invisible typesetting increases the footnote numbering as well, so you get double-steps.

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

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

\makeatletter
\newcommand{\cquotation}[1]{%
\begingroup
\booltrue{withintextquote}%
% \settowidth doesn't like paragraphs
\setbox\@tempboxa\hbox{%
\def\par{\hspace{3\linewidth}}% If a paragraph is included force long form
%\let\par\space  % Ignore paragraphs
\let\footnote\@empty% make sure autocite does not do anything here; this is new
\let\autocite\@empty
#1}%
\ifdim\wd\@tempboxa>3\linewidth
\begin{quote}
\itshape
#1
\end{quote}
\else
{\itshape #1}%
\fi
\endgroup}
\makeatother


Our MWE then yields

\documentclass{article}

\usepackage[ngerman]{babel}

\usepackage[style=authoryear,autocite=footnote]{biblatex} % Here, Philip added "autocite=footnote"

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

\newbool{withintextquote}

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

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

\makeatletter
\newcommand{\cquotation}[1]{%
\begingroup
\booltrue{withintextquote}%
% \settowidth doesn't like paragraphs
\setbox\@tempboxa\hbox{%
\def\par{\hspace{3\linewidth}}% If a paragraph is included force long form
%\let\par\space  % Ignore paragraphs
\let\footnote\@empty% make sure autocite does not do anything here; this is new
\let\autocite\@empty
#1}%
\ifdim\wd\@tempboxa>3\linewidth
\begin{quote}
\itshape
#1
\end{quote}
\else
{\itshape #1}%
\fi
\endgroup}
\makeatother

\usepackage{filecontents}

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

\begin{document}

This is a paraphrase \autocites{A01}{A01} % Added by Philip

This is a paraphrase \autocites{A01}{A01} % Added by Philip

\cquotation{This is a short direct quotation. \autocite{A01}}

\cquotation{This is a long direct quotation. This is a long direct
quotation. This is a long direct quotation. This is a long direct
quotation. This is a long direct quotation. This is a long direct
quotation. This is a long direct quotation. This is a long direct
quotation.\autocite{A01}}

This is a paraphrase \autocite{A01}

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

This is a paraphrase \autocite{A01}
This is a paraphrase \autocite{A01}

This is a paraphrase \autocites{A01}{A01} % Added by Philip

This is a paraphrase \autocites{A01}{A01} % Added by Philip

\cquotation{This is a short direct quotation. \autocite{A01}}
This is a paraphrase \autocite{A01}

\printbibliography

\end{document}


If you use csquotes you might like to have a look at blockquote, a very sophisticated implementation of the inline/paragraph switching.

We can also borrow an internal macro for our purposes: \blockquote@parsehook disables all unwanted fragile parts of LaTeX code such as footnotes, marginnotes, labels and index commands in the savebox. There even is a command for users to add commands to be disabled within blockquote evaluations: \BlockquoteDisable{}.

The \cquotation command then becomes.

\makeatletter
\newcommand{\cquotation}[1]{%
\begingroup
\booltrue{withintextquote}%
% \settowidth doesn't like paragraphs
\setbox\@tempboxa\vbox{%
\def\par{\hspace{3\linewidth}}% If a paragraph is included force long form
%\let\par\space  % Ignore paragraphs
%\let\blx@thecheckpunct\@gobble
\blockquote@parsehook
#1}%
\ifdim\wd\@tempboxa>3\linewidth
\begin{quote}
\itshape
#1
\end{quote}
\else
{\itshape #1}%
\fi
\endgroup}
\makeatother

• A new problem occured. If you use the \cquotation and it doesnt exceed 3 lines, now it will generate a line break which is not desired. So if you type in bla bla bla \cquotation{asdf asdf asdf asdf} hjkl hjkl hjkl you will find an odd line break following the last bla. Is it possible to fix this issue. – Philip Dec 10 '13 at 21:14
• @Philip That behaviour is easily fixed, I seem to have accidentally added a blank line to lockstep's code which causes the line break. It should be fixed now, sorry. – moewe Dec 11 '13 at 9:07
• Thank you so much, it works. Without the vgl. the \blockquote command doesnt meet one crucial requirement. My thesis has about 200 pages and to change the vgl. manually would be too much of a hassle. Maybe, I will post a question at some point if anyone can combine the \blockquote with vgl.. For now I am happy that it works. So, again, thank you! – Philip Dec 11 '13 at 10:41