引用作者姓名中包含使用者定義指令的問題

引用作者姓名中包含使用者定義指令的問題

我在與和polski同時使用包時遇到問題。我只使用包中的命令,其定義為imakeidxbiblatex\dywizpolski\def\dywiz{\kern0sp\discretionary{-}{-}{-}\penalty10000\hskip0sp\relax}

此指令用於控制兩部分(連字符)單字的連字符。一切工作正常,除了當我將它用於也需要在文件中索引的作者姓名時bib

\index{Kowalski\dywiz Jankowski, Karol}當我在文字中使用命令時,我在ind文件中得到了這個條目:\indexentry{Kowalski\dywiz Jankowski, Karol}{1}這很棒。

當我使用 command 時author = {Kowalski\dywiz Jankowski, Karol},在我的bib文件中,我在文字中出現虛假空格,在參考書目中出現虛假空格,在索引中出現額外項目(因為\indexentry{Kowalski\kern 0sp\discretionary {-}{-}{-}\penalty 10000\hskip 0sp\relax Jankowski, Karol}{1}我的文件中存在條目ind)。

author = {Kowalski\dywiz{}Jankowski, Karol}部分解決方案是在我的文件中使用命令bib。這消除了文本和參考書目中的虛假空格,但不幸的是,它在我的索引中產生了一個額外的條目(因為\indexentry{Kowalski\kern 0sp\discretionary {-}{-}{-}\penalty 10000\hskip 0sp\relax {}Jankowski, Karol}{1}我的文件中的條目ind)。

微量元素:

\documentclass{article}

\usepackage[indexing=cite,style=verbose-trad1,dashed=false]{biblatex}

\usepackage[nonewpage]{imakeidx}
\makeindex[columns=1]

%remove titles from index
\renewbibmacro*{citeindex}{%
    \ifciteindex
        {\indexnames{labelname}%
         \indexnames{editor}%
         \indexnames{editora}%
         \indexnames{editorb}%
         \indexnames{translator}%
     \indexnames{commentator}}
        {}} 

\def\dywiz{\kern0sp\discretionary{-}{-}{-}\penalty10000\hskip0sp\relax} %actually I use \usepackage{polski} but the result is the same

    
\begin{filecontents}{\jobname.bib}
@book{plbook1,
  author        = {Kowalski\dywiz Jankowski, Karol}, %spurious space in both text citation and the bibliography, extra entry in index
  title         = {Book1 title},
}

@book{plbook2,
  author        = {Kowalski\dywiz{}Jankowski, Karol}, %no spurious space but one more extra entry in index
  title         = {Book2 title},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}

\cite{plbook1} %this produces \indexentry{Kowalski\kern 0sp\discretionary {-}{-}{-}\penalty 10000\hskip 0sp\relax  Jankowski, Karol}{1}

\cite{plbook2} %this produces \indexentry{Kowalski\kern 0sp\discretionary {-}{-}{-}\penalty 10000\hskip 0sp\relax {}Jankowski, Karol}{1}

\index{Kowalski\dywiz Jankowski, Karol} %this produces \indexentry{Kowalski\dywiz Jankowski, Karol}{1}

\printindex

\printbibliography

\end{document}

結果:

在此輸入影像描述

總結一下,我有兩個問題:

  1. 使用時有時會出現不必要的空間\dywiz
  2. 在文件的作者姓名中使用使用者定義的命令bib會導致該命令以完全明確的形式寫入文件中ind\indexentry{Kowalski\kern 0sp\discretionary {-}{-}{-}\penalty 10000\hskip 0sp\relax Jankowski, Karol}{1}而不僅僅是 \indexentry{Kowalski\dywiz Jankowski, Karol}{1})。

相關內容