删除 Xindy 标题索引条目中的强调

删除 Xindy 标题索引条目中的强调

问题:imakeidx我正在使用、biblatex和Xindy创建作者、标题和主题索引indexing=true。索引创建正确,但标题索引包含我不想要的斜体条目。我从以下答案中找到了代码莫威曼纽尔茨以适应我的文件需求。

我已尝试过:我尝试\emph用另一个\emph类似方法否定:

\DeclareIndexFieldFormat{indextitle}{%
  \usebibmacro{index:title}{\index[titles]}{\emph #1}}

但使用它(在我的主文件中)的结果并不一致:

在此处输入图片描述

我想要的是:文件中\emph写入的命令首先被否定或不插入。如果知道是什么过程导致添加,那就太好了,因为我看不出它来自哪里。\itemtitles.ind\emph

移动网络:

% arara: lualatex: {options: [-halt-on-error]}
% arara: biber
% arara: lualatex: {options: [-halt-on-error]}
% arara: xindy: {modules: [basic], codepage: utf8, language: english}
% arara: lualatex: {shell: yes, options: [-halt-on-error]}}
% arara: lualatex: {options: [-halt-on-error]}

\begin{filecontents*}{style.xdy}
(markup-index :open  "\begin{theindex} ~n
 \providecommand*\lettergroupDefault[1]{}
 \providecommand*\lettergroup[1]{%
 \par\textbf{\large#1}\par\medskip
   \nopagebreak
  }"
          :close "~n~n\end{theindex}~n"
          :tree)

(markup-locclass-list :open "\dotfill " :sep ", ")
;; End
\end{filecontents*}

\documentclass[oneside]{book}

\usepackage[backend=biber,indexing=true,natbib=true,safeinputenc=true,style=numeric]{biblatex}
\usepackage[xindy]{imakeidx}
\usepackage{idxlayout}
\usepackage{hyperref}

\addbibresource{biblatex-examples.bib}

\makeindex[title={Subject Index},program=truexindy, options=-M texindy -C utf8 -L english -M style]
\makeindex[title={Author Index}, program=truexindy, options=-M texindy -C utf8 -L english -M style, name=names]
\makeindex[title={Title Index},     program=truexindy, options=-M texindy -C utf8 -L english -M style, name=titles]

% https://tex.stackexchange.com/a/121560/245306
\DeclareIndexNameFormat{default}{%
   \usebibmacro{index:name}{\index[names]}
     {\namepartfamily}
     {\namepartgiven}
     {\namepartprefix}
     {\namepartsuffix}}

\DeclareIndexFieldFormat{indextitle}{%
  \usebibmacro{index:title}{\index[titles]}{#1}}

\begin{document}

\index{test}\index{actual}\cite{doody,bertram,gillies,glashow}

\printbibliography

\begingroup
\idxlayout{columns=3}
\printindex[names]
\endgroup

\begingroup
\idxlayout{columns=2}
\printindex[titles]
\endgroup

\begingroup
\idxlayout{columns=3}
\printindex
\endgroup

\end{document}

目前的情况:

标题索引目前如下所示:

斜体索引

titles.ind生成的文件包含以下内容:

\begin{theindex} 

 \providecommand*\lettergroupDefault[1]{}
 \providecommand*\lettergroup[1]{%
 \par\textbf{\large#1}\par\medskip
   \nopagebreak
  }
  \lettergroup{G}
  \item \emph  {Gromov invariants for holomorphic maps on {Riemann} surfaces}\dotfill \hyperpage{1}, \hyperpage{2}

  \indexspace

  \lettergroup{H}
  \item \emph  {Hemingway's Style and {Jake's} Narration}\dotfill \hyperpage{1}, \hyperpage{2}
  \item \emph  {Herder and the Preparation of {Goethe's} Idea of World Literature}\dotfill \hyperpage{1}, \hyperpage{2}

  \indexspace

  \lettergroup{P}
  \item \emph  {Partial Symmetries of Weak Interactions}\dotfill \hyperpage{1}, \hyperpage{2}

\end{theindex}

我将非常感激任何关于如何删除强调的建议,我无法弄清楚是什么函数或过程导致将\emph添加到titles.ind文件中。如果这个问题之前已经问过,我很抱歉,经过一番搜索,我还是找不到答案。我确信我对 Xindy 和 的使用是错误的araramakeindex但它编译正确,所以一定没问题。

答案1

看来我的

相当不错的搜索

还不够。从biblatex.def文件在 GitHub 上找到,第 1185-1194 行,索引命令已找到,问题出在这行代码上:

\newbibmacro*{index:title}[2]{%
  \usebibmacro{index:field}{#1}{\thefield{indexsorttitle}}{\emph{#2}}}

\emph如果需要删除,应按如下方式编辑:

\renewbibmacro*{index:title}[2]{%
  \usebibmacro{index:field}{#1}{\thefield{indexsorttitle}}{#2}}

新文件将根据需要产生以下输出:

在此处输入图片描述

更新的MWEB:

% arara: lualatex: {options: [-halt-on-error]}
% arara: biber
% arara: lualatex: {options: [-halt-on-error]}
% arara: xindy: {modules: [basic], codepage: utf8, language: english}
% arara: lualatex: {shell: yes, options: [-halt-on-error]}}
% arara: lualatex: {options: [-halt-on-error]}

\begin{filecontents*}{style.xdy}
(markup-index :open  "\begin{theindex} ~n
 \providecommand*\lettergroupDefault[1]{}
 \providecommand*\lettergroup[1]{%
 \par\textbf{\large#1}\par\medskip
   \nopagebreak
  }"
          :close "~n~n\end{theindex}~n"
          :tree)

(markup-locclass-list :open "\dotfill " :sep ", ")
;; End
\end{filecontents*}

\documentclass[oneside]{book}

\usepackage[backend=biber,indexing=true,natbib=true,safeinputenc=true,style=numeric]{biblatex}
\usepackage[xindy]{imakeidx}
\usepackage{idxlayout}
\usepackage{hyperref}

\addbibresource{biblatex-examples.bib}

\makeindex[title={Subject Index},program=truexindy, options=-M texindy -C utf8 -L english -M style]
\makeindex[title={Author Index}, program=truexindy, options=-M texindy -C utf8 -L english -M style, name=names]
\makeindex[title={Title Index},     program=truexindy, options=-M texindy -C utf8 -L english -M style, name=titles]

\DeclareIndexNameFormat{default}{%
   \usebibmacro{index:name}{\index[names]}
     {\namepartfamily}
     {\namepartgiven}
     {\namepartprefix}
     {\namepartsuffix}}

\DeclareIndexFieldFormat{indextitle}{%
  \usebibmacro{index:title}{\index[titles]}{#1}}

\renewbibmacro*{index:title}[2]{%
  \usebibmacro{index:field}{#1}{\thefield{indexsorttitle}}{#2}}

\begin{document}

\index{test}\index{actual}\cite{doody,bertram,gillies,glashow}

\printbibliography

\begingroup
\idxlayout{columns=3}
\printindex[names]
\endgroup

\begingroup
\idxlayout{columns=2}
\printindex[titles]
\endgroup

\begingroup
\idxlayout{columns=3}
\printindex
\endgroup

\end{document}

相关内容