3

Can someone please explain like I'm five: What is the correct syntax for making index entries like this?

hierarchy: see `polymorphism`

overloading,
    operator: see `operator overloading`

I'm using packages hyperref and imakeidx.

What exactly is the "see" syntax, and how am I supposed to invoke it? I'm confused about the difference between

\index{x|see{y}}
\index{x|see {y}}
\index{x|\see{y}}
\index{x|\see {y}}
\indexentry{x|see{y}}

I'm particularly confused because some answers (like this one) mention "the \see macro", which matches my intuition that special words in TeX should be spelled with backslashes... but then I see people writing actual index entries without the backslash, and somehow it still works!

Corollary: What is the format of {y} in the above examples? Can I (and should I) be using things like {e@$e$} or {constant!Euler's} in a "see"?

Corollary: Does makeindex recognize any more special verbs besides "see"?

3

First the easy part: \indexentry should never be used in a document; it's not generally defined and is only used for writing to the .idx file that makeindex will convert to an .ind file that LaTeX can input.

The syntax is

\index{abc|see{x}}

A space is irrelevant, so \index{abc|see {x}} is acceptable as well. You must not use a backslash, it's a job for makeindex to add it at the proper place.

The definition of \see is

\newcommand*\see[2]{\emph{\seename} #1}

but it could be changed in the document preamble to suit your needs.

The following document

\documentclass{article}
\usepackage{imakeidx}

\makeindex

\begin{document}

a\index{x|see{y}}

\printindex

\end{document}

will produce an .idx file containing

\indexentry{x|see{y}}{1}

that will be processed by makeindex producing an .ind file with

\begin{theindex}

  \item x, \see{y}{1}

\end{theindex}

You see that the second argument to \see is the page number, which one usually wants to omit, but by changing the definition of \see other effects can be obtained.

The makeidx package (and so imakeidx as well) defines also \seealso, so you can use

\index{z|seealso{u}}

and the same about \see can be said. You can use any two argument command in the same fashion.

The part before | can be any legal entry for \index, so

\index{a@bcd|see{x}}
\index{a!b|see{x}}

are both good, with the expected result according to the rules of makeindex. The only difference will be that “see x“ appears instead of the page number.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.