假设我使用 biblatex 和 indexing=cite 来获取索引中引用标题的作者。但是首字母带有特殊字符的作者(例如 {\c{C}}abej, Nelson R.)不会自动排在“C”下。如果我手动索引该人,我可以使用“{\c{C}}abej\index{Cabey@{\c{C}}abej, Nelson R.}”来处理,但是如何使用 indexing=cite 获得相同的结果?前缀的问题相同,如何让“van den Berg, Horst”在索引中排在“B”下。
所以这里有一个 MWE - 如果有人能想出一个解决方案就太酷了,但在互联网上找不到。
\documentclass[12pt,a4paper]{scrreport}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[natbib=true,backend=biber,style=authoryear,indexing=cite]{biblatex}
\usepackage{hyperref}
\usepackage{csquotes}
\usepackage{imakeidx}
\usepackage{etoolbox}
\makeindex[columns=2,title=Titelregister]
\makeindex[columns=2,name=personenregister,title=Index of Persons]
\makeindex[columns=2,name=sachregister,title=Index of Subjects]
\DeclareIndexNameFormat{default}{%
\usebibmacro{index:name}{\index[personenregister]}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}
\begin{filecontents}{\jobname.bib}
@book{Cabej.2012,
author = {{\c{C}}abej, Nelson R.},
year = {2012},
title = {Epigenetic Principles of Evolution},
address = {Amsterdam},
publisher = {Elsevier},
}
@book{Berg.2012,
author = {van den Berg, Horst},
year = {2012},
title = {Epigenetic Principles of Evolution 2},
address = {Amsterdam},
publisher = {Elsevier},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
\autocite{Cabej.2012}
\autocite{bertram}
\autocite{doody}
\autocite{coleridge}
\autocite{Berg.2012}
\printindex[personenregister]
\end{document}
附录
进一步假设我还将 arara 与 makeglossaries 一起使用......
% arara: pdflatex
% arara: makeglossaries
% arara: texindy
% arara: biber
% arara: pdflatex
% arara: pdflatex
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[natbib=true,backend=biber,style=authoryear,indexing=cite]{biblatex}
\usepackage[xindy]{imakeidx}
\usepackage{hyperref}
\usepackage[]{glossaries}
\makeglossaries
\newglossaryentry{randomglossaryentry}
{
name={Random Glossary Entry},
text={Random Glossary Entry},
description={xxx},
}
\makeindex[columns=2,title=Titelregister]
\makeindex[columns=2,name=personenregister,title=Index of Persons, options={-C utf8}]
\makeindex[columns=2,name=sachregister,title=Index of Subjects]
\DeclareIndexNameFormat{default}{%
\usebibmacro{index:name}{\index[personenregister]}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}
\makeatletter
\renewcommand*{\mkbibindexname}[4]{%
\@firstofone #1% remove spurious braces
\ifdefvoid{#4}{}{ #4}%
\ifdefvoid{#2}{}{, #2}%
\ifdefvoid{#3}{}{
#3%
\actualoperator
#3 %
#1%
\ifdefvoid{#4}{}{ #4}%
\ifdefvoid{#2}{}{, #2}}}
\makeatother
\begin{filecontents}{\jobname.bib}
@book{Cabej.2012,
author = {{\c{C}}abej, Nelson R.},
year = {2012},
title = {Epigenetic Principles of Evolution},
address = {Amsterdam},
publisher = {Elsevier},
}
@book{Berg.2012,
author = {van den Berg, Horst},
year = {2012},
title = {Epigenetic Principles of Evolution 2},
address = {Amsterdam},
publisher = {Elsevier},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
\autocite{Cabej.2012}
\autocite{bertram}
\autocite{doody}
\autocite{coleridge}
\autocite{Berg.2012}
\gls{randomglossaryentry}
van den Berg\index[personenregister]{van den Berg, Horst}
\printglossary
\printbibliography
\printindex[personenregister]
\end{document}
答案1
为了恰贝伊我建议您使用可以处理非 ASCII 字符的索引工具:xindy
。
imakeidx
使用选项加载xindy
并使用选项调用xindy
(通过)texindy
-C utf8
texindy -C utf8 personenregister.idx
为了范登伯格您可以重新定义\mkbibindexname
问题
Berg, Horst van den@van den Berg, Horst
您将获得
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[natbib=true,backend=biber,style=authoryear,indexing=cite]{biblatex}
\usepackage[xindy]{imakeidx}
\usepackage{hyperref}
\makeindex[columns=2,title=Titelregister]
\makeindex[columns=2,name=personenregister,title=Index of Persons, options={-C utf8}]
\makeindex[columns=2,name=sachregister,title=Index of Subjects]
\DeclareIndexNameFormat{default}{%
\usebibmacro{index:name}{\index[personenregister]}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}
\makeatletter
\renewcommand*{\mkbibindexname}[4]{%
\@firstofone #1% remove spurious braces
\ifdefvoid{#4}{}{ #4}%
\ifdefvoid{#2}{}{, #2}%
\ifdefvoid{#3}{}{
#3%
\actualoperator
#3 %
#1%
\ifdefvoid{#4}{}{ #4}%
\ifdefvoid{#2}{}{, #2}}}
\makeatother
\begin{filecontents}{\jobname.bib}
@book{Cabej.2012,
author = {{\c{C}}abej, Nelson R.},
year = {2012},
title = {Epigenetic Principles of Evolution},
address = {Amsterdam},
publisher = {Elsevier},
}
@book{Berg.2012,
author = {van den Berg, Horst},
year = {2012},
title = {Epigenetic Principles of Evolution 2},
address = {Amsterdam},
publisher = {Elsevier},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
\autocite{Cabej.2012}
\autocite{bertram}
\autocite{doody}
\autocite{coleridge}
\autocite{Berg.2012}
\printindex[personenregister]
\end{document}
我几乎一无所知arara
(除了它有一份漂亮的文档,一个非常漂亮的标志和一个非常热情的开发团队),但以下指令似乎在你更新的 MWE 中起作用
% arara: pdflatex
% arara: biber
% arara: pdflatex
% arara: makeglossaries
% arara: texindy: { files: [personenregister, sachregister], codepage: utf8 }
% arara: pdflatex
% arara: pdflatex
特别是我们需要texindy
在 Biber 和 LaTeX 之后运行,因为只有在文档中出现引用后才能对其进行索引。
我们还需要直接提供用于调用的文件名texindy
,因为它们在文档中是硬编码的,无法从主.tex
文件的文件名中推断出来。
如果您非常信任文档中的代码(以及您加载的所有包),以至于您允许它在您的机器上执行任意命令,那么您可以通过shell escape 为您imakeidx
调用来减少一些调用texindy
(我们需要为相关运行启用此功能pdflatex
)
% arara: pdflatex
% arara: biber
% arara: pdflatex: { shell: yes }
% arara: makeglossaries
% arara: pdflatex
% arara: pdflatex
但一般来说,shell 逃逸是一种安全风险(--shell-escape 起什么作用?,什么是 \immediate 和 \write18 以及如何使用它们?)。