在索引中放置粗体条目

在索引中放置粗体条目

请问如何让粗体索引条目首先出现在索引中?我的 mwe 是

\documentclass[a4paper,12pt]{report}
\usepackage{imakeidx}
\makeindex[options=-s columnseprule,intoc,columns=2]
\begin{document}

\subsubsection{The back of your bra rides up towards your shoulder}
If the back of the bra rides up towards your shoulder blades it usually
indicates the back of the bra is too big. For example – if you are wearing
a 36C, it may be worth trying a 34D or even a 32DD. (Take a look at our
bra sizing guide to help you with this.) 
\index{Bra@\textbf{Bra}|textbf} 

\subsubsection{The bra cup digs into your bust at the top creating a ‘double-bust’ effect}
If the bra cups digs into your bust at the top, it is a sure sign that
the bra cup is too small. Try the next cup size up! 
\index{Bra!classic}
\index{Bra!standard}

\printindex

\end{document}

使用上述示例,它们在索引中显示为“Bra, classic”和“Bra, standard”,后面是粗体“Bra”和页码。请问我该如何反转它,以便粗体“Bra”和页码出现在索引的前面?

答案1

这是原始示例,但有一个变化,这将导致粗体索引条目排在另外两个条目之前。

\documentclass[a4paper,12pt]{report}
\usepackage{imakeidx}
\makeindex[options=-s columnseprule,intoc,columns=2]
\begin{document}

\subsubsection{The back of your bra rides up towards your shoulder}
If the back of the bra rides up towards your shoulder blades it usually
indicates the back of the bra is too big. For example – if you are wearing
a 36C, it may be worth trying a 34D or even a 32DD. (Take a look at our
bra sizing guide to help you with this.) 
%\index{Bra@\textbf{Bra}|textbf}
\index{Br0@\textbf{Bra}|textbf} 

\subsubsection{The bra cup digs into your bust at the top creating a ‘double-bust’ effect}
If the bra cups digs into your bust at the top, it is a sure sign that
the bra cup is too small. Try the next cup size up! 
\index{Bra!classic}
\index{"`!standard}

\printindex

\end{document}

文件中输入的第一个(粗体)条目\index具有所谓的“排序参数”,即出现在 之前的字符串@。其他两个条目具有“隐式”排序参数,该参数似乎与粗体条目的相同。但是,索引处理器实际上对整个条目进行排序(对于!多级条目,最多为 ),因此“ Bra@\textbf{Bra}|textbf”与“ ”不同Bra,并且它们将被视为索引中的两个单独条目,并且由于粗体条目按较长的字符串排序,因此它将被放置在索引中的较靠后的位置。

通过将现有的排序参数(在粗体条目上)从“ Bra”修改为“ Br0”,它将排在“普通”条目之前。(数字排在字母之前。)

执行此操作时,需要考虑索引中是否存在其他可能导致排序顺序冲突的条目。在这个例子中,这不太可能,但如果排序旨在管理涉及符号的数学符号,则必须更加小心。

相关内容