19

I just performed an update of all packages in my texlive distribution (2015) and now I'm having trouble combining biber+biblatex with the microtype package.

The error seems to arise only when using 'special' characters in the bib file, and only when I ask to print the bibliography. Here's a minimal example:

\documentclass{article}
\usepackage{filecontents}
\usepackage{microtype}
\usepackage[backend=biber]{biblatex}


\begin{filecontents}{\jobname.bib}
@book{renyi1970,
  author = {R\'enyi, Alfr\'ed},
  location = {San Francisco},
  publisher = {Holden-Day},
  title = {Foundations of Probability},
  year = {1970},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
    \cite{renyi1970}

    \printbibliography


\end{document}

The error message I get starts like so:

! Argument of \MT@res@a has an extra }.
<inserted text> 
                \par 
l.23 

I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

Runaway argument?
##1,\OT1/cmr/m/n/10 ,##2##3\@nnil {\ifx ##2\@empty \MT@inlist@false \else \ETC.
! Paragraph ended before \MT@res@a was complete.
<to be read again> 
                   \par 
l.23 

The problem goes away if I remove the \printbibliography command, even if I use the authoryear citation style, so that the diacritics alone aren't generating the problem. That is, the following compiles as expected:

\documentclass{article}
\usepackage{filecontents}
\usepackage{microtype}
\usepackage[backend=biber, citestyle=authoryear]{biblatex}


\begin{filecontents}{\jobname.bib}
@book{renyi1970,
  author = {R\'enyi, Alfr\'ed},
  location = {San Francisco},
  publisher = {Holden-Day},
  title = {Foundations of Probability},
  year = {1970},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
    \cite{renyi1970}


\end{document}

The error seems to have something to do with the interaction between microtype and biber, since it doesn't arise with just one of them (I tried microtype with bibtex as backend for biblatex and it worked just fine; I also tried biber without microtype and it also worked just fine).

I gather microtype hasn't been updated since 2013, so I'm assuming the problem was introduced with the newer version of biber (2.4) or with the newer version of biblatex (3.3).

3
  • It is biblatex 3.3. Biber has only version 2.4`.
    – Bernard
    Commented Mar 22, 2016 at 22:22
  • 3
    I get no error if I add \usepackage[T1]{fontenc}
    – egreg
    Commented Mar 22, 2016 at 22:37
  • Hmm. Neither do I. Why would that be? This hadn't been an issue up until today.
    – apc
    Commented Mar 22, 2016 at 22:40

5 Answers 5

17

I'd say this is a bug in biblatex:

In biblatex_.sty (which is the non-legacy version that is used with biber), we find right at the beginning:

% Tests for emptiness, regardless whether the arg is macro or literal
% Expand everything and test as string
\def\ifempty#1{%
  \edef\z{#1}%
  \expandafter\ifblank\expandafter{\z}}

Now, \edef'ing user input is something that should never be done, period.

The OP's minimal example works for me if I replace \edef with \protected@edef (which is latex's "user-safe" version of \edef), but I cannot foresee which other consequences this might have.

5
  • 1
    +1. This move seems to have been introduced in the most recent update to version 3.3 because biblatex2.sty (precursor to biblatex_.sty) does not have this test.
    – jon
    Commented Mar 23, 2016 at 2:09
  • 4
    This test has already been changed in the dev version (I'd spotted much the same 'from first principles').
    – Joseph Wright
    Commented Mar 23, 2016 at 8:22
  • @JosephWright Mhhh, things have been changed a bit to use \pdfstrcmp. With the newest dev version from github I can still reproduce the issue.
    – moewe
    Commented Mar 23, 2016 at 8:37
  • 1
    +10 (if I could give 10). This bug killed the processing of a very large document and cost me much time until now. With your replacement, everything seems to work fine. :-) Commented Mar 24, 2016 at 10:53
  • +10 to you as well. Thank you very much for taking the time to look into this and saving my day. (Terrible things were about to happen).
    – mrm
    Commented Apr 20, 2016 at 16:43
8

This was, due to a biblatex change. I was trying to insulate users as much as possible from the namepart changes but this isn't really feasible because of this sort of consequence. As mentioned, the problem doesn't exist if you use fontenc which I assume you should be doing anyway. However, I have changed the problematic test in biblatex 3.4 on DEV and the problem no longer occurs.

7

I get no error if I just add \usepackage[T1]{fontenc}. It's not really clear where microtype chokes when the encoding is OT1.

biblatex 2016/03/03 v3.3 and biber version: 2.4

\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{renyi1970,
  author = {R\'enyi, Alfr\'ed},
  location = {San Francisco},
  publisher = {Holden-Day},
  title = {Foundations of Probability},
  year = {1970},
}
\end{filecontents}

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[backend=biber]{biblatex}
\usepackage{microtype}

\addbibresource{\jobname.bib}

\begin{document}

\cite{renyi1970}

\printbibliography

\end{document}

enter image description here

4
  • I'm not convinced. I always get errors with command forms in .bib files and I always use T1 and inputenc with utf8. I'm just so used to it that I do the corrections to the .bib without thinking about it even as an error any more. (Existing entries only cause issues if I cite them and I only correct them if they cause problems or I happen to feel like it, which isn't often.)
    – cfr
    Commented Mar 22, 2016 at 23:09
  • @cfr On my machine the example above runs without errors.
    – egreg
    Commented Mar 22, 2016 at 23:10
  • I think I use curly brackets around something. Maybe that's the difference.
    – cfr
    Commented Mar 22, 2016 at 23:11
  • {\'e}, for example. Or maybe they've actually fixed it in the latest version?
    – cfr
    Commented Mar 22, 2016 at 23:12
1

Run with accented characters for the .bib file. Don't forget biber understands utf8:

\documentclass{article}
\usepackage[utf8]{inputenc}
 \usepackage{filecontents}
\usepackage{microtype}
\usepackage[backend=biber]{biblatex}

\begin{filecontents}{\jobname.bib}
@book{renyi1970,
  author = {Rényi, Alfred},
  location = {San Francisco},
  publisher = {Holden-Day},
  title = {Foundations of Probability},
  year = {1970},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
    \cite{renyi1970}

    \printbibliography

\end{document} 

enter image description here

8
  • It doesn't help me to use utf8. Do you get the error if you use \'e etc. but not if you use é?
    – apc
    Commented Mar 22, 2016 at 22:41
  • I get exactly the same error as the OP, with this example.
    – egreg
    Commented Mar 22, 2016 at 22:45
  • @apc: Correct. I must use the é form to get no error. Of course this demonstrates there is a problem between microtype and biblatex, but apparently, writing accented letters is a workaround.
    – Bernard
    Commented Mar 22, 2016 at 22:49
  • With \'e or é it's exactly the same.
    – egreg
    Commented Mar 22, 2016 at 23:00
  • And loading \usepackage[utf8]{inputenc} ?
    – Bernard
    Commented Mar 22, 2016 at 23:03
1

Run biber with

biber --output-safechars <file>

However, it makes more sense to write

author = {Rényi, Alfréd},

and using lualatex or at least `

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} 

for pdflatex

2
  • @egreg: I can compile with accented characters and loading option utf8 for inputenc
    – Bernard
    Commented Mar 22, 2016 at 22:39
  • The second suggestion doesn't help me. I will try running biber with the option you mention and see if that helps.
    – apc
    Commented Mar 22, 2016 at 22:42

You must log in to answer this question.

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