我正在尝试使用类似索引的字典,其中定义了一些在文本中具有不同变体的术语。似乎使用 更容易indexing
。我尝试将一个索引项的子项放在同一行上,并用;
以下是 MWE:
\documentclass{article}
\usepackage{makeidx}
\makeindex
\def\igobble#1 {}
\makeatletter
% we don't want a page break before a subitem
\renewcommand\subitem{\@idxitem\nobreak\hspace*{20\p@}}
\makeatother
\makeatletter
% we don't want a page break before the first subitem
\newif\iffirst@subitem
\def\@idxitem{%
\par\hangindent40\p@ % original
\first@subitemtrue % added
}
\def\subitem{%
% \par\hangindent40\p@
\iffirst@subitem
\nobreak
\first@subitemfalse
\fi
%\hspace*{20\p@}
}
\makeatother
\begin{document}
some text\index{k} with some index entries\index{b}
and some\index{c} \emph{see also} entries as well.
\index{Term to define!zzzzz@\igobble |seealso {b, c}}
\index{Term to define!\emph{Derived term} here is its definition and here is where we see it \textbf{bcd 12}}
\index{Term to define!\emph{Anoter derived term} here is its definition and here is where we see it \textbf{bcccc 17}}
\index{c!zzzzz@\igobble |seealso {a, b}}
\printindex
\end{document}
subitem
宏取自此处如何防止在索引中的第一个子条目之前出现列中断?
这是输出。红色部分是我想要的页码前面和;
页码后面的p。