We defined the following command to generate an index for a publication


In a text, it is however possible that one uses synonyms interleaved (e.g.), abbrevations or shorter versions (e.g. traveling salesman instead of traveling salesman problem) due to the context of the sentence:

A \markindex{graph} consists out of a set of \markindex{nodes} or \markindex{vertices} and a set of \markindex{edges}.

As a result, the compiler generates an index with:

nodes, 1,2,7,9
vertices 1,2,5,6,7

We are looking for a method to define an alias


Such that not only nodes contains a see vertices entry, but all the page numbers are grouped on conto of vertices. This centralizes data (otherwise it is possible that readers miss the entries of nodes when they look up vertices) and makes it more compact (two references to the same page are "compressed" in one reference).

Is there a package (or an option in \makeidx we've overlooked) for this?

  • 2
    In my opinion you should stick to call those things either nodes or vertices, not both. So a simple “nodes, see vertices” entry will suffice. – egreg May 15 '14 at 20:32
  • This was of course an illustrative example. But for instance sometimes one uses an abbreviation (TSP instead of traveling salesman problem), or traveling salesman instead of traveling salesman problem. – Willem Van Onsem May 15 '14 at 20:54
  • Please, make the question clearer, then. – egreg May 15 '14 at 20:55
  • 1
    see intex package. it is not included in texlive and I haven't tested it, but I like the idea of controlled vocabulary file. See github.com/mtr/intex and raw.githubusercontent.com/mtr/intex/master/latex/intex.pdf for documentation – michal.h21 May 15 '14 at 21:27

I know I'm late for the party, but I ran into this problem recently. For reference, here is my code.

\def\indexDefineAlias#1#2{%  #1 = alias, #2 = original, the one to display in index

\def\indexalias#1#2{%  #1 = alias, #2 = original, the one to display in index
  % add here alternative "|<attributes>" to also define aliases for:

Use \indexDefineAlias{alias}{original} to define the alias. You need two runs of LaTeX to get the aliases active. Then you can just use \index{} normally with either term and only the original will be shown in the index.

The downside of this code is that aliases are not recognized when the index entry has attributes such as in \index{term|textbf}. You can add the aliases with the attributes manually (\indexDefineAlias{nodes|textbf}{vertices|textbf}), or add the attributes you're interested in the definition of \indexalias as I've marked in a comment.

If you want a "nodes, see vertices" entry you can use as usual \index{nodes|see{vertices}}.

Technical note: the \detokenize is useful if the index entry has custom macros. Even if they are robust, I had trouble with \csname...\endcsname.


The following example defines \markindex with the following variants:

  • \markindex{<term>}: \index{<term>}<term>

  • \markindex[<term>]{<alias>}: \index{<term>}<alias>, additionally it adds \index{<alias>|see{<term>} the first time it is used.

  • \markindex*[<term>]{<alias>}: \index{<term>}<alias>, but \index{...|see{...}} is not added. For example, this is useful, if the <alias> is just a inflection form of <term> or if <term> starts a sentence with its first letter in uppercase.

Example file:


      \edef\MI@see{MI@\@markindex@A ->\@markindex@B}%

  \section{Page #1}%






  \markindex*[vertices]{Vertices} are




  • \@ifstar, a LaTeX kernel macro, which checks for a following star.
  • \@dblarg, also a LaTeX kernel macro; it duplicates the mandatory argument to the optional argument, if the optional argument is not given. It is used in \section, for example.
  • This of course works, the only problem I guess is that the users must do the bookkeeping and it is quite labour-intesive. The answers is appreciated, but I was looking for a more automated solution. – Willem Van Onsem May 19 '14 at 4:48

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.