biblatex icon indicating copy to clipboard operation
biblatex copied to clipboard

"Incomplete \iffalse" error with both `backref` option, `greek` `babel`'s language and `hyperref`

Open dbitouze opened this issue 4 years ago • 5 comments

(Disclaimer: I'm not sure whether biblatex is the culprit or not.)

When both:

  • backref option is loaded,
  • greek is one of the babel's languages loaded (even if it isn't the main one),
  • the hyperref package is loaded,

references in the \frontmatter of a document lead to the error:

! Incomplete \iffalse; all text was ignored after line 17.
<inserted text> 
                \fi

(As an unsatisfactory workaround, one can use \backtrackerfalse/\backtrackertrue.)

\documentclass[greek,english]{book}
\usepackage{csquotes}
\usepackage[backref]{biblatex}
\usepackage{babel}
\usepackage{hyperref}

\addbibresource{biblatex-examples.bib}

\begin{document}
\frontmatter
% \backtrackerfalse
\autocite{knuth:ct}
% \backtrackertrue
\mainmatter
\autocite{knuth:ct}
\printbibliography
\end{document}

dbitouze avatar Sep 03 '21 18:09 dbitouze

The problem seems to be that \blx@addbackref@i writes

\abx@aux@backref{1}{knuth:ct}{0}{{\fontencoding  {OT1}\selectfont  i}}{1}

which is due to babel-greek redefining \@roman as

\def\@roman#1{\expandafter\ensureascii\expandafter{\romannumeral#1}}

which does not seem to be liked by the backref meachnism.

If you redefine \@roman in the preamble, the document compiles:

\documentclass[greek,english]{book}
\usepackage{csquotes}
\usepackage[backref]{biblatex}
\usepackage{babel}
\usepackage{hyperref}

\makeatletter
\def\@roman#1{\romannumeral#1}
\makeatother

\addbibresource{biblatex-examples.bib}

\begin{document}
	\frontmatter
	% \backtrackerfalse
	\autocite{knuth:ct}
	% \backtrackertrue
	\mainmatter
	\autocite{knuth:ct}
	\printbibliography
\end{document}

But of course that's not a solution. Locally making \ensureascii a no-op within \blx@addbackref@i (analogouos to the solution to a similar problem proposed at https://tex.stackexchange.com/a/207267) does not seem to work.

Hope this helps to debug this.

jspitz avatar Aug 24 '22 09:08 jspitz

See also https://tex.stackexchange.com/a/619885 for a related discussion.

jspitz avatar Aug 24 '22 09:08 jspitz

See also https://tex.stackexchange.com/a/619885 for a related discussion.

BTW the workaround proposed here works in the case here as well:

\AtBeginDocument{\robustify\ensureascii}

jspitz avatar Aug 26 '22 09:08 jspitz

Also related: latex3/babel/issues/170

jspitz avatar Aug 28 '22 09:08 jspitz

This MWE demonstrates that the problem is not in biblatex, but rather in babel(-greek) or hyperref/backref:

\documentclass[greek,english]{book}
\usepackage{babel}
\usepackage[backref=page]{hyperref}

%Workaround:
%\usepackage{etoolbox}
%\AtBeginDocument{\robustify\ensureascii}

\begin{document}
	\frontmatter
	\cite{article-minimal}
	\mainmatter
	\cite{article-minimal}
	\bibliographystyle{plain}
	\bibliography{xampl}
\end{document}

jspitz avatar Aug 28 '22 10:08 jspitz