Biblatex 中的非 ASCII 字符

Biblatex 中的非 ASCII 字符

我正在使用biblatex以下backend=biber文件.bib

@article{concellon_synthesis_2006,
    title = {Synthesis of Enantiopure ({αS,βS)-} or ({αR,βS)-β-Amino} Alcohols by Complete Regioselective Opening of Aminoepoxides by Organolithium Reagents {LiAlH4} or {LiAlD4}},
    volume = {71},
    number = {17},
    journal = {J. Org. Chem.},
    author = {Concellón, José M. and Bernad, Pablo L. and del Solar, Virginia and Suárez, José Ramón and García-Granda, Santiago and Díaz, M. Rosario},
    month = aug,
    year = {2006},
    pages = {6420--6426},
}

我可以使用 成功编译它biber,但是pdflatex由于文件中的α和,命令失败。令我惊讶的是,尽管这似乎是科学文献中每天出现的情况,但似乎没有解决这个问题的优雅方法。β.bbl

我有什么办法可以解决这个问题?

答案1

您必须为正在使用的、默认情况下未设置的 Unicode 字符指定含义。这里有一种方法。

\begin{filecontents*}{\jobname.bib}
@article{concellon_synthesis_2006,
    title = {Synthesis of Enantiopure ({αS,βS)-} or ({αR,βS)-β-Amino} Alcohols by Complete Regioselective Opening of Aminoepoxides by Organolithium Reagents {LiAlH4} or {LiAlD4}},
    volume = {71},
    number = {17},
    journal = {J. Org. Chem.},
    author = {Concellón, José M. and Bernad, Pablo L. and del Solar, Virginia and Suárez, José Ramón and García-Granda, Santiago and Díaz, M. Rosario},
    month = aug,
    year = {2006},
    pages = {6420--6426},
}
\end{filecontents*}
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{newunicodechar}
\newunicodechar{α}{\ensuremath{\alpha}}
\newunicodechar{β}{\ensuremath{\beta}}

\usepackage{biblatex}
\addbibresource{\jobname.bib}
\begin{document}
\cite{concellon_synthesis_2006}
\printbibliography
\end{document}

在此处输入图片描述

的使用filecontents仅仅是为了获得一个独立的 MWE。


另一种解决方案是使用\textgreek包,它也可以省去 ,newunicodechar因为它将 Unicode 希腊字母的含义定义为与其\text...对应字母的含义相同。因此α变成了\textalpha

\begin{filecontents*}{\jobname.bib}
@article{concellon_synthesis_2006,
    title = {Synthesis of Enantiopure ({αS,βS)-} or ({αR,βS)-β-Amino} Alcohols by Complete Regioselective Opening of Aminoepoxides by Organolithium Reagents {LiAlH4} or {LiAlD4}},
    volume = {71},
    number = {17},
    journal = {J. Org. Chem.},
    author = {Concellón, José M. and Bernad, Pablo L. and del Solar, Virginia and Suárez, José Ramón and García-Granda, Santiago and Díaz, M. Rosario},
    month = aug,
    year = {2006},
    pages = {6420--6426},
}
\end{filecontents*}
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{textgreek}

\usepackage{biblatex}
\addbibresource{\jobname.bib}
\begin{document}
\cite{concellon_synthesis_2006}
\printbibliography
\end{document}

结果是

在此处输入图片描述

答案2

biber 的设计目的就是能够在这种情形下自动重新编码为 TeX 宏。biber 手册对此进行了解释 - 您面临的问题是inputencPDFLaTeX 的限制,它无法理解所有 UTF-8。使用safeinputenc选项加载 biblatex,然后使用--output_safecharsset=full选项调用 biber。这将自动为您完成所有操作。

要切换到 textgreek 变体,这很容易,您必须有一个自定义的 UTF-8<->TeX 宏 XML 转换数据文件(biber 附带一个默认值,适合大多数用途)。要使用 textgreek 变体,请获取此文件:

https://www.dropbox.com/s/ln3ht1xd9mmgu9w/recode.xml

然后像这样调用 biber:

biber --recodedata=<path to file downloaded above>

然后只要确保你\usepackage{textgreek}的 LaTeX 文档中有使用safeinputencbiblatex 选项即可。

处理这个问题的一个更简单的方法是切换到 LuaLaTeX,因为 biber 处理 UTF-8 毫无问题。这样就不需要特殊的 biber 选项或safeintputencbiblatex 选项了。

答案3

如果您想使用 Unicode,您应该考虑使用字体规格以及带有希腊字母的 Unicode 字体(几乎所有 Unicode 字体都有)。这里我使用了 Linux Libertine。

\documentclass{article}
\usepackage{filecontents,fontspec,biblatex}
\setmainfont[Ligatures=TeX]{Linux Libertine O}

\begin{filecontents}{\jobname.bib}
@article{concellon_synthesis_2006,
    title = {Synthesis of Enantiopure ({αS,βS)-} or ({αR,βS)-β-Amino} Alcohols by Complete Regioselective Opening of Aminoepoxides by Organolithium Reagents {LiAlH4} or {LiAlD4}},
    volume = {71},
    number = {17},
    journal = {J. Org. Chem.},
    author = {Concellón, José M. and Bernad, Pablo L. and del Solar, Virginia and Suárez, José Ramón and García-Granda, Santiago and Díaz, M. Rosario},
    month = aug,
    year = {2006},
    pages = {6420--6426}}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\cite{concellon_synthesis_2006}
\printbibliography
\end{document}

在此处输入图片描述

答案4

感谢 PLK 和 cgnieder,我终于找到了一个令我满意的解决方案。它基于 PLK 的答案,但也确保希腊字母是直立的。

\begin{filecontents*}{\jobname.bib}
@article{concellon_synthesis_2006,
    title = {Synthesis of Enantiopure ({αS,βS)-} or ({αR,βS)-β-Amino} Alcohols by Complete Regioselective Opening of Aminoepoxides by Organolithium Reagents {LiAlH4} or {LiAlD4}},
    volume = {71},
    number = {17},
    journal = {J. Org. Chem.},
    author = {Concellón, José M. and Bernad, Pablo L. and del Solar, Virginia and Suárez, José Ramón and García-Granda, Santiago and Díaz, M. Rosario},
    month = aug,
    year = {2006},
    pages = {6420--6426},
}
\end{filecontents*}
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textgreek}

\usepackage[backend=biber, safeinputenc]{biblatex}
\addbibresource{\jobname.bib}
\begin{document}
\cite{concellon_synthesis_2006}
\printbibliography
\end{document}

现在,宏文件(位于比贝尔 CTAN /biblatex-biber-1.5/lib/Biber/LaTeX/recode_data.xml) 必须进行编辑。这:

<maps type="greek" set="full">
    <map><from>alpha</from>      <to hex="3B1">α</to></map>
    <map><from>beta</from>       <to hex="3B2">β</to></map>
    ...
    <map><from>Omega</from>      <to hex="3A9">Ω</to></map>
  </maps>

必须改为:

  <maps type="wordmacros" set="base,full">
    <map><from>textalpha</from>      <to hex="3B1">α</to></map>
    <map><from>textbeta</from>       <to hex="3B2">β</to></map>
    ...
    <map><from>textOmega</from>      <to hex="3A9">Ω</to></map>
  </maps>

并保存在您的工作目录中。该包textgreek提供了\textalpha命令,可生成直立的α

Biber使用以下选项运行:

--recodedata=recode_data.xml

接下来的pdflatex运行将产生一个带有直立希腊字母的参考书目。

相关内容