1

I'm writing a text where there will be several index entries for short biographies. The index entries for persons are supposed to be in small caps and the biography entries will get page numbers in italics, so I have these definitions:

\newcommand{\ii}[1]{{\it #1}}
\newcommand{\ppindex}[1]{\index{#1@\textsc{#1}|ii}}

I can thus simply write \ppindex{Hilbert, David} to generate the entry I want. So far, so good.

However, I also have

suffix_2p "\\nohyperpage{\\,f.}"  
suffix_3p "\\nohyperpage{\\,ff.}"

in the .ist file and these biographies will always be exactly two pages long, so the entry for, say, Hilbert should be numbered '42f.' and not just '42'. I can achieve this by inserting two \ppindex commands in the text, but I am wondering if there is a way to automate this so that one instance of \ppindex takes care of an index entry for the current page and the following one?


I was asked to provide a MWE, so here it is. I didn't provide the .ist file because it is tangential to my problem.

\documentclass{article}
\usepackage{imakeidx}
\newcommand{\ii}[1]{{\it #1}}
\newcommand{\ppindex}[1]{\index{#1@\textsc{#1}|ii}}
\makeindex
\begin{document}
Text \ppindex{Zappa, Frank}
\clearpage
More text
\ppindex{Zappa, Frank} % get rid of this command
\clearpage
Text \ppindex{Cantor, Georg}
\clearpage
More text
\ppindex{Cantor, Georg} % and this one
\printindex
\end{document}

What I'm looking for is a modified version of \ppindex so that I get exactly the same index if the two lines with comments are removed.

1
  • Interesting question. You can provide an MWE for this though, by writing the complete code necessary to create an index for David Hilbert with a single index command that does not produce the suffix automatically.
    – Marijn
    Aug 14, 2022 at 15:30

1 Answer 1

2

Oh well, this is not what I originally had in mind, but I just realized that in my case replacing the definition of \ii with the following would do the trick:

\newcommand{\ii}[1]{\textit{#1}\,f.}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .