2

I try to use \thefield in combination with \xifinlist. That works for all field, except for entrykey.

See this MWE

\documentclass{article}
\usepackage[style=verbose]{biblatex}
\addbibresource{\jobname.bib}
\begin{filecontents}{\jobname.bib}
@book{CPG,
    title={CPG},

}
\end{filecontents}
\listadd{\toto}{CPG}
\renewbibmacro{begentry}{
  \xifinlist{\thefield{entrykey}}{\toto}{oui}{non}

  \xifinlist{\thefield{title}}{\toto}{oui}{non}
}
\begin{document}
\nocite{CPG}
\printbibliography
\end{document}

I expected the first test would result "oui", but it results "non".

Any idea?

5
  • I think this is an expansion issue
    – user31729
    Apr 8, 2017 at 14:29
  • that seems to be related to the \detokenize on l. 6632 of biblatex.sty
    – Maïeul
    Apr 8, 2017 at 14:31
  • \listeadd{\toto}{\detokenize{CPG}} solve this issue…
    – Maïeul
    Apr 8, 2017 at 14:35
  • Well, this is your answer then ;-)
    – user31729
    Apr 8, 2017 at 14:47
  • yes, I added it just now. I was waiting for more test to be sure.
    – Maïeul
    Apr 8, 2017 at 14:52

1 Answer 1

2

The problem is that biblatex detokenize the entrykey field.

So

\documentclass{article}
\usepackage[style=verbose]{biblatex}
\addbibresource{\jobname.bib}
\begin{filecontents}{\jobname.bib}
@book{CPG,
    title={CPG},

}
\end{filecontents}
\listeadd{\toto}{\detokenize{CPG}}
\renewbibmacro{begentry}{
  \xifinlist{\thefield{entrykey}}{\toto}{oui}{non}

  \xifinlist{\thefield{title}}{\toto}{oui}{non}
}
\begin{document}
\nocite{CPG}
\printbibliography
\end{document}

Solve my issue.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .