jspitz / biblatex-publist

BibLaTeX bibliography support for publication lists
38 stars 4 forks source link

Conflict with linktitle and MakeSentenceCasing #37

Closed hainingpan closed 2 years ago

hainingpan commented 2 years ago

I am trying to change the base style to phys. However, there is an error message, which I don't know how to solve, Package biblatex Error: Bibliography macro '\NoCaseChange {bpl:linked}' undefined.

Is there anything I need to change to make it works? Thank you!

jspitz commented 2 years ago

It seems to work for me. MWE:

\documentclass{article}
\newcommand*\publistbasestyle{phys}
\usepackage[style=publist]{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}
    \textcite{doody}
    \printbibliography
\end{document}

grafik

Not that \NoCaseChange is a macro provided by biblatex itself, but you need a recent enough version of biblatex for that.

hainingpan commented 2 years ago

Thanks for your reply! I have checked my biblatex version, which is fine. I can also successfully compile your MWE. However, I find that it is because of linktitleall=true in the option of biblatex that gives the error message of \NoCaseChange.

Here is a MWE that can reproduce this error message.

% test.tex
\documentclass{article}
\newcommand*\publistbasestyle{phys}
\usepackage[style=publist,plauthorhandling=highlight,linktitleall=true]{biblatex}
\usepackage{amsmath,amssymb}
\plauthorname[Haining]{Pan}
\addbibresource{test.bib}
\begin{document}
\printbibliography[heading=none]
\nocite{*}

\end{document}
% test.bib
@article{pan2021interactiondriven,
  title = {Interaction-{{Driven Filling-Induced Metal-Insulator Transitions}} in {{2D Moir\'e Lattices}}},
  author = {Pan, Haining and Das Sarma, Sankar},
  year = {2021},
  month = aug,
  journal = {Phys. Rev. Lett.},
  volume = {127},
  number = {9},
  pages = {096802},
  publisher = {{American Physical Society}},
  doi = {10.1103/PhysRevLett.127.096802},
  copyright = {All rights reserved},
  day = 24
}

If I remove the option linktitleall=true, then the error goes away, which, however, also removes the link on the title undesirably.

jspitz commented 2 years ago

Yes, the linking trickery of publist does not work if sentence casing is enforced. Currently, all you can do is switch off sentence casing via

\DeclareFieldFormat{titlecase}{#1}
jspitz commented 2 years ago

Workaround:

% test.tex
\documentclass{article}
\usepackage{hyperref}
\newcommand*\publistbasestyle{phys}
\usepackage[style=publist,plauthorhandling=highlight,linktitleall=true]{biblatex}
%% WORKAROUND for https://github.com/jspitz/biblatex-publist/issues/37
\togglefalse{bpl@linktitle}
\DeclareFieldFormat{titlecase}{\usebibmacro{bpl:linked}{\MakeSentenceCase{#1}}}
%% END WORKAROUND
\usepackage{amsmath,amssymb}
\plauthorname[Haining]{Pan}
\addbibresource{37.bib}
\begin{document}
    \printbibliography[heading=none]
    \nocite{*}

\end{document}