Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect citation output with biblatex and bibtex8 backend #1231

Open
KonradHoeffner opened this issue Nov 4, 2024 · 3 comments
Open

incorrect citation output with biblatex and bibtex8 backend #1231

KonradHoeffner opened this issue Nov 4, 2024 · 3 comments

Comments

@KonradHoeffner
Copy link

KonradHoeffner commented Nov 4, 2024

When I compile the following document with pdflatex v3.141592653-2.6-1.40.26 and bibtex or latexmk -pdf v4.83 using texlive 2024.2-3, the citation gets correctly written as Lastname and Anotherlastname 2024.
However when I use tectonic v0.15.0-2 instead (default pacman Arch Linux package "tectonic"), I get the incorrect output “Article Title” 2024.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[backend=bibtex8,bibencoding=ascii,style=authoryear]{biblatex}
\begin{filecontents}{mwe.bib}
@article{mwe,  
  title={Article Title},
  author={Firstname Lastname and Anotherfirstname Anotherlastname},
  journal={Journalname},
  volume={123},
  number={1},
  pages={1234--2345},
  year={2024}
}
\end{filecontents}
\addbibresource{mwe.bib}
\begin{document}
\cite{mwe}
\printbibliography
\end{document}
@xymaxim
Copy link

xymaxim commented Nov 29, 2024

Same issue for me for the same setup.

As for a title being printed instead of authors, that's a known behavior (see sec. 2.3.2):

The author-year citation styles which come with this package use the label field as a fallback if either the author/editor or the year is missing.

For some reason, the labelname list is not populated in our case, and so the cite:label bibmacro is called:

https://github.com/plk/biblatex/blob/v3.17/tex/latex/biblatex/cbx/authoryear.cbx#L10-L18

Comparing the main.bbl file (attached) with the one produced with texlive, I noticed that the following line is missing in the first file: \field{labelnamesource}{author}. Printing the author field with biblatex's \printnames{author} or \usebibmacro{author} works just fine. So, a new command declared with \DeclareCiteCommand could be a temporary workaround.

issue-1231-files.zip

@KonradHoeffner
Copy link
Author

@xymaxim: Thank you for confirming the bug and for the investigation. Can you elaborate on how that workaround with \DeclareCiteCommand would look like?

@xymaxim
Copy link

xymaxim commented Dec 12, 2024

@KonradHoeffner Here is below an example of the new \mycite citation command for a parenthetical, APA-like in-text citations.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[backend=bibtex8,hyperref=true,maxcitenames=2]{biblatex}
\usepackage{hyperref}
\usepackage{citeall}

\addbibresource{\jobname.bib}

\renewcommand*{\nameyeardelim}{\addcomma\space}
\renewcommand*{\finalnamedelim}{\addspace\&\space}

\DeclareNameFormat{only-family}{%
  \usebibmacro{name:family}{\namepartfamily}{}{}{}
  \usebibmacro{name:andothers}}

\newbibmacro*{authororeditor}{%
  {\ifnameundef{author}
    {\printnames[only-family]{editor}}
    {\printnames[only-family]{author}}}}

\DeclareCiteCommand{\mycite}[\mkbibparens]
  {\usebibmacro{prenote}}%
  {\printtext[bibhyperref]{%
      \usebibmacro{authororeditor}%
      \setunit{\nameyeardelim}%
      \printfield{year}}}
  {\multicitedelim}%
  {\usebibmacro{postnote}}
  
\begin{document}
\citeall[\mycite]
\printbibliography
\end{document}

Given the sample BibTeX items:

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{one-author,
  title   = {Article Title},
  author  = {First, A.},
  journal = {Journal Title},
  year    = {2024},
}
@article{two-authors,
  title   = {Article Title},
  author  = {First, A. and Second, B.},
  journal = {Journal Title},
  year    = {2024},
}
@article{three-authors,
  title   = {Article Title},
  author  = {First, A. and Second, B and Third, C.},
  journal = {Journal Title},
  year    = {2024},
}
@book{only-editor,
  title     = {Book Title},
  editor    = {Editor, A.},
  publisher = {Publisher},
  year      = 2024
}
\end{filecontents}

It outputs:

(First, 2024)
(First & Second, 2024)
(First et al., 2024)
(Editor, 2024)

Not the cleanest solution and doesn't cover all cases, but I hope it may give you an idea to adapt as per your need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants