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。使用該選項載入 biblatex safeinputenc,然後使用該--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運行應該會產生帶有直立希臘字母的參考書目。

相關內容