7

In this post I got the advise to use \autocap{s}ee within a citation, e.g. \autocite[\autocap{s}ee][5][ref] to get context sensitive capitalizing of the letter ‘s’. So if I switch from inline citation to footnote citation the word ‘see’ would be written as ‘See’.

But it is a bit cumbersome to write \autocap in all references. Is there a way to integrate this command into for example the \usebibmacro{pre note} or to create a new bibmacro like e.g. prenotecap? Then I would define:

\DeclareCiteCommand{\parencite}[\mkbibparens]
    {\usebibmacro{prenotecap}}
    {\usebibmacro{citeindex}%
        \printtext[brackets]{\usebibmacro{cite} \usebibmacro{postnote}}}
    {\multicitedelim}
    {}

and I’m done.

Would be nice if someone has a hint how to manage the \newbibmacro, because I don’t get the explanation in the biblatex user guide.

Edit: So here is a MWE, which should make it clear what I want to achieve. The word 'see' should be printed as 'See' if I use autocite=footnote and 'see' if I use autocite=inline. But I don't want to use \autocap for each reference.

\documentclass{article}
\usepackage[style=alphabetic, autocite=footnote]{biblatex}

\DeclareCiteCommand{\footcite}[\mkbibfootnote]
    {\usebibmacro{prenote}}
    {\usebibmacro{citeindex}%
        \printtext[brackets]{\usebibmacro{cite} \usebibmacro{postnote}}}
    {\multicitedelim}
    {}  

\DeclareMultiCiteCommand{\footcites}[\mkbibfootnote]%
    {\footcite}{\multicitedelim}

\DeclareAutoCiteCommand{footnote}[l]{\footcite}{\footcites}

\begin{filecontents*}{bibliography.bib}
@BOOK{Cornelisse1979,
  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*}

\bibliography{bibliography.bib}

\begin{document}
\null
\vfill

How the citation look like: \autocite[see][35]{Cornelisse1979}
How it should look like: \autocite[\autocap{s}ee][35]{Cornelisse1979}
\end{document}
  • So \newcommand*\See{\autocap{s}} doesn’t fit your needs, because sometimes you want a different word than ‘see’ that is also autocapitalized? – Crissov Feb 6 '14 at 20:12
  • @Crissov: Exactly. 'See' was only an example. Every word or sentence should work. And the first letter of the first word of the prenote should be capital if it's a footnote citation. – user2653422 Feb 6 '14 at 21:26
  • 1
    A full MWE would be helpful here to test what you really want. – StrongBad Feb 6 '14 at 21:47
  • I thought that e.g. \Cite etc. would handle this but it seems not. They also don't handle a case where an author's name is lowercase. To get biblatex to recognise it as a name, you have to use e.g. {{lastname}, {firstname}} in the bib file. But then there is no way to get it capitalised at e.g. the start of a sentence. (I'm never sure what is correct here but I assume that it should be 'Lastname adds...' even though it is 'As noted by lastname...'.) Limitations of biblatex's automatisation of capitalisation? – cfr Feb 6 '14 at 23:25
4

The biblatex package defines the \MakeSentenceCase macro that takes care of the capitalization for you, you just have to tell the bibmacro to use it. I start by defining a field format that uses \MakeSentenceCase and then patch the bibmacro to use the field format with the prenote field. I use the xpatch package to do this, but there are lots of ways to patch macros. You just need to add the following code to your preamble when you use autocite=footnote.

\DeclareFieldFormat{sentencecase}{\MakeSentenceCase{#1}}
\usepackage{xpatch}
\xpatchbibmacro{prenote}{\printfield{prenote}}{\printfield[sentencecase]{prenote}}{}{}

You will have to remove the code when you use autocite=inline. There is probably a way of automatically doing this depending on the value of autocite, but I cannot figure out how the option is used.

A full MWE:

\documentclass{article}
\usepackage[style=alphabetic, autocite=footnote]{biblatex}

\DeclareCiteCommand{\footcite}[\mkbibfootnote]
    {\usebibmacro{prenote}}
    {\usebibmacro{citeindex}%
        \printtext[brackets]{\usebibmacro{cite} \usebibmacro{postnote}}}
    {\multicitedelim}
    {}  

\DeclareFieldFormat{sentencecase}{\MakeSentenceCase{#1}}
\usepackage{xpatch}
\xpatchbibmacro{prenote}{\printfield{prenote}}{\printfield[sentencecase]{prenote}}{}{}


\DeclareMultiCiteCommand{\footcites}[\mkbibfootnote]%
    {\footcite}{\multicitedelim}

\DeclareAutoCiteCommand{footnote}[l]{\footcite}{\footcites}

\begin{filecontents*}{bibliography.bib}
@BOOK{Cornelisse1979,
  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*}

\bibliography{bibliography.bib}

\begin{document}

\null
\vfill

How the citation look like: \autocite[see][35]{Cornelisse1979}
How it should look like: \autocite[\autocap{s}ee][35]{Cornelisse1979}
\end{document}
  • Sorry I just realised that it doesn't work for \autocites, where it prints 'see'. Do you have an idea to solve this last issue? – user2653422 Feb 7 '14 at 15:41
  • I've got it! Just added the following: \xpatchbibmacro{multiprenote}{\printfield{multiprenote}}{\printfield[sentencecase]{multiprenote}}{}{} – user2653422 Feb 7 '14 at 15:45

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.