1

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.

The question:

  1. Is it possible to change the 3 lines exceeding version to single spacing (while using \usepackage{setspace} and \onehalfspacing)?
  2. Is it possible to produce slightly smaller text than in the "proper" text in the 3 line exceeding version?
  3. Used in a footnote{}, is it possible to adjust its size to the footnote text when it exceeds 3 lines?
  4. And is anyone able to do it?

The code:

\documentclass{article}

\usepackage[ngerman]{babel}

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

\NewBibliographyString{compare}
\DefineBibliographyStrings{ngerman}{%
  compare = {vgl\adddot},
}

\newbool{withintextquote}

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

\renewbibmacro*{prenote}{%
  \iffieldundef{prenote}{%
    \ifbool{withintextquote}{%
    }{%
      \bibstring{compare}\addspace
    }%
    }
    {\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}

\addbibresource{\jobname.bib}

\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}

\footnote{This is aThis is aThis is aThis is aThis is aThis is aThis is aThis is aThis is   aThis is aThis is a \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 aThis is aThis is aThis is aThis is aThis is aThis   is aThis is aThis is aThis is aThis is a }

\printbibliography

\end{document}

Note: The vgl. code used here is slightly refined by moewe based on the version of lockstep. It avoids strange numbering and a undesired output of the prenote vgl. in autocite=footnote setting in biblatex (the link Biblatex: Problems with vgl. and numbering in dynamic quotation command). In addition, you find a \newbibmacro*{simp:prenote}{... by moewe to avoid confusion with another command (see Biblatex: Combining Dynamic Compare Command with a '\citetitle' Command). And, I added the \usepackage{setspace} and \onehalfspacing.

  • 1
    1. and 2. are quite easily dealt with; for footnote detection there is something more to be done (tex.stackexchange.com/q/147350/35864). – moewe Mar 12 '14 at 21:09
  • 1
    @moewe Since biblatex is loaded for this, couldn't one use \iffootnote for that? – Paul Stanley Mar 12 '14 at 22:04
  • @PaulStanley Yep, at first I could not get it to work, but I think it works now. – moewe Mar 13 '14 at 8:36
2

The following redefinition of \cquotation could help.

\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}
            \singlespacing
            \smaller
            \itshape
            #1
        \end{quote}
    \else
        {\blx@blxinit\iffootnote{\smaller}{}\itshape #1}%
    \fi
    \endgroup}
\makeatother

The long quote (text exceeding 3 lines) will be printed in \singlespacing and smaller (the \smaller command is courtesy of Don­ald Arse­neau's relsize package, so we load \usepackage{relsize}).

While the short form will be printed smaller only if it appears in a footnote; to detect the footnote we use \iffootnote, a biblatex command that is only available after issuing \blx@blxinit.

Note that the size calculations are done in double spacing and normal font size.

MWE

\documentclass{article}

\usepackage[ngerman]{babel}

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

\usepackage{setspace}
\usepackage{relsize}
\onehalfspacing
\NewBibliographyString{compare}
\DefineBibliographyStrings{ngerman}{%
  compare = {vgl\adddot},
}

\newbool{withintextquote}

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

\renewbibmacro*{prenote}{%
  \iffieldundef{prenote}{%
    \ifbool{withintextquote}{%
    }{%
      \bibstring{compare}\addspace
    }%
    }
    {\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}
            \singlespacing
            \itshape
            #1
        \end{quote}
    \else
        {\blx@blxinit\iffootnote{\smaller}{}\itshape #1}%
    \fi
    \endgroup}
\makeatother


\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 \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 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.

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}

\footnote{This is aThis is aThis is aThis is aThis is aThis is aThis is aThis is aThis is   aThis is aThis is a \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 aThis is aThis is aThis is aThis is aThis is aThis   is aThis is aThis is aThis is aThis is a }

\printbibliography

\end{document}
  • Hi moewe, thank you. It works perfectly fine. But there is one minor imperfection. The space before and behind the quotation in the 3 line exceeding version is not identical. Is it possible to adjust the preceding space to the following space? – Philip Mar 13 '14 at 20:38
  • @Philip The easiest would be to issue a \vspace{-1.4em} (or similar, I could not tell the best value, play around with it) before the \begin{quote}. – moewe Mar 14 '14 at 13:27

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.