# Biblatex ibid in lowercase if prenote is present

I've defined my own biblatex style (see MWE) which uses citations in footnotes. I've patched the prenote command, because otherwise biblatex writes the prenote text in lowercase (note: I don't want to write the prenote in uppercase within the autocite command, because I want to be able to switch back to in text citation).

But now I have a problem with the third citation where the abbreviated cf. is used. The following ibid should be printed in lowercase letters just like in the second citation (before the patching the ibid was written in lowercase but also the cf.). If no prenote is present the ibid should be printed like the fourth citation.

How can I achieve the desired behavior and maybe get rid of the patching, because it is a bit slow.

MWE:

\documentclass{article}
\usepackage[style=alphabetic, autocite=footnote,backend=biber,ibidtracker=constrict]{biblatex}
\usepackage{xpatch}
\usepackage{xstring}

\begin{filecontents*}{bibliography.bib}
@BOOK{ABC,
author = {Cornelisse, J. W. and Schöyer, H. Ferry R. and Wakker, Karel F.},
title = {Rocket Propulsion and Spaceflight Dynamics},
year = {1979},
publisher = {Pitman},
}
\end{filecontents*}

\providecommand*{\mkibid}[1]{#1}
\newbool{cbx:loccit}

\DeclareBibliographyOption{ibidpage}[true]{%
\ifstrequal{#1}{true}
{\ExecuteBibliographyOptions{loccittracker=constrict}}
{\ExecuteBibliographyOptions{loccittracker=false}}}

\ExecuteBibliographyOptions{ibidpage = true}

\newbibmacro*{cite:ibid}{%
\global\boolfalse{cbx:loccit}%
\printtext[bibhyperref]{\bibstring[\mkibid]{ibidem}}%
\ifloccit
{\global\booltrue{cbx:loccit}}
{}}

\newbibmacro*{cite:postnote}{%
\ifbool{cbx:loccit}
{}
{\usebibmacro{postnote}}}

\newbibmacro*{cite:prenote}{%
\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
{\usebibmacro{prenote}}
{\usebibmacro{prenote}}}

\DeclareCiteCommand{\smartcite}[\iffootnote\mkbibparens\mkbibfootnote]
{\usebibmacro{cite:prenote}}
{\usebibmacro{citeindex}%
\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
{\usebibmacro{cite:ibid}\usebibmacro{cite:postnote}}
{\printtext[brackets]{\usebibmacro{cite}\usebibmacro{postnote}}}}
{\multicitedelim}
{}

\DeclareAutoCiteCommand{footnote}[f]{\smartcite}{\smartcites}

\DeclareFieldFormat{sentencecase}{\StrLeft{#1}{1}[\firstchar]\StrLen{#1}[\textlaenge]\StrMid{#1}{2}{\textlaenge}[\restchars]\autocap{\firstchar}\restchars}
\xpatchbibmacro{prenote}{\printfield{prenote}}{\printfield[sentencecase]{prenote}}{}{}
\xpatchbibmacro{multiprenote}{\printfield{multiprenote}}{\printfield[sentencecase]{multiprenote}}{}{}

\bibliography{bibliography.bib}

\begin{document}
Work\autocite[see][20]{ABC}.\\
Same work with a prenote without a punctation\autocite[see][20]{ABC}.\\
Same work with a prenote with punctation\autocite[cf.][20]{ABC}.\\
Same work and no prenote\autocite[][20]{ABC}.
\end{document}

• @moewe Thank you, but then I have to change all my previously written citations. I wonder why biblatex does the right thing before the patching where the ibid was printed in lowercase letters. So before the patching it was obvious for biblatex that the dot is just an abbreviation dot. – user2653422 Oct 16 '14 at 17:36
• Use \autocite[cf.\isdot][20]{ABC}. You have to tell biblatex that the . in the prenote is not a full stop (sentence ending), but an abbreviation dot in this instance, as biblatex will automatically capitalise after the former, but not after a . of the latter kind. (See also this related question) – moewe Oct 16 '14 at 17:37
• The standard behaviour for prenote is \DeclareFieldFormat{prenote}{#1\isdot} (i.e. biblatex assumes a . is an abbreviation dot, never a sentence ending), but after your patching, you print the prenote with \DeclareFieldFormat{sentencecase}, whose definition does not have the \isdot in it. If you add the \isdot to the end of the \DeclareFieldFormat{sentencecase} bit (after \restchars) it seems to work again. – moewe Oct 16 '14 at 17:41
• By the way: you could just go with \DeclareFieldFormat{prenote}{\StrLeft{#1}{1}[\firstchar]\StrLen{#1}[\textlaenge]\StrMid{#1}{2}{\textlaenge}[\restchars]\autocap{\firstchar}\restchars\isdot} and there would be no need for the patching (which I don't think is the performance issue here, I would be more sceptical of the whole string manipulation bit). – moewe Oct 16 '14 at 17:44
• Hmmm, it seemed to work here with the MWE above. But is really hard to say what went wrong, but I guess, if the other way works for you that's fine. When I copy-and-pasted the code I suggested above, I got that error, too; but the code in my document (where it works) seems to look exactly the same - odd (no idea why that happens). You could change you \DeclareFieldFormat{sentencecase} declaration by making it a \DeclareFieldFormat{prenote} and adding a \isdot before the last curly brace - that's what I did, which seems to work. – moewe Oct 16 '14 at 18:28

The standard definition of the prenote field format is \DeclareFieldFormat{prenote}{#1\isdot} so that any . in the prenote is treated as an abbreviation dot (after which we don't start a new sentence, and thus do not capitalise). But when you define sentencecase there is no \isdot, so every . is treated as a full stop after which we capitalise.

We can use the following definition

\DeclareFieldFormat{prenote}{%
\StrLeft{#1}{1}[\firstchar]%
\StrLen{#1}[\textlaenge]%
\StrMid{#1}{2}{\textlaenge}[\restchars]%
\autocap{\firstchar}\restchars\isdot}
\DeclareFieldAlias{multiprenote}{prenote}


then there is no need to use xpatch to patch into the prenote macro because we change the field format directly.

MWE

\documentclass{article}
\usepackage[style=alphabetic, autocite=footnote,backend=biber,ibidtracker=constrict]{biblatex}
\usepackage{xstring}

\providecommand*{\mkibid}[1]{#1}
\newbool{cbx:loccit}

\DeclareBibliographyOption{ibidpage}[true]{%
\ifstrequal{#1}{true}
{\ExecuteBibliographyOptions{loccittracker=constrict}}
{\ExecuteBibliographyOptions{loccittracker=false}}}

\ExecuteBibliographyOptions{ibidpage = true}

\newbibmacro*{cite:ibid}{%
\global\boolfalse{cbx:loccit}%
\printtext[bibhyperref]{\bibstring[\mkibid]{ibidem}}%
\ifloccit
{\global\booltrue{cbx:loccit}}
{}}

\newbibmacro*{cite:postnote}{%
\ifbool{cbx:loccit}
{}
{\usebibmacro{postnote}}}

\newbibmacro*{cite:prenote}{%
\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
{\usebibmacro{prenote}}
{\usebibmacro{prenote}}}

\DeclareCiteCommand{\smartcite}[\iffootnote\mkbibparens\mkbibfootnote]
{\usebibmacro{cite:prenote}}
{\usebibmacro{citeindex}%
\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
{\usebibmacro{cite:ibid}\usebibmacro{cite:postnote}}
{\printtext[brackets]{\usebibmacro{cite}\usebibmacro{postnote}}}}
{\multicitedelim}
{}

\DeclareAutoCiteCommand{footnote}[f]{\smartcite}{\smartcites}

\DeclareFieldFormat{prenote}{%
\StrLeft{#1}{1}[\firstchar]%
\StrLen{#1}[\textlaenge]%
\StrMid{#1}{2}{\textlaenge}[\restchars]%
\autocap{\firstchar}\restchars\isdot}
\DeclareFieldAlias{multiprenote}{prenote}

\bibliography{biblatex-examples.bib}

\begin{document}
Work\autocite[see][20]{sigfridsson}.\\
Same work with a prenote without a punctation\autocite[see][20]{sigfridsson}.\\
Same work with a prenote with punctation\autocite[cf.][20]{sigfridsson}.\\
Same work and no prenote\autocite[][20]{sigfridsson}.
\end{document}


• Better late than never, i fully agree. :-) – Johannes_B Oct 10 '15 at 19:35