I am using imakeidx to make multiple indices for my report, but I ran into a problem where I get an "Undefined Control Sequence" error when I try to compile. The problem is shown below. Undefined Control Sequence Error

When I open the specified .ind file, I see this. IND File Contents

Considering I've never had to worry about .ind files before, I did not modify this file. The code that produces that index entry is here. TEX File Contents

I'm not quite sure what is wrong with this declaration, since I've never had problems with imakeidx before.

  • The undefined control sequence is \AT which I never heard about.
    – egreg
    Commented Aug 24, 2016 at 19:28
  • in all the other cases you have \ AT ie a control-space followed by AT, that one you have \AT which is an undefined command Commented Aug 24, 2016 at 19:33
  • 3
    although since it is imakeidx package we should blame @egreg. Commented Aug 24, 2016 at 19:34
  • Looking again at the \index item in the LaTeX, I specify \index{P00-F120DG-AA | AT-101-042}, so I'm not sure how that turns into \item P00-F120DG-AA , \hyperindexformat{\AT-101-042}{29}. In fact, looking at a test file I made, the IND line should be: \item P00-F120DG, \ AT-101-042{29}. I'm confused why imakeidx is formatting is strangely.
    – Hari
    Commented Aug 24, 2016 at 20:49
  • 1
    the | symbol has a special meaning in any *makeidx context -- it is the substitute for a backslash to control commands like \see. instead of a literal |, substitute \vert\ (there is a space at the end). and it might be helpful to check some documentation for makeidx or imakeidx. there is an example of the use of | in the latter documentation, in section 5.2.5: {...{#1|innote}}. (there are probably better references, but i haven't time to look just now.) Commented Aug 24, 2016 at 21:05

2 Answers 2


the problem here is the presence of a | in a string that is being written into an \index entry.

the | has a special function in index entries: it substitutes for (and is interpreted as) a backslash for commands that are relevant to the indexing process, such as \see (input as |see in \index{...}) or the "brackets" that indicate a page span, |( and |).

the proper way to input this character in an index entry depends on whether it is in math or text.

in text, a | can be "quoted" by preceding it with a ditto mark: "|.

in math, the proper substitution is \vert, or, if the string to appear in the index output is ||, then \Vert. since these are often paired, \lvert ... \rvert or \abs{...} (or the equivalents for the double forms) are often more appropriate.

  • Preceding the pipe symbol with a ditto mark did not prevent the error from occurring. It was still interpreted as a control symbol rather than a pipe.
    – Hari
    Commented Oct 20, 2016 at 20:52
  • @HariGanti -- what is the exact entry in the .idx file that is failing? and what does it become in the .ind file? Commented Oct 20, 2016 at 21:30

Barbara Beeton pointed out (https://tex.stackexchange.com/a/326635/220244) that | has a special function in index entries, which causes the problem.

This problem occurs, for example, if


was accidentally misspelled to

  • Hey @Matthias, would you mind also describing the points from Barbaras comment, so they are combined in this answer? Without this explicit context, it is a bit hard to understand and I think your answer would benefit.
    – TobiBS
    Commented Jul 22, 2020 at 18:07

You must log in to answer this question.

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