\autocite prenote 内の \index が機能しない

\autocite prenote 内の \index が機能しない
  1. パッケージbiblatex-chicagoとを使用する tex ファイルを作成していますmakeidx
  2. 私はすべての脚注を「Notes」セクションにプッシュするために endnotes パッケージを使用しています。
  3. すべての引用は参考文献セクションに表示されます。これは を使用して実現されます\autocite
  4. プロジェクトでは、 の前後の注釈内に索引付けをしたいと考えてい\autociteます。つまり、索引セクションでは、用語が注釈セクションの関連ページに対応することになります。たとえば、次の例では、 が表示される注釈セクションのページ番号とともに、「clah」が索引に表示される必要があります。

質問私が直面している問題は、\index事前メモを入れるとコンパイルに失敗するということです。しかし、\index事後メモ内では問題なく動作します。誰かこの問題を解決する方法を明確に教えていただけませんか?

例えば、私が

\autocite[blah blah][clah clah\index{clah}]{a-citekey}

うまくいきます!しかし、

\autocite[blah blah\index{blah}][clah clah]{a-citekey}

コンパイルに失敗します。

MWE は次のとおりです。

\def\DevnagVersion{2.16}
\documentclass[11pt]{book}
\usepackage[a4paper,bindingoffset=0.2in,%
        left=1in,right=1in,top=1.2in,bottom=1.2in,%
        footskip=.5in]{geometry}

\usepackage{makeidx}
\usepackage{endnotes}
\let\footnote=\endnote

\usepackage[notes]{biblatex-chicago}
\renewcommand\nameyeardelim{, }
\addbibresource{question.bib}

\usepackage{float}
\usepackage{tabls}
\usepackage{graphicx}
\usepackage[colorlinks]{hyperref}
\usepackage{cleveref}
\usepackage{parskip}
\usepackage{devanagari}
\usepackage{epigraph}

\usepackage{fancyhdr, blindtext}
\newcommand{\changefont}{%
\fontsize{8}{10}\selectfont
}
\fancyhf{}
\fancyhead[LE,RO]{\changefont \slshape \rightmark} %section
\fancyhead[RE,LO]{\changefont \slshape \leftmark} %chapter
\fancyfoot[C]{\changefont \thepage} %footer
\pagestyle{fancy}

\newcounter{ExCount}
\newcommand{\ex}[1]{
\stepcounter{ExCount}
\addcontentsline{toc}{section}{~~ \textit{Example \arabic{ExCount}: #1}}
\subsubsection*{~~ \textit{Example \arabic{ExCount}: #1}}
}
\newcommand{\he}[1]{
\addcontentsline{toc}{section}{#1}
\subsubsection*{#1}
}


\DeclareAutoCiteCommand{endfull}[f]{\footfullcite}{\footfullcites}
\ExecuteBibliographyOptions{autocite=endfull}


\sloppy

\title{A catchy title}
\author{Author One \and Author Two}

\makeindex

\begin{document}
\maketitle\newpage
\tableofcontents\newpage

\frontmatter

\chapter{Intro}

Testing the Wendy Doniger example from Penguin.\footcite[][p. 65]{doniger1999splitting}

This line is just to test index.\autocite[please refer to][for a detailed analysis{\index{analysis}}]{a-citekey}

% but this does not work
% This line is just to test index.\autocite[please   refer\index{refer} to][for a detailed analysis]{a-citekey}

\newpage
\def\enotesize{\footnotesize}  
\cleardoublepage 
\addcontentsline{toc}{chapter}{Notes}
\theendnotes


\addcontentsline{toc}{chapter}{Bibliography}
\renewcommand*{\bibfont}{\footnotesize}
\printbibliography

\cleardoublepage
\addcontentsline{toc}{chapter}{Index}    % adds Index to TOC
\printindex

\end{document}

bibファイルquestion.bibの内容は次のとおりです。

@book{doniger1999splitting,
  title =        {Splitting the difference: Gender and myth in ancient
              Greece and India},
  author =       {Doniger, Wendy},
  year =         {1999},
  publisher =    {University of Chicago Press},
  location =     {Chicago}
}


@InCollection{a-citekey,
  author =       {Author One},
  title =        {A long title: this is a really long title},
  booktitle =    {This is my book: proud to have written this},
  publisher =    {Elite Publishing House},
  year =         2006,
  editor =       {A bigshot editor},
  chapter =      7,
  url =          {http://www.example.com/a-link.html}
}

答え1

使用

\protect\index{<term>}

\index{<term>}事前注釈や事後注釈の代わりに。

スタイルと設定によっては、biblatex追加の書式設定や他のマクロがプレノート フィールドとポストノート フィールドに適用される場合があります。フィールドの内容が拡張され、拡張できないマクロによって問題が発生する場合があります。そのため、一見必要ないように思えても、\indexプレノートとポストノートでのの使用を保護するのが安全です。\protect

\documentclass{article}
\usepackage{makeidx}
\usepackage{biblatex-chicago}
\usepackage[colorlinks]{hyperref}

\makeindex

\addbibresource{biblatex-examples.bib}


\begin{document}
Testing the Wendy Doniger example from Penguin.\autocite[65]{sigfridsson}

This line is just to test index.\autocite[refer][analysis\protect\index{analysis}]{sigfridsson}

This line is just to test index.\autocite[refer\protect\index{refer}][analysis]{sigfridsson}

\printbibliography

\printindex
\end{document}

事前メモの場合、問題が発生するbiblatex-chicagoため\MakeCapital

\DeclareFieldFormat{prenote}{\ifcapital{\MakeCapital{#1}}{#1}\isdot}

ポストノートの標準では、およびのbiblatex \index理由で問題があります\mkpageprefix\mknormrange

\DeclareFieldFormat{postnote}{\mkpageprefix[pagination][\mknormrange]{#1}}

MWE の完全なインデックス

関連情報