I use biblatex to build:
- An automatic index of the cited author of the bibliography.
- A bibliography in a single language with the punctuation rules taken from langid of each entry.
As discussed in the comments of this last answer, the solutions work very independently, but I get the following error when trying to mix both:
! Undefined control sequence.
\blx@nameparser@i ...pandafter {\mblx@currentname
}{\mblx@exemptfields } {\b...
l.142 \footcite{compagnon}
I tried to "exempt" the author field from the patch, without success.
Is this achievable or would the patch become unreasonable?
Here's a test code, commenting the long patch allows to build the index:
\documentclass{article}
\usepackage[english,french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{makeidx}
\usepackage[backend=biber,
style=verbose-trad2,
singletitle=true,
indexing=cite,
]{biblatex}
\makeindex
\renewbibmacro*{citeindex}{
\ifciteindex
{\indexnames{labelname}}
{}}
\makeatletter
\newcommand{\mblx@exemptfields}{}
\newrobustcmd{\ExemptFromLanguageSwitching}{%
\forcsvlist{\listgadd\mblx@exemptfields}}
\def\blx@thefakelangenv{otherlanguage}%
\def\blx@beglang@fake{%
\blx@clearlang
\begingroup
\ifdef\abx@field@langid
{\def\blx@endlang@fake{%
\end{otherlanguage}%
\endgroup}%
\begin{otherlanguage}{\abx@field@langid}}
{}}
\let\blx@endlang@fake\relax
\renewrobustcmd*{\blx@imc@printfield}[2][]{%
\blx@imc@iffieldundef{#2}
{\blx@nounit}
{\blx@getformat\blx@theformat{ffd}{#1}{#2}%
\ifdefvoid\blx@theformat
{\blx@nounit}
{\blx@begunit
\ifinlist{#2}{\mblx@exemptfields}
{}
{\let\blx@theformat@outer\blx@theformat
\def\blx@theformat##1{\blx@theformat@outer{\blx@beglang@fake ##1\blx@endlang@fake}}}%
\edef\currentfield{#2}%
\expandafter\expandafter
\expandafter\blx@theformat
\expandafter\expandafter
\expandafter{\csname abx@field@#2\endcsname}%
\blx@endunit}}}
\catcode`&=3
\def\blx@printnames#1#2#3#4{%
\blx@imc@ifnameundef{#4}
{\blx@nounit}
{\def\mblx@currentname{#4}%
\blx@getformat\blx@thewrapperformat{nwd}{#1}{#4}%
\ifdefvoid\blx@thewrapperformat
{\blx@nounit}
{\blx@getformat\blx@theformat{nfd}{#1}{#4}%
\ifdefvoid\blx@theformat
{\blx@nounit}
{\blx@begunit
\blx@namesetup{#2}{#3}{#4}%
\blx@thewrapperformat{\expandafter\blx@nameparser\blx@thedata{}&}%
\blx@endunit}}}}
\long\def\blx@nameparser@i#1#2{%
\begingroup
\ifblank{#1}
{}
{\setkeys{blx@opt@name}{#1}}%
\setkeys{blx@opt@namepart}{#2}%
\expandafter\ifinlist\expandafter{\mblx@currentname}{\mblx@exemptfields}
{\blx@theformat{#2}}
{\blx@beglang@fake\blx@theformat{#2}\blx@endlang@fake}%
\endgroup}
\def\blx@printlist#1#2#3#4{%
\blx@imc@iflistundef{#4}
{\blx@nounit}
{\def\mblx@currentlist{#4}%
\blx@getformat\blx@thewrapperformat{lwd}{#1}{#4}%
\ifdefvoid\blx@thewrapperformat
{\blx@nounit}
{\blx@getformat\blx@theformat{lfd}{#1}{#4}%
\ifdefvoid\blx@theformat
{\blx@nounit}
{\blx@begunit
\blx@listsetup{#2}{#3}{#4}%
\blx@thewrapperformat{\expandafter\blx@listparser\blx@thedata{}&}%
\blx@endunit}}}}
\long\def\blx@listparser#1{%
\ifblank{#1}
{\blx@listbreak}
{\ifnum\c@listcount<\c@liststart
\else
\expandafter\ifinlist\expandafter{\mblx@currentlist}{\mblx@exemptfields}
{\blx@theformat{#1}}
{\blx@beglang@fake\blx@theformat{#1}\blx@endlang@fake}%
\fi
\advance\c@listcount@ne
\ifnum\c@listcount>\c@liststop
\expandafter\blx@listbreak
\fi
\blx@listparser}}
\makeatother
\catcode`&=4
\ExemptFromLanguageSwitching{url,doi,eprint,pages}
\begin{filecontents}[force]{\jobname.bib}
@book{compagnon,
author = {Compagnon, Antoine and Someone Else},
translator = {Même, Moi},
date = {1998},
title = {Titre: aléatoire?},
pages = {306-723},
langid = {french},
url = {https://example.com/~stuff/more.pdf},
}
@book{glashow,
author = {Glashow, Sheldon and Someone Else},
title = {Random: title?},
translator = {Self, My},
date = {1961},
pages = {579-588},
langid = {english},
url = {https://example.com/~stuff/more.pdf},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\footcite{compagnon}
\footcite{glashow}
\printindex
\printbibliography
\end{document}
\footcite[36]{compagnon}– letax Mar 15 '22 at 17:45postnotefield from the language switching. – moewe Mar 15 '22 at 19:29