u 在参考书目中带有条形码 (biblatex+biber)

u 在参考书目中带有条形码 (biblatex+biber)

我有一个参考书目,其中作者姓名中包含字符 \={u}。这应该是字母 u,顶部带有横线。执行 pdflatex -> biber -> pdflatex 时,我收到错误消息:

包 inputenc 错误:Unicode 字符 \u8:? 未设置为用于 LaTex(其中 ? 是我想要看到的字符)

在普通文本中输入时,该字符可以正确打印。
当我不使用 biblatex 包,而是使用 bibtex 创建参考书目时,不会出现此错误。
有人知道我如何在参考书目中输入此字符吗?

以下是主文件的一个最小示例:

\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}

相应的.bib 如下所示:

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

答案1

由于多种原因,当给出utf8选项时inputenc,Biber 将看到它,并将文件中的重音字母翻译.bib成它们的 Unicode 对应字母;例如,\'e将变成é并且\=u将成为ū

但是,该utf8选项并未定义 Unicode 中的所有字符;其中一些字符仍然需要定义。

\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}

除了加载之外,newunicodechar您还可以执行

\DeclareUnicodeCharacter{016B}{\=u}

代替\newunicodechar{ū}{\=u}。解决此特定问题的另一种方法是添加

\input{ix-utf8enc.dfu}

紧接着\usepackage[utf8]{inputenc},因为这添加了更多可以用标准字体编码生成的 Unicode 字符。

在此处输入图片描述

我改为article只获得一页;filecontents*环境用于保持示例的独立性

答案2

您也可以使用 biber 解决这个问题,指定

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

我已经使用 1.8 版和 biblatex 2.8a 进行了测试。(biber 1.9 及以后的版本可能会有更多选项)

Biber 对原始源进行编码有两个原因。首先,为了与作者保持一致,即\"{O}leg SmithÖleg Smith被视为相同。其次,允许程序在输出中使用规范化的 LaTeX 宏(参考手动的第 3.6 节)
他们还指出,实际问题是 UTF-8 子集有限inputenc。他们进一步建议使用 XeTeX 或 LuaTeX,因为它们具有完整的 UTF-8 支持。

 --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}

输出

--decodecharsset=full还请比较一下我在回答中提到的选项biber 进食 \langle 和 \rangle 命令。我相信在 biber 1.9 中他们添加了一个null设置,允许您关闭转换。然而,这可能会导致不良的副作用。

相关内容