biblatex:将重音字母分类到常规字母类别中

biblatex:将重音字母分类到常规字母类别中

我想在参考书目中每个字母部分前添加一个大写字母。以下 .bib 条目导致错误“包 biblatex 错误:未声明类别‘Ç’。\endentry”:

@Article{Cakir2011,
  author    = {Esra {\c{C}}ak{\i}r and E. Allen Foegeding},
  journal   = {Food Hydrocolloids},
  title     = {Combining protein micro-phase separation and protein{\textendash}polysaccharide segregative phase separation to produce gel structures},
  year      = {2011},
  number    = {6},
  pages     = {1538-1546},
  volume    = {25},
}

在.bbl文件中,结果是这样的:

family={{Ç}ak{ı}r},
           familyi={Ç\bibinitperiod},

因此,biblatex 尝试将此条目归类到不存在的类别 Ç。如何强制 biblatex 将姓氏首字母带重音符号的条目归类到常规字母类别(在本例中为 C)?

梅威瑟:

\begin{filecontents}{\cakir.bib}

@Article{Cakir2011,
    author    = {Esra {\c{C}}ak{\i}r and E. Allen Foegeding},
    journal   = {Food Hydrocolloids},
    title     = {Combining protein micro-phase separation and protein{\textendash}polysaccharide segregative phase separation to produce gel structures},
    year      = {2011},
    number    = {6},
    pages     = {1538-1546},
    volume    = {25},
}

\end{filecontents}

\documentclass{scrreprt}
\usepackage[english]{babel}

\usepackage[
backend=biber,
style=authoryear,
citestyle=authoryear,
giveninits=true,
maxbibnames=10,
date=year,
isbn=false,
doi=false,
url=false
]{biblatex}

\addbibresource{\cakir.bib}

%%-- large initial letter before every new alphabetic section
\makeatletter
\def\ifskipbib{\iftoggle{blx@skipbib}}
\makeatother

\def\initlist{}
\forcsvlist{\listadd\initlist}{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}
\forlistloop{\DeclareBibliographyCategory}{\initlist}
\renewcommand*{\do}[1]{\defbibheading{#1}{\section*{#1}}}
\dolistloop{\initlist}
\AtDataInput{\ifskipbib{}{\addtocategory{\thefield{sortinit}}{\thefield{entrykey}}}}

\begin{document}

This scientist's last name begins with an accented letter: \cite{Cakir2011}.

\end{document}

答案1

最简单的方法可能是用sortname去掉所有变音符号的名字来填写该字段。

\documentclass{report}
\usepackage[english]{babel}

\usepackage[backend=biber,
  style=authoryear,
  giveninits=true, maxbibnames=10,
  date=year,
  isbn=false, doi=false, url=false
]{biblatex}


\makeatletter
\def\ifskipbib{\iftoggle{blx@skipbib}}
\makeatother

\def\initlist{}
\forcsvlist{\listadd\initlist}{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}
\forlistloop{\DeclareBibliographyCategory}{\initlist}
\renewcommand*{\do}[1]{\defbibheading{#1}{\section*{#1}}}
\dolistloop{\initlist}

\AtDataInput{%
  \ifskipbib
    {}
    {\addtocategory{\thefield{sortinit}}{\thefield{entrykey}}}}



\begin{filecontents}{\jobname.bib}
@article{Cakir2011,
  author    = {Esra Çakır and E. Allen Foegeding},
  sortname  = {Esra Cakir and E. Allen Foegeding},
  journal   = {Food Hydrocolloids},
  title     = {Combining protein micro-phase separation and
               protein--polysaccharide segregative phase separation
               to produce gel structures},
  year      = {2011},
  number    = {6},
  pages     = {1538-1546},
  volume    = {25},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\nocite{sigfridsson,worman,geer,cicero,coleridge,cotton}
\begin{document}
This scientist's last name begins with an accented letter: \cite{Cakir2011}.

\printbibheading
\bibbycategory
\end{document}

含有 Çakır 的参考书目列在 C 下。


为了好玩,这里有一个与 Unicode(LuaLaTeX 和 XeLaTeX)引擎一起使用的解决方案,让您重新映射重音字符。

你会说

\remapaccentedchar{Ç}{C}

将Ç映射到C类别中。

\documentclass{report}
\usepackage[english]{babel}

\usepackage[backend=biber,
  style=authoryear,
  giveninits=true, maxbibnames=10,
  date=year,
  isbn=false, doi=false, url=false
]{biblatex}


\makeatletter
\def\ifskipbib{\iftoggle{blx@skipbib}}
\makeatother

\def\initlist{}
\forcsvlist{\listadd\initlist}{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}
\forlistloop{\DeclareBibliographyCategory}{\initlist}
\renewcommand*{\do}[1]{\defbibheading{#1}{\section*{#1}}}
\dolistloop{\initlist}

\makeatletter
\newcommand*{\remapaccentedchar}[2]{%
  \csdef{remap@initial@#1}{#2}}

\AtDataInput{%
  \ifskipbib
    {}
    {\ifcsundef{remap@initial@\thefield{sortinit}}
       {\edef\my@init{\thefield{sortinit}}}
       {\letcs\my@init{remap@initial@\thefield{sortinit}}}
      \addtocategory{\my@init}{\thefield{entrykey}}}}
\makeatother

\remapaccentedchar{Ç}{C}


\begin{filecontents}{\jobname.bib}
@article{Cakir2011,
  author    = {Esra Çakır and E. Allen Foegeding},
  journal   = {Food Hydrocolloids},
  title     = {Combining protein micro-phase separation and
               protein--polysaccharide segregative phase separation
               to produce gel structures},
  year      = {2011},
  number    = {6},
  pages     = {1538-1546},
  volume    = {25},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\nocite{sigfridsson,worman,geer,cicero,coleridge,cotton}
\begin{document}
This scientist's last name begins with an accented letter: \cite{Cakir2011}.

\printbibheading
\bibbycategory
\end{document}

答案2

这是一个实用的解决方案。首先,定义以下最初看起来很古怪的宏:

\newcommand\noopsort[1]{}

其次,将author字段从

    author    = {Esra {\c{C}}ak{\i}r and E. Allen Foegeding},

    author    = {Esra \noopsort{Cakir}{\c{C}}ak{\i}r and E. Allen Foegeding},

第三,运行完整的重新编译循环:latex-biber-latex。

希望宏的要点\noopsort是明确的:虽然 LaTeX 会将姓氏排版为Çakır(因为它会丢弃 的参数\noopsort),但 biber 会“看到”并将姓氏处理为CakirÇakır-- ,从而正确地将其排版在 之下C

顺便说一句,这个\noopsort技巧在 BibTeX 中已有数十年的历史。很高兴看到它继续与 biblatex/biber 一起使用。:-)

相关内容