TransWikia.com

How to Display the Indice Page Numbers in Bold?

TeX - LaTeX Asked on May 29, 2021

As the title suggests, given an index, say

enter image description here

produced by the code

documentclass[12pt]{book}
usepackage{imakeidx}
makeindex
usepackage{idxlayout}
begin{document}
newpage Another sentenceindex{Heading@!Entry-1}
newpage Another sentenceindex{Heading@!Entry-2}
newpage Another sentenceindex{Heading@!Entry-3}
idxlayout{columns=1}
printindex
end{document}

I would like to able to display the page numbers in bold? Can this be done collectively? Can this be done selectively? If so, can someone indicate how to do this? I found no posts which anser this question.

Thank you.

One Answer

From the makeindex documentation (section 2.2 The Basics, p 5):

In some indexes, certain page numbers are specially formatted - for example, an italic page number may indicate the primary reference, and an n after a page number may denote that the item appears in a footnote on that page. MakeIndex makes it easy to format an individual page number any way you want. For any string of characters σ, the command index{...|σ} produces a page number of the form σ{n}. Similarly, the command index{...|(σ} may produce a page number of the form σ{n–m}.

So, to make an individual entry's page number appear bold, use index{Heading@!Entry-1|textbf}. To make all page numbers appear bold, you could do this:

enter image description here

documentclass{article}

usepackage{imakeidx}
makeindex
usepackage{idxlayout}

% Make all page numbers in index bold
letoldindexindex
renewcommand{index}[1]{%
  oldindex{#1|textbf}%
}%

begin{document}

newpage Another sentenceindex{Heading@!Entry-1}
newpage Another sentenceindex{Heading@!Entry-2}
newpage Another sentenceindex{Heading@!Entry-3}

idxlayout{columns=1}
printindex

end{document}

Correct answer by Werner on May 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP