0

If I have a note= that itself includes a \cite, then the second \cite has a leading period "."

For example, in the output below, I get Another sentence.[. 2], but I expect Another sentence.[2]

[1]
References
[1] A sentence.[2] Another sentence.[. 2] Yet another sentence[2]
[2] An Author. “A Title”. In: ().

Here's a screenshot:

Output showing ". 2" instead of "2"

Here's a MWE:

\documentclass{article}
\usepackage{biblatex}
\addbibresource{\jobname.bib}

\begin{filecontents}{\jobname.bib} @misc{AFootnote, note={A sentence.\cite{AnArticle} Another sentence.\cite{AnArticle} Yet another sentence.\cite{AnArticle}\nopunct} }

@article{AnArticle, author={An Author}, title={A Title}, } \end{filecontents}

\begin{document}

\cite{AFootnote}

\printbibliography

\end{document}

To compile the example, I use:

        pdflatex book
        biber book
        pdflatex book
        biber book
        pdflatex book
        pdflatex book

I'm running these versions of biber and pdflatex under macOS:

bash-3.2$ biber --version
biber version: 2.19
bash-3.2$ pdflatex --version
pdfTeX 3.141592653-2.6-1.40.25 (TeX Live 2023)
kpathsea version 6.3.5
Copyright 2023 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.39; using libpng 1.6.39
Compiled with zlib 1.2.13; using zlib 1.2.13
Compiled with xpdf version 4.04
bash-3.2$ 

Yes, I realize this is rather odd. A potential publisher prefers to have footnotes and references intermixed at the end of each chapter, so for footnotes, I'm using a misc with a note. Some of the footnotes themselves have references to other sources. What's odd is that it is the second citation that has the leading period. Using \supercite results in something similar with a leading ".".

1 Answers1

0

This is basically the same problem as https://github.com/plk/biblatex/issues/988 and biblatex: \parencite in note field prints spurious ; with authoryear-icomp style (as well as biblatex: \DeclareCiteCommand adds semicolon between \printfield and \printnames, but only sometimes): Within a bibliography context, biblatex does not automatically reset the punctuation buffer of \...cite commands. This allows \...cite commands to directly work together with bibliography macros and other biblatex code that produces text in the bibliography, but it does not work particularly well when there is text and punctuation that is not produced by biblatex itself (like the actual contents of fields).

Some other solutions are discussed in the links, but for your use case, where @misc is essentially always a normal footnote, I would probably tell biblatex not to assume that the note of such an entry is in the bibliography.

\documentclass{article}
\usepackage{biblatex}

\DeclareFieldFormat[misc]{note}{% \togglefalse{blx@bibliography}% #1% }

\begin{filecontents}{\jobname.bib} @misc{AFootnote, note = {A sentence.\cite{AnArticle} Another sentence.\cite{AnArticle} Yet another sentence.\cite{AnArticle}\nopunct}, } @article{AnArticle, author = {An Author}, title = {A Title}, } \end{filecontents} \addbibresource{\jobname.bib}

\begin{document} \cite{AFootnote}

\printbibliography \end{document}

[1] A sentence.[2] Another sentence.[2] Yet another sentence.[2]
[2] An Author. “A Title”. In: ().


Note that there is the notes2bib package that lets you send off footnotes to the bibliography using an interface that is more like the normal \footnote command. In particular you don't have to manually write your footnote to the .bib file (where, let's face it, they don't really belong, semantically - internally, the package does the same that you do, but it hides it from the end user). This package does not suffer from the same problem in most "normal" situations, because it defines a dedicated driver for the "footnotes" that does not use the punctuation buffer before the note is printed.

\documentclass{article}
\usepackage[backend=biber, style=numeric, sorting=none,]{biblatex}
\usepackage{notes2bib}

\begin{filecontents}{\jobname.bib} @article{AnArticle, author = {An Author}, title = {A Title}, } \end{filecontents} \addbibresource{\jobname.bib}

\begin{document} \bibnote{A sentence.\cite{AnArticle} Another sentence.\cite{AnArticle} Yet another sentence.\cite{AnArticle}}

\printbibliography \end{document}

[1] A sentence.[2] Another sentence.[2] Yet another sentence.[2].
[2] An Author. “A Title”. In: ().

If you do need a similar fix with notes2bib, you can use

\DeclareFieldFormat[bibnote]{note}{%
  \togglefalse{blx@bibliography}%
  #1%
}
moewe
  • 175,683
  • Thanks so much for the very thorough answer and tip about notes2bib. It is off topic for this question, but I may have looked at notes2bib at one time, though I'm not sure. This publisher wants footnotes and refs to use superscripts and to be intermixed at the end of each chapter, which caused issues with various packages. My hacked up system pulls the footnotes out and creates a .bib file with them, which is not very elegant. If I rework the system, I'll look at notes2bib. – Christopher Brooks Dec 28 '23 at 18:28