特殊字符 \oe 和 BiblateX 与 XeLateX

特殊字符 \oe 和 BiblateX 与 XeLateX

我使用 Tufte-book documentclass 和 BiblateX。这是我的 sample-handout.bib 文件的示例:

@BOOK{Buchet,
author = {Buchet, Edmond},
title = {Jean-S\'{e}bastien Bach. L'\oe uvre et la vie. Deux si\`{e}cles d'\'{e}tudes et de t\'{e}moignages},
year = {1963},
publisher = {\'{E}ditions Les Libraires Associ\'{e}s},
place = {Saverne},
pagetotal = {267}
}

当我使用 XeLateX(文件夹中有 ifetex.sty)编译文档时,无法识别特殊字符 \oe,并且脚注引用中的单词“oeuvre”被替换为“uvre”(缺少特殊字符)。这是我的代码(很大一部分涉及通过 BiblateX 在侧注中创建引用,抱歉...):

\RequirePackage{luatex85}
\documentclass[nobib,symmetric,justified,marginals=raggedouter]{tufte-book}
\usepackage{fontspec}
%\setmainfont{fbb}

\ifx\ifxetex\ifluatex\else
%\ifxetex
  \newcommand{\textls}[2][5]{%
    \begingroup\addfontfeatures{LetterSpace=#1}#2\endgroup
  }
  \renewcommand{\allcapsspacing}[1]{\textls[15]{#1}}
  \renewcommand{\smallcapsspacing}[1]{\textls[10]{#1}}
  \renewcommand{\allcaps}[1]{\textls[15]{\MakeTextUppercase{#1}}}
  \renewcommand{\smallcaps}[1] 
   {\smallcapsspacing{\scshape\MakeTextLowercase{#1}}}
  \renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{#1}}}
  \usepackage{fontspec}
  \setmainfont{TeX Gyre Pagella}
  \setsansfont{TeX Gyre Heros}[Scale=MatchUppercase]
  \fi

\usepackage{microtype}
\usepackage{fancyvrb} 

\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear-icomp]{biblatex}
\makeatletter
\newbibmacro*{adtcite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\iffieldequals{namehash}{\cbx@lasthash}
          {\setunit{\compcitedelim}}
          {\printnames{labelname}%
           \setunit*{\printdelim{nameyeardelim}}%
           \printlabeldateextra
           \setunit*{\printdelim{nametitledelim}}%
           \savefield{namehash}{\cbx@lasthash}}%
        \usebibmacro{cite:title}}}%
    {\usebibmacro{cite:shorthand}%
     \usebibmacro{cite:reinit}}%
  \setunit{\multicitedelim}}
\makeatother
\newbibmacro*{cite:title}{%
  \printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}
\DeclareCiteCommand{\fadtcite}[\mkbibfootnote]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{adtcite}}
  {}
  {\usebibmacro{cite:postnote}}
\DeclareMultiCiteCommand{\fadtcites}[\mkbibfootnote]{\fadtcite}{\setunit{\multicitedelim}}
\DeclareAutoCiteCommand{fadt}{\fadtcite}{\fadtcites}
\ExecuteBibliographyOptions{autocite=fadt}
\usepackage{mdframed}
\newmdenv[skipabove=3.5ex plus 1ex minus .2ex,% Equal to section title spacing
  innerleftmargin=0pt,innerrightmargin=0pt,%
  innerbottommargin=0pt,innertopmargin=0pt,linewidth=0pt,innermargin=0pt,%
  outermargin=\dimexpr-\marginparwidth-\marginparsep\relax]{mdfullwidth}
\defbibenvironment{bibliography}
  {\list{}{\parsep\bibparsep}}
  {\endlist}
  {\item}
\AtEveryBibitem{\hskip-\bibhang}
\addbibresource{sample-handout.bib}

\begin{document}
How to fix the problem with "\oe uvre"\autocite[p.~42]{Buchet}?

\begin{fullwidth}
\bibhang=0pt
\printbibliography
\end{fullwidth}
\end{document}

我认为问题出在 fontspec 或 inputec 上,但我不知道问题出在哪里。我该如何修复这个问题?

答案1

如果我按照发布的方式编译 MWE,我会得到错误

("C:\Program Files\MiKTeX 2.9\tex/latex/microtype\microtype.sty"

! LaTeX Error: Command \textls already defined.
               Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.

这是因为你的代码块

\ifx\ifxetex\ifluatex\else
%\ifxetex
  \newcommand{\textls}[2][5]{%
    \begingroup\addfontfeatures{LetterSpace=#1}#2\endgroup
  }
  \renewcommand{\allcapsspacing}[1]{\textls[15]{#1}}
  \renewcommand{\smallcapsspacing}[1]{\textls[10]{#1}}
  \renewcommand{\allcaps}[1]{\textls[15]{\MakeTextUppercase{#1}}}
  \renewcommand{\smallcaps}[1] 
   {\smallcapsspacing{\scshape\MakeTextLowercase{#1}}}
  \renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{#1}}}
  \usepackage{fontspec}
  \setmainfont{TeX Gyre Pagella}
  \setsansfont{TeX Gyre Heros}[Scale=MatchUppercase]
  \fi

定义\textls,它microtype想要定义。

我觉得这个测试\ifx\ifxetex\ifluatex\else <stuff> \fi有点奇怪。我不太确定我是否理解这个测试应该做什么,但如果我猜得没错,那么\iftutex <stuff> \fi用现代的 来做这个测试会更规范iftex

无论如何,该块都会导致 的加载问题microtype。此外,它会加载与您指定的字体不同的字体(它表示\setmainfont{TeX Gyre Pagella}覆盖您的\setmainfont{fbb})。

除非你有充分的理由保留此代码块,否则我会完全删除它。删除代码块后不会出现错误,并且\oe(œ)在引文和参考书目中显示为预期内容

\RequirePackage{luatex85}
\documentclass[nobib,symmetric,justified,marginals=raggedouter]{tufte-book}
\usepackage{fontspec}
\setmainfont{fbb}

\usepackage{microtype}
\usepackage{fancyvrb} 

\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear-icomp]{biblatex}
\makeatletter
\newbibmacro*{adtcite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\iffieldequals{namehash}{\cbx@lasthash}
          {\setunit{\compcitedelim}}
          {\printnames{labelname}%
           \setunit*{\printdelim{nameyeardelim}}%
           \printlabeldateextra
           \setunit*{\printdelim{nametitledelim}}%
           \savefield{namehash}{\cbx@lasthash}}%
        \usebibmacro{cite:title}}}%
    {\usebibmacro{cite:shorthand}%
     \usebibmacro{cite:reinit}}%
  \setunit{\multicitedelim}}
\makeatother
\newbibmacro*{cite:title}{%
  \printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}
\DeclareCiteCommand{\fadtcite}[\mkbibfootnote]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{adtcite}}
  {}
  {\usebibmacro{cite:postnote}}
\DeclareMultiCiteCommand{\fadtcites}[\mkbibfootnote]{\fadtcite}{\setunit{\multicitedelim}}
\DeclareAutoCiteCommand{fadt}{\fadtcite}{\fadtcites}
\ExecuteBibliographyOptions{autocite=fadt}
\usepackage{mdframed}
\newmdenv[skipabove=3.5ex plus 1ex minus .2ex,% Equal to section title spacing
  innerleftmargin=0pt,innerrightmargin=0pt,%
  innerbottommargin=0pt,innertopmargin=0pt,linewidth=0pt,innermargin=0pt,%
  outermargin=\dimexpr-\marginparwidth-\marginparsep\relax]{mdfullwidth}
\defbibenvironment{bibliography}
  {\list{}{\parsep\bibparsep}}
  {\endlist}
  {\item}
\AtEveryBibitem{\hskip-\bibhang}

\begin{filecontents}{\jobname.bib}
@BOOK{Buchet,
  author    = {Buchet, Edmond},
  title     = {Jean-S\'{e}bastien Bach. L'\oe uvre et la vie.
               Deux si\`{e}cles d'\'{e}tudes et de t\'{e}moignages},
  year      = {1963},
  publisher = {\'{E}ditions Les Libraires Associ\'{e}s},
  place     = {Saverne},
  pagetotal = {267},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
How to fix the problem with "\oe uvre"\autocite[42]{Buchet}?

\begin{fullwidth}
\bibhang=0pt
\printbibliography
\end{fullwidth}
\end{document}

如何解决“œuvre”的问题?//Buchet 1963,Jean-Sébastien Bach。生活与生活。两世纪研究与见证,第 154 页。 42.

请注意,对于 BibTeX,LaTeX 宏转义(如\oe和)\`{e}必须用一对额外的花括号括起来才能正确排序。对于 Biber,这没有必要,因为 Biber 无论如何都会在内部将所有内容转换为 Unicode,但如果您使用 Biber,最好直接使用 Unicode 输入。

@BOOK{Buchet:bibtex,
  author    = {Buchet, Edmond},
  title     = {Jean-S{\'{e}}bastien Bach. L'{\oe}uvre et la vie.
               Deux si{\`{e}}cles d'{\'{e}}tudes et de t{\'{e}}moignages},
  year      = {1963},
  publisher = {{\'{E}}ditions Les Libraires Associ{\'{e}}s},
  place     = {Saverne},
  pagetotal = {267},
}

@BOOK{Buchet:biber,
  author    = {Buchet, Edmond},
  title     = {Jean-Sébastien Bach. L'œuvre et la vie.
               Deux siècles d'études et de témoignages},
  year      = {1963},
  publisher = {Éditions Les Libraires Associés},
  place     = {Saverne},
  pagetotal = {267},
}

Biber 转换为 Unicode 的事实很可能是您的初始代码存在问题:混乱的字体设置不会接受œ,而只接受\oe,因为 Biber 转换\oe为,œ您会遇到此问题。同样的问题在Biblatex + Xelatex 不显示重音

相关内容