![使用带有重音字符的 biblatex 时出现“Package inputenc 错误”](https://linux22.com/image/313704/%E4%BD%BF%E7%94%A8%E5%B8%A6%E6%9C%89%E9%87%8D%E9%9F%B3%E5%AD%97%E7%AC%A6%E7%9A%84%20biblatex%20%E6%97%B6%E5%87%BA%E7%8E%B0%E2%80%9CPackage%20inputenc%20%E9%94%99%E8%AF%AF%E2%80%9D.png)
当我尝试用以下代码编译参考书目时,我遇到了这样的错误:Package inputenc Error: Unicode char \u8:ärt not set up for use w
和这样的错误。重音字符显然存在某种问题。有人知道如何解决吗?Package inputenc Error: Unicode char \u8:é\isdot\ifblank not set
\documentclass[12pt, a4paper, oneside]{Thesis}\usepackage[]{graphicx}\usepackage[]{color}
%% maxwidth is the original width if it is less than linewidth
%% otherwise use linewidth (to make sure the graphics do not exceed the margin)
\makeatletter
\def\maxwidth{ %
\ifdim\Gin@nat@width>\linewidth
\linewidth
\else
\Gin@nat@width
\fi
}
\makeatother
\definecolor{fgcolor}{rgb}{0.345, 0.345, 0.345}
\newcommand{\hlnum}[1]{\textcolor[rgb]{0.686,0.059,0.569}{#1}}%
\newcommand{\hlstr}[1]{\textcolor[rgb]{0.192,0.494,0.8}{#1}}%
\newcommand{\hlcom}[1]{\textcolor[rgb]{0.678,0.584,0.686}{\textit{#1}}}%
\newcommand{\hlopt}[1]{\textcolor[rgb]{0,0,0}{#1}}%
\newcommand{\hlstd}[1]{\textcolor[rgb]{0.345,0.345,0.345}{#1}}%
\newcommand{\hlkwa}[1]{\textcolor[rgb]{0.161,0.373,0.58}{\textbf{#1}}}%
\newcommand{\hlkwb}[1]{\textcolor[rgb]{0.69,0.353,0.396}{#1}}%
\newcommand{\hlkwc}[1]{\textcolor[rgb]{0.333,0.667,0.333}{#1}}%
\newcommand{\hlkwd}[1]{\textcolor[rgb]{0.737,0.353,0.396}{\textbf{#1}}}%
\usepackage{framed}
\makeatletter
\newenvironment{kframe}{%
\def\at@end@of@kframe{}%
\ifinner\ifhmode%
\def\at@end@of@kframe{\end{minipage}}%
\begin{minipage}{\columnwidth}%
\fi\fi%
\def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
\colorbox{shadecolor}{##1}\hskip-\fboxsep
% There is no \\@totalrightmargin, so:
\hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
\MakeFramed {\advance\hsize-\width
\@totalleftmargin\z@ \linewidth\hsize
\@setminipage}}%
{\par\unskip\endMakeFramed%
\at@end@of@kframe}
\makeatother
\definecolor{shadecolor}{rgb}{.97, .97, .97}
\definecolor{messagecolor}{rgb}{0, 0, 0}
\definecolor{warningcolor}{rgb}{1, 0, 1}
\definecolor{errorcolor}{rgb}{1, 0, 0}
\newenvironment{knitrout}{}{} % an empty environment to be redefined in TeX
\usepackage{alltt} % Paper size, default font size and one-sided paperR
\usepackage{alltt} % Paper size, default font size and one-sided paperR
\usepackage{nameref}
\usepackage{array}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{etex}
\usepackage{lmodern}
\usepackage{caption}
\captionsetup[table]{position=below}
\usepackage{placeins} % to control figure placement with \FloatBarrier
\usepackage{fontspec}
\setmainfont{Lucida Sans}
% biblatex----------------------------------------------------------------------------------------
\usepackage[style=authoryear-comp, maxcitenames=2, maxbibnames=99, uniquelist=false,firstinits=true,sorting=nyt]{biblatex}
\DeclareNameAlias{sortname}{last-first}
\DeclareNameAlias{default}{last-first}
\usepackage{xpatch}
% No dot before number of articles
\xpatchbibmacro{volume+number+eid}{%
\setunit*{\adddot}%
}{%
}{}{}
% Number of articles in parentheses
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}
\renewbibmacro{in:}{}
\addbibresource{\jobname.bib}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{PartDoligez2003,
title={Gathering public information for habitat selection: prospecting birds cue on parental activity},
author={P{\"a}rt, Tomas and Doligez, Blandine},
journal={Proceedings of the Royal Society of London. Series B: Biological Sciences},
volume={270},
number={1526},
pages={1809--1813},
year={2003},
publisher={The Royal Society}
}
@article{HacheEtAl2013,
title={Experimental evidence for an ideal free distribution in a breeding population of a territorial songbird},
author={Hach{\'e}, Samuel and Villard, Marc-Andr{\'e} and Bayne, Erin M},
journal={Ecology},
volume={94},
number={4},
pages={861--869},
year={2013},
publisher={Eco Soc America}
}
@article{Hilden1965,
title={Habitat selection in birds: a review},
author={Hild{\'e}n, O},
journal={Ann. Zool. Fenn},
volume={2},
pages={53--74},
year={1965}
}
\end{filecontents}
\begin{document}
\cite{PartDoligez2003}\\\\
\cite{HacheEtAl2013}\\\\
\cite{Hilden1965}
\printbibliography
\end{document}
答案1
Lucida Sans Unicode
如果我将其声明为主字体,则编译没有问题。我怀疑Lucida Sans
是type 1
字体需要字体编码声明等,这可能是问题的根源。
顺便说一句,为了在参考书目中添加漂亮的引文,请加载csquotes
。没有它,我得到的是丑陋的假开头引文。此外,您可以在 .bib 文件中输入带重音符号的字母:biber
了解UTF8
。