Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Biber seems to be writing some strange unicode characters when reading bib entries where the accented character í has been entered as \'\i. This causes compilation to break when using pdflatex (and utf8 input), and produce strange characters or random errors with some fonts in xelatex. How can I get biber to produce the correct character?

Minimal example bellow

\documentclass{article}

\begin{filecontents}{test.bib}
@article{sample,
    Author = {Ver{\'o}nica Mac{\'\i}as},
    Title = {My Sample Paper},
    Journal = {Journal of Sample Documents},
    Year = {2011}}
\end{filecontents}

\usepackage{iftex}
\ifXeTeX
  \usepackage{fontspec}
  \setromanfont[Mapping=tex-text]{Minion Pro}
\else
  \usepackage[utf8]{inputenc}
\fi

\usepackage[backend=biber]{biblatex}
\addbibresource{test.bib}

\begin{document}
Verónica Macías \cite{sample}
\printbibliography
\end{document}

If I run

pdflatex test
biber test
pdflatex test

I get the error

! Package inputenc Error: Unicode char \u8:́ not set up for use with LaTeX.

If instead (after cleaning auxiliary files) I run:

xelatex test
biber test
xelatex test
xelatex test

Then I would randomly get either

** ERROR ** Charstring too long: gid=1679

Or compilation succeeds, but the output looks like

enter image description here

How can I convince biber to produce the correct unicode character for í?

P.S. Yes, I know that I could solve the problem by changing the encoding of the bib file, but assume that I don't want to do this because that file is being automatically generated elsewhere, and that's what I get.

share|improve this question
    
I think you want the --bblsafechars option, but this seems to be broken on my TL2011 system so I can't currently test (and confirm). –  Joseph Wright Jul 22 '11 at 15:25
    
Bad luck, I've also just updated to TL2011 and when using this option biber crashes with Undefined subroutine &Biber::Output::BBL::latex_recode_output called at Biber/Output/BBL.pm –  Juan A. Navarro Jul 22 '11 at 15:36
    
Same here - I've reported it to the TL list (may not be relevant to this question, but something is clearly broken). –  Joseph Wright Jul 22 '11 at 15:40
    
@Joseph: I confirm it's broken. Unfortunately biber does not exist in TeX Live 2010 for universal-darwin. –  egreg Jul 22 '11 at 16:13
1  
Just to say - the --bblsafechars option should be fixed in biber 0.9.4 which was released with bibaltex 1.6 recently. Please file a bug report on the biber SF page if you have any more problems with this. –  PLK Aug 7 '11 at 17:33

2 Answers 2

up vote 6 down vote accepted

Use the correct syntax:

Author = {Ver{\'{o}}nica Mac{\'{i}}as}

Or directly

Author = {Verónica Macías}

ensuring that the file is UTF-8 encoded. Works both in pdflatex and xelatex. The \i after the main accents is not required in LaTeX since several years, but the braces around the accented letters is BibTeX syntax from the origins.

If it's really not possible to modify the documents, the following hacks seem to work

XeLaTeX:

\begingroup\lccode`\~=\string"0131
  \lowercase{\endgroup\protected\def~}#1{\char\string"00ED}
\catcode\string"0131=\active

or, more simply,

\catcode`ı=13 \protected\defı#1{í}

PdfLaTeX:

\DeclareUnicodeCharacter{0131}{í}
\DeclareUnicodeCharacter{0301}{}

More complicated things will be needed if you have also \`\i somewhere.

share|improve this answer
    
I know, but, as I said in my question, assume that I cannot modify the .bib file, lots of legacy applications and already existing .bib files encoded accents in this way. –  Juan A. Navarro Jul 22 '11 at 15:34
    
Biber is smart enough to translate \'\i into the combination U+0131 (latin small letter dotless i) followed by U+0301 (combining acute accent). Were it a bit smarter to transform into U+0069 (latin small letter i) followed by U+0301, saying \XeTeXinputnormalization=1 would solve the problem for XeLaTeX. Maybe you can do a feature request showing the source of the problem. –  egreg Jul 22 '11 at 20:58

you have to write the author entry this way:

Author = {Ver{\'o}nica Mac{\'{\i}}as},

then it works, at least with XeLaTeX

share|improve this answer
    
I know, but, as I said in my question, assume that I cannot modify the .bib file, lots of legacy applications and already existing .bib files encoded accents in this way. –  Juan A. Navarro Jul 22 '11 at 15:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.