5

I have a bibliography which contains the character \={u} in an author's name. This should be the letter u with a bar on top. When executing pdflatex -> biber -> pdflatex, I get the error message:

Package inputenc Error: Unicode char \u8:? not set up for use with LaTex (where ? is the character I would like to see)

The character is printed correctly when entered in normal text.
The error doesn't occur when I'm not using the package biblatex, but create my bibliography with bibtex.
Does anyone have an idea, how I can enter this character in my bibliography?

Here is a minimal example of the main file :

\documentclass[a4paper, 11pt,BCOR=1.5cm]{scrbook}

\usepackage[utf8]{inputenc}
\usepackage[backend=biber]{biblatex}
\addbibresource{MinEx_ubar_Bib.bib}

\begin{document}
   Bl\={u}b
   bla \cite{ubar} 

   \printbibliography
\end{document}

The corresponding .bib looks like this:

@Article{ubar,
Title                    = {blabla},
Author                   = {Bl\={u}b},
Journal                  = {xxx},
Year                     = {2013},
}
5

For several reasons, when the utf8 option to inputenc is given, Biber will see it and it will translate accented letters in the .bib file to their Unicode counterparts; for instance, \'e will become é and \=u will become ū.

However, the utf8 option doesn't define all characters in Unicode; some of them still need a definition.

\begin{filecontents*}{\jobname.bib}
@Article{ubar,
Title                    = {blabla},
Author                   = {Bl\={u}b},
Journal                  = {xxx},
Year                     = {2013},
}
\end{filecontents*}

\documentclass[a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}

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

\newunicodechar{ū}{\=u}

\begin{document}
Bl\={u}b Blūb
bla \cite{ubar}

\printbibliography
\end{document}

Instead of loading newunicodechar you could do

\DeclareUnicodeCharacter{016B}{\=u}

in place of \newunicodechar{ū}{\=u}. Another way to solve this particular problem is to add

\input{ix-utf8enc.dfu}

just after \usepackage[utf8]{inputenc}, because this adds more Unicode characters that can be produced with the standard font encodings.

enter image description here

I changed to article in order to get just one page; the filecontents* environment is used to keep the example self-contained

  • Isn't that a dupe? We have so many of that kind. – Johannes_B Mar 26 '15 at 18:57
  • @Johannes_B Possibly so. The problem is that the unknown character is always a new one. – egreg Mar 26 '15 at 19:00
  • Thanks. I don't understand why I don't need to define the character for usage in the main text. But since I'll probably never need such characters again, I don't care too much. Sorry if it is a dupe - I searched quite some time, but it is difficult to find something you even can't type on your keyboard... – coccinelle Mar 26 '15 at 19:16
  • @coccinelle You are inputting the character in its low level form, but biber is converting it to real unicode, since your document is utf8 encoded. Might be worth adding to the answer, if no other is floating around. – Johannes_B Mar 26 '15 at 20:07
3

You can also workaround this problem with biber, specifying

biber --output_safechars --output_safecharsset=full <main[.bcf]>

I have tested this with version 1.8 and biblatex 2.8a. (There might be some more options in biber 1.9 and the future)

Biber encodes the original source for two reasons. First, to keep consistency with the authors, i.e. \"{O}leg Smith and Öleg Smith are treated the same. Second, to allow the program to use normalised LaTeX macros in the output (ref. the manual section 3.6)
They also state that the actual problem is the limited UTF-8 subset of inputenc. They further recommend the use of XeTeX or LuaTeX since they come with full UTF-8 support.

 --output_safechars
       Try to convert UTF-8 chars into LaTeX macros when writing the
       output.  This can prevent unknown char errors when using PDFLaTeX
       and inputenc as this doesn't understand all of UTF-8. Note, it is
       better to switch to XeTeX or LuaTeX to avoid this situation. By
       default uses the --output_safecharsset "base" set of characters.
       The legacy option --bblsafechars is supported as an alias.

  --output_safecharsset=[recode set name]
       The set of characters included in the conversion routine for
       --output_safechars. Set to "full" to try harder with a much larger
       set or "base" to use a basic set. Default is "base" which is fine
       for most use cases. You may need to load more macro packages to
       deal with the results of "full" (Dings, Greek characters, special
       symbols etc.). The recode sets are defined in the reencoding data
       file which can be customised. See the --recodedata option and the
       PDF manual.  The legacy option --bblsafecharsset is supported as an
       alias.
\begin{filecontents}{\jobname.bib}
@Article{ubar,
author = {Bl\={u}b},
title = {blabl\={a}},
journal = {xxxx},
year = {2013}
}
\end{filecontents}

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[backend=biber]{biblatex}
\addbibresource{\jobname.bib}

\begin{document}
    \nocite{*}
    \printbibliography
\end{document}

output

Compare also the option --decodecharsset=full as mentioned in my answer to biber eating \langle and \rangle commands. I believe in biber 1.9 they have added a nullset, allowing you to turn off conversion. This, however, might lead to unwanted side effects.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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