"Incomplete \iffalse" error with both `backref` option, `greek` `babel`'s language and `hyperref`
(Disclaimer: I'm not sure whether biblatex is the culprit or not.)
When both:
backrefoption is loaded,greekis one of thebabel's languages loaded (even if it isn't the main one),- the
hyperrefpackage 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}
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.
See also https://tex.stackexchange.com/a/619885 for a related discussion.
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}
Also related: latex3/babel/issues/170
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}