我试图为文档创建三个索引(主题、作者和标题),但作者和主题索引被加载到错误的部分。我尝试更改\DeclareIndexNameFormat{default}
to DeclareIndexFieldFormat{default}
和修改{default}
其他字符串indexname
,但无济于事。加载 splitindex\usepackage[xindy]{imakeidx}
也会导致 TexWorks 崩溃,因此不确定在这种情况下这是否相关或需要。
%! MWE Example
% arara: lualatex
% arara: biber
% arara: lualatex
% arara: xindy: {modules: [texindy], codepage: utf8, language: english}
% arara: lualatex: {shell: yes}
% arara: lualatex
\documentclass[oneside]{memoir}
\usepackage[backend=biber,
hyperref=true,
indexing=true,
natbib=true,
]{biblatex}
\usepackage[xindy]{imakeidx}
\usepackage{hyperref}
\begin{filecontents}{\jobname.bib}
@article{Che20,
author = {Chen, Keqiang and Wang, Cong and Peng, Zhuoyin and Qi, Kun and Guo, Zhinan and Zhang, Yupeng and Zhang, Han},
title = {{The chemistry of colloidal semiconductor nanocrystals: From metal-chalcogenides to emerging perovskite}},
year = {2020}
}
@article{Hak20,
author = {Hakkoymaz, Orhun and Mazi, Hidayet},
title = {{An immobilized invertase enzyme for the selective determination of sucrose in fruit juices}},
year = {2020}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\makeindex[intoc=true,
program=xindy,
title={Subject Index}]
\makeindex[intoc=true,
title={Author Index},
program=xindy,
name=names]
{\DeclareIndexNameFormat{default}{%
\usebibmacro{index:name}{\index[names]}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}}
\makeindex[intoc=true,
title={Title Index},
program=xindy,
name=titles]
\DeclareIndexFieldFormat{indextitle}{%
\usebibmacro{index:title}{\index[titles]}{#1}}%
\begin{document}
\cite{Che20, Hak20}
\printindex
\printindex[titles]
\printindex[names]
\end{document}
主题索引(没有附加 name= 的默认索引)正在加载作者:
尽管我在 MWE 末尾按正确的顺序调用了作者索引,但作者索引却没有加载任何内容:
我想使用 xindy,因为我喜欢它的格式,但它让我很烦恼,而且我也不知道我是否arara
正确地调用它,如能得到任何帮助我将不胜感激。
答案1
在 周围有一对多余的花括号\DeclareIndexNameFormat{default}
。这对花括号使定义保持局部性,这意味着它会被立即丢弃。因此名称索引不会使用您的新names
索引。
删除 周围的花括号\DeclareIndexNameFormat{default}
。
%! MWE Example
% arara: lualatex
% arara: biber
% arara: lualatex
% arara: xindy: {modules: [texindy], codepage: utf8, language: english}
% arara: lualatex: {shell: yes}
% arara: lualatex
\documentclass[oneside]{memoir}
\usepackage[backend=biber,
indexing=true,
natbib=true,
]{biblatex}
\usepackage[xindy]{imakeidx}
\usepackage{hyperref}
\makeindex[intoc=true,
program=xindy,
title={Subject Index}]
\makeindex[intoc=true,
title={Author Index},
program=xindy,
name=names]
\DeclareIndexNameFormat{default}{%
\usebibmacro{index:name}{\index[names]}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}
\makeindex[intoc=true,
title={Title Index},
program=xindy,
name=titles]
\DeclareIndexFieldFormat{indextitle}{%
\usebibmacro{index:title}{\index[titles]}{#1}}%
\addbibresource{biblatex-examples.bib}
\begin{document}
\cite{sigfridsson, worman,geer}
\printindex
\printindex[titles]
\printindex[names]
\end{document}