[Tex/LaTex] error using special characters in in biblatex with LuaLaTeX

biblatexluatexunicode

I am using LuaLaTeX and biblatex which the biblatex manual says should be able to compile utf. At the bottom of this message is a minimal non-working example. In the final PDF it just deletes all the accented characters. I can go in and manually correct the .bbl file (replacing èwith \'e and ö = \"o) but this isn't an ideal solution.

The errors I get when running BibTeX (with biber of course as the default engine) are

INFO - This is Biber 1.5
INFO - Logfile is 'Biblatex.blg'
INFO - Reading 'Biblatex.bcf'
INFO - Found 3 citekeys in bib section 0
INFO - Processing section 0
INFO - Looking for bibtex format file 'Biblatex.bib' for section 0
INFO - Decoding LaTeX character macros into UTF-8
INFO - Found BibTeX data source 'Biblatex.bib'
INFO - Overriding locale 'en_US.UTF-8' default tailoring 'level = 4' with 'level = 2'
INFO - Overriding locale 'en_US.UTF-8' default tailoring 'variable = shifted' with 'variable = non-ignorable'
INFO - Sorting 'entry' list 'cms' keys
INFO - No sort tailoring available for locale 'en_US.UTF-8'
INFO - Writing 'Biblatex.bbl' with encoding 'UTF-8'
INFO - Output to Biblatex.bbl

Then in LuaLaTeX I get this error:

l.50 ...le sentence ~\citep[1666]{Loschel:2010dn}.                                               
./Biblatex.tex:50: Package inputenc Error: Keyboard character used is undefined
(inputenc)                in inputencoding `utf8'.
See the inputenc package documentation for explanation.
Type  H   for immediate help.
 ...                                              

l.50 ...le sentence ~\citep[1666]{Loschel:2010dn}.

[1{/usr/local/texlive/2012/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]

./Biblatex.tex:53: Package inputenc Error: Unicode char \u8:èvr not set up for use with LaTeX.

with input

    \documentclass{report}  

    \usepackage[utf8]{inputenc}     %Use utf-8 encoding for foreign characters
    \usepackage[authordate,natbib,backend=biber,bibencoding=utf8]{biblatex-chicago}

    \begin{filecontents}{\jobname.bib}

    @article{Cherp:2011dt,
    author = {Cherp, Aleh and Jewell, Jessica},
    title = {{The three perspectives on energy security: intellectual history, disciplinary roots and the potential for integration}},
    journal = {Current Opinion in Environmental Sustainability},
    year = {2011},
    volume = {3},
    number = {4},
    pages = {202--212},
    month = sep,
    annote = {(0) {\&}lt;ce:title{\&}gt;Energy Systems{\&}lt;/ce:title{\&}gt;

    }
    }

    @article{Loschel:2010dn,
    author = {L{\"o}schel, Andreas and Moslener, Ulf and R{\"u}bbelke, Dirk T G},
    title = {{Indicators of energy security in industrialised countries}},
    journal = {Energy Policy},
    year = {2010},
    volume = {38},
    number = {4},
    pages = {1665--1671},
    month = may
    }

    @article{Lefevre:2010kz,
    author = {Lef{\`e}vre, Nicolas},
    title = {{Measuring the energy security implications of fossil fuel resource concentration}},
    journal = {Energy Policy},
    year = {2010},
    volume = {38},
    number = {4},
    pages = {1635--1644},
    month = jan
    }


    \end{filecontents}
    \addbibresource{\jobname.bib}

    \begin{document}

    This is the first meaningless sentence ~\citep{Cherp:2011dt}. This is another meaningless sentence ~\citep{Lefevre:2010kz}. A third meaningless example sentence ~\citep[1666]{Loschel:2010dn}.

    \printbibliography

    \end{document}

Best Answer

If you make the following changes (and stick with biber), everything should work out just fine:

% \usepackage[utf8]{inputenc}
\usepackage{fontspec}

With fontspec you have a lot more font options anyway. I recommend typing texdoc fontspec at a terminal prompt (assuming you use TeX Live and aren't stuck on Windows).

An easy way to make your file compilable by either latex/pdflatex or lualatex would be (assuming no other packages are determining what you can or can't do):

\usepackage{ifluatex}

\ifluatex % LuaTeX
  \usepackage{fontspec}
  \defaultfontfeatures{Ligatures=TeX} 
  % load your system fonts; e.g.:
  \setmainfont{LinLibertineO}
  \setsansfont{LinBiolinumO}
  \setmonofont{Inconsolata}
\else % pdfTeX
  \usepackage[utf8]{inputenc}                   
  \usepackage[T1]{fontenc}
  % load some Type 1 font; e.g.:
  \usepackage[fulloldstylenums,largesmallcaps]{kpfonts}
\fi

Something similar could be done with the package ifxetex....

Related Question