# Remove page numbers from the index which are related to \printbibliography section

I want to use \index{entry} inside of the bibliographic item. When I cite this item it appears in text on the current page (I use style=verbose-trad1) and also on the page where full bibliography is printed. I want to remove from my index page numbers related to \printbibliography section.

MWE:

\documentclass{article}

\usepackage{imakeidx}
\makeindex

\begin{filecontents}{\jobname.bib}
@book{a1,
author        = {Aniston, John},
title         = {Be happy},
location      = {London\index{London}},
date          = {1953},
pagetotal     = {100},
}
\end{filecontents}

\begin{document}
Lorem \autocite{a1}.

\clearpage
\printbibliography
\printindex
\end{document}


Result:

In Index we see page numbers 1 (because of citation on the page 1), and 2 (because of appearing in bibliography). How can I remove page 2 from index?

I suggest you use a new command, say \citeindex. Then we can redefine that command to do nothing in the bibliography

\documentclass{article}

\usepackage{imakeidx}
\makeindex

\newcommand*{\citeindex}{\index}
\AtBeginBibliography{\renewcommand*{\citeindex}[1]{}}

\begin{filecontents}{\jobname.bib}
@book{a1,
author        = {Aniston, John},
title         = {Be happy},
location      = {London\citeindex{London}},
date          = {1953},
pagetotal     = {100},
}
\end{filecontents}

\begin{document}
Lorem \autocite{a1}.

\clearpage
\printbibliography
\printindex
\end{document}


Note that you can let biblatex index the location field automatically, e.g. with

\documentclass{article}

\usepackage{imakeidx}
\makeindex

\renewbibmacro*{citeindex}{%
\ifciteindex
{\indexnames{labelname}%
\indexfield{indextitle}%
\ifciteseen
{}
{\indexlist{location}}}
{}}

\begin{filecontents}[force]{\jobname.bib}
@book{a1,
author        = {Aniston, John},
title         = {Be happy},
location      = {London},
date          = {1953},
pagetotal     = {100},
}
\end{filecontents}

\begin{document}
Lorem \autocite{a1}.

\clearpage
\printbibliography
\printindex
\end{document}

• Thanks! Perhaps I can just add the line \AtBeginBibliography{\renewcommand*{\index}[1]{}} without introducing new command?
– andc
Oct 7 at 16:52
• @andc If you don't want any indexing in the bibliography that should be safe. With a new name you can be sure that you only disable the indexing you added yourself in the .bib files. Oct 7 at 19:17