I'm trying to make an index at the end of a thesis that includes not only the page numbers where a particular term is mentioned, but also two additional bits of information related to that term that I want to supply manually. I might want to put this all in a table for clarity, but I suspect it won't fit on a single page, and I'm alright doing it in a list form instead.

I'm envisioning a table something like this:

language argument-associated morphology? clause-level morphology? page numbers
Coptic no? focus concord 2-4, 7, 19, 31
Hausa yes extraction morphology 3-4, 7, 17, 22

and so on. The first column is the key I'd like to index based on, the middle two columns are information I need to provide manually per key, and the last column is the page numbers the key is found on. Again, I'd also be okay doing this as a list, as well; perhaps something like this:

  • Coptic (2-4, 7, 19, 31): no argument-associated morphology; focus concord
  • Hausa (3-4, 7, 17, 22): argument-associated morphology; extraction morphology

I can build such a table or list manually using cleveref and \cpageref, but I'd have to set up a new label for every instance of each language name, and I'm not sure it would concatenate page numbers or remove duplicate page numbers properly. Beyond that, I have no idea how to accomplish this.

As a bonus, it would be nice to be able to group certain keys together (e.g. Coptic and Hausa both under a line with 'Afroasiatic' in the first column and the other three columns blank), with a couple of other headers), but alphabetised is fine as well if it saves me manually building a table.

Is there any convenient way to do this, or am I trying to do things LaTeX's indexing mechanisms aren't set up to do?

1 Answer 1


Assuming that you want to do this in place of the regular index, the solution would be to do some clever work around how the theindex and \item command within it are defined. Unfortunately, the default definition doesn't make it easy to parse the arguments to \item very easily. I'm thinking something along the lines of

  ... stuff goes here careful about newlines!

This will put the index entry in #1 and the page numbers in #2

You'll want to be able to define the extra information in the table. You could create a command like the following:


which could be used like:

\languageinfo{Hausa}{yes}{extraction morphology}

Then are definition for \@idxitem above could be something like


Now we just need to redefine the theindex environment:

    \let^^M\relax % don't let bare newlines do anything
    \begin{tabular}{llll}% assuming that it fits on one line
    \textbf{language}&\textbf{argument-associated morphology?}&\textbf{clause-level morphology?}&\textbf{page numbers}\\

You'll want to do something different if your index is more than one page.

If you wanted to do grouping of languages, you could take advantage of the \subitem and \subsubitem commands that are part of LaTeX's indexing when you do, e.g., \index{Afroasiatic languages!Hausa} but you will lose the easily parsed argument to \item and the macros become a bit more complicated. (Effectively, you'll define \@idxitem#1^^M and then have to parse out whether there's a comma in #1.)

All of the above uses @ in macro names, so the definitions of the commands/environments should either be enclosed with \makeatletter ... \makeatother or (better) put into a package, say thesisindex.sty and loaded with \usepackage{thesisindex}.

  • That looks quite complicated, but I think I understand most of it. I'll try it when I get a chance and come back with questions / accept your answer if it works. Thank you!
    – Sjiveru
    Feb 11, 2021 at 18:07
  • @Sjiveru Glad to see that it worked for you. I didn't actually test any of it.
    – Don Hosek
    Feb 12, 2021 at 17:57

You must log in to answer this question.

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