TransWikia.com

Undefined Control Sequence with imakeidx

TeX - LaTeX Asked by Hari Ganti on August 26, 2021

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.

2 Answers

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.

Answered by barbara beeton on August 26, 2021

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

index(maintopic!subtopic) 

was accidentally misspelled to

index(maintopic|subtopic) 

Answered by Matthias on August 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP