如何在與正在索引的文字同一行上顯示索引條目

如何在與正在索引的文字同一行上顯示索引條目

是否可以讓showidx索引條目與正在索引的文字在同一行顯示?似乎不像makeindx.pdf說的:

這個宏實際上排版了盒子包含目前頁面上的所有索引條目[...]。

這有點諷刺,因為就makeindx.pdf其本身而言,所描述的巨集的名稱,\@mkidx位於頁邊距中,就在文本前面。 (當然,環境似乎有所不同,並且\@mkidx可能不是索引條目。另一方面, 中的文本cleveref.pdf也有邊距條目,似乎只是......文本。)

那麼,考慮到我已經在使用hyperrefclevereftcolorbox,答案可能是什麼?希望還不需要其他包裹。

這是一個相當長但最小的範例:

% !TEX TS-program = pdflatexmk  
\documentclass{book}

    \usepackage{makeidx}
    \usepackage[hyperfootnotes=false]{hyperref}%[pdfborder={0 0 0}]

%Begin the ``quick and dirty hack'' due to Heiko Oberdiek which loads showidx 
\makeatletter
\ifHy@hyperindex
  \def\HyInd@ParenLeft{(}%
% Hook in \HyInd@@wrindex
  \let\HyInd@showidx\@empty
% Hook in \HyInd@@wrindex for package showidx
  \def\HyInd@showidx#1{%
    \@showidx{#1}%
    \if@nobreak
      \ifvmode
        \nobrak
      \fi
    \fi
  }%
% Load package showidx
  \let\siOrg@makeindex\makeindex
  \let\siOrg@@index\@index
  \let\siOrg@@wrindex\@wrindex
  \let\siOrg@index\index
  \RequirePackage{showidx}
  \let\makeindex\siOrg@makeindex
  \let\@index\siOrg@@index
  \let\@wrindex\siOrg@@wrindex
  \let\index\siOrg@index
    % rest of hyperref part
  \@ifpackageloaded{multind}{%
    \let\HyInd@org@wrindex\@wrindex
    \def\@wrindex#1#2{\HyInd@@wrindex{#1}#2||\\}%
    \def\HyInd@@wrindex#1#2|#3|#4\\{%
      \ifx\\#3\\%
        \HyInd@org@wrindex{#1}{#2|hyperpage}%
      \else
        \def\Hy@temp@A{#3}%
        \ifx\Hy@temp@A\HyInd@ParenLeft
          HyInd@org@wrindex{#1}{#2|#3hyperpage}%
        \else
          \HyInd@org@wrindex{#1}{#2|#3}%
        \fi
      \fi
    }%
  }{%
    \def\@wrindex#1{\@@wrindex#1||\\}
    \def\@@wrindex#1|#2|#3\\{%
      \ifx\\#2\\%
        \protected@write\@indexfile{}{%
          \string\indexentry{#1|hyperpage}{\thepage}%
        }%
      \else
        \def\Hy@temp@A{#2}%
        \ifx\Hy@temp@A\HyInd@ParenLeft
          \protected@write\@indexfile{}{%
             \string\indexentry{#1|#2hyperpage}{\thepage}%
          }%
        \else
          \protected@write\@indexfile{}{%
            \string\indexentry{#1|#2}{\thepage}%
          }%
        \fi
      \fi
      \endgroup
      \HyInd@showidx{#1}%
      \@esphack
    }%
  }%
\fi
\makeatother
%End the ``quick and dirty hack'' due to Heiko Oberdiek which loads showidx 

    \usepackage{cleveref}

        \newcounter{proc}
    \usepackage{tcolorbox}

%Begin the Sharpe (2013-01-18) code as modified by Schulz (2016-02-1) to have math in Showindex     
\let\oldopenparen\(
\let\oldcloseparen\)
\def\({\protect\oldopenparen}
\def\){\protect\oldcloseparen}
\newcommand{\INDEX}[1]{\index{#1}}
%End the Sharpe (2013-01-18) code as modified by Schulz (2016-02-1) to have math in Showindex               

\makeindex
\begin{document}    

Some text necessary to drown the words to be indexed. Some text necessary to drown the words to be indexed. \textbf{Oberdieck}\INDEX{Oberdieck}
Some text necessary to drown the words to be indexed. Some text necessary to drown the words to be indexed. 

\newpage

Some text necessary to drown the words to be indexed. Some text necessary to drown the words to be indexed.
\textbf{$\cup$}\INDEX{$\cup$}
Some text necessary to drown the words to be indexed. Some text necessary to drown the words to be indexed. 

\printindex
\end{document}

相關內容