plk/biblatex-apa

\NoCaseChange related error

markvanatten opened this issue · 6 comments

I am using
LuaHBTeX, Version 1.15.0 (TeX Live 2022)
LaTeX2e <2022-06-01> patch level 5
biblatex 2022/07/12 v3.18b
apa.dbx 2022/06/22 v9.16 APA biblatex style data model
biber version: 2.18

The file below compiles correctly if the biblatex option 'style=apa' is commented out, but with it, biber come to give an error:

WARN - I didn't find a database entry for '\NoCaseChange {Behmann1959}' (section 0).

\documentclass{article}

\begin{filecontents*}[overwrite]{test-nocasechange.bib}

@Article{Behmann1959,
  author =       "H. Behmann",
  title =        "Der Prädikatenkalkül mit limitierten Variabelen",
  subtitle = "Grundlegung einer natürlichen exakten Logik",
  journal =      "Journal of Symbolic Logic",
  volume =       "24",
number = "2",  
pages =        "112--140",
  date =         "1959",
}

@Article{Ackermann,
  author =       "W. Ackermann",
  title =        "Review of \citet{Behmann1959}",
  journal =      "Zentralblatt für Mathematik und ihre
                 Grenzgebiete",
  volume =       "Zbl 0095.24201",
}

\end{filecontents*}

\usepackage[
backend = biber, 
natbib=true, 
style=apa, 
]{biblatex} 

\addbibresource{test-nocasechange.bib}

\begin{document}

\citep{Ackermann,Behmann1959}

\printbibliography
\end{document}

Things work with an explicit \NoCaseChange (which I think is the saner markup anyway)

\documentclass{article}

\usepackage[
backend = biber, 
natbib=true, 
style=apa, 
]{biblatex} 
\addbibresource{\jobname.bib}

\begin{filecontents*}{\jobname.bib}
@article{Behmann1959,
  author   = {H. Behmann},
  title    = {Der Prädikatenkalkül mit limitierten Variabelen},
  subtitle = {Grundlegung einer natürlichen exakten Logik},
  journal  = {Journal of Symbolic Logic},
  volume   = {24},
  number   = {2},  
  pages    = {112--140},
  date     = {1959},
}
@article{Ackermann,
  author  = {W. Ackermann},
  title   = {Review of \NoCaseChange{\citet{Behmann1959}}},
  journal = {Zentralblatt für Mathematik und ihre Grenzgebiete},
  volume  = {Zbl 0095.24201},
}
\end{filecontents*}


\begin{document}
\citep{Ackermann,Behmann1959}

\printbibliography
\end{document}

I'll try and see what else can be done here.

Thanks -- especially for the point about saner markup.

@josephwright The example worked fine with an older version of the LaTeX kernel, though. It seems that biblatex's brace protection code and the LaTeX3 code to avoid messing with the wrong arguments interfere in some way to sneak in the undesirable \NoCaseChange here. Unfortunately, I don't fully understand the code in https://github.com/plk/biblatex/blob/dev/tex/latex/biblatex/blx-case-expl3.sty (cf. plk/biblatex#960), so I don't know where to start looking into this.

@moewew I'm working on it

@josephwright Thank you very much.

Meanwhile I found that double braces help

\documentclass{article}

\usepackage[
backend = biber, 
natbib=true, 
style=apa, 
]{biblatex} 
\addbibresource{\jobname.bib}

\begin{filecontents*}{\jobname.bib}
@article{Behmann1959,
  author   = {H. Behmann},
  title    = {Der Prädikatenkalkül mit limitierten Variabelen},
  subtitle = {Grundlegung einer natürlichen exakten Logik},
  journal  = {Journal of Symbolic Logic},
  volume   = {24},
  number   = {2},  
  pages    = {112--140},
  date     = {1959},
}
@article{Ackermann,
  author  = {W. Ackermann},
  title   = {Review of {{\citet{Behmann1959}}}},
  journal = {Zentralblatt für Mathematik und ihre Grenzgebiete},
  volume  = {Zbl 0095.24201},
}
\end{filecontents*}


\begin{document}
\citep{Ackermann,Behmann1959}

\printbibliography
\end{document}

but as I say my preference certainly is to drop the BibTeX-style brace protection and go for the saner LaTeX3 interface with \NoCaseChange and friends

\documentclass{article}

\usepackage[
  backend = biber,
  natbib=true, 
  style=apa, 
  bibtexcaseprotection=false,
]{biblatex} 
\addbibresource{\jobname.bib}

\begin{filecontents*}{\jobname.bib}
@article{Behmann1959,
  author   = {H. Behmann},
  title    = {Der Prädikatenkalkül mit limitierten Variabelen},
  subtitle = {Grundlegung einer natürlichen exakten Logik},
  journal  = {Journal of Symbolic Logic},
  volume   = {24},
  number   = {2},  
  pages    = {112--140},
  date     = {1959},
}
@article{Ackermann,
  author  = {W. Ackermann},
  title   = {Review of \NoCaseChange{\citet{Behmann1959}}},
  journal = {Zentralblatt für Mathematik und ihre Grenzgebiete},
  volume  = {Zbl 0095.24201},
}
\end{filecontents*}


\begin{document}
\citep{Ackermann,Behmann1959}

\printbibliography
\end{document}

where alternatively (and more conveniently) it is even enough to register \citet as a non-casechange command

\documentclass{article}

\usepackage[
  backend = biber,
  natbib=true, 
  style=apa, 
  bibtexcaseprotection=false,
]{biblatex} 
\addbibresource{\jobname.bib}

\AddToNoCaseChangeList{\citet}

\begin{filecontents*}{\jobname.bib}
@article{Behmann1959,
  author   = {H. Behmann},
  title    = {Der Prädikatenkalkül mit limitierten Variabelen},
  subtitle = {Grundlegung einer natürlichen exakten Logik},
  journal  = {Journal of Symbolic Logic},
  volume   = {24},
  number   = {2},  
  pages    = {112--140},
  date     = {1959},
}
@article{Ackermann,
  author  = {W. Ackermann},
  title   = {Review of \citet{Behmann1959}},
  journal = {Zentralblatt für Mathematik und ihre Grenzgebiete},
  volume  = {Zbl 0095.24201},
}
\end{filecontents*}


\begin{document}
\citep{Ackermann,Behmann1959}

\printbibliography
\end{document}

@moewew I'm not 100% sure what is 'right' here: the BibTeX approach to something reading \foo{...} is to case-change ..., so we do need \NoCaseChange in general - I'd say 'avoid the BibTeX-style approach here' is likely the best answer.