I would like to add an entry in an index which makes use of an exclamation point as an article of grammar. However (of course), Latex treats it as if I want to begin a subentry.
Consider the following code.
\documentclass{book}
\usepackage{imakeidx}
\let\cleardoublepage\clearpage
\makeindex
\usepackage{idxlayout}
\begin{document}
\LARGE
A sentence.\index{Heading@\textbf{Heading}!How to put an exclamation point at the end of this statement!}
\idxlayout{columns=1}
\printindex
\end{document}
with the output
I have tried enclosing the exclamation point with $$
but that only yields an error.
QUESTION How may the above code be modified so that, for instance, "How to put an exclamation point at the end of this statement!" will appear as an entry in the index with the exclamation point appended at the end?
Thank you.
Best Answer
You can quote the
!
as"!
or you can change makeindex's special characters all of which may be set in a
makeindex
style. for example thegind.ist
that comes with the LaTeX basedoc
package hasso that
actual
is=
not@
(as there are lots of@
in command names) and quote is!
rather than"
again as"
is rather more common in code.The full set is
from makeindex/ind.pdf
texdoc ind.pdf
(
texdoc -l makeindex
then select 2 as the default makeindex.pdf isn't so informative)So here you want
so a one line
mlc.ist
file:So that
!
becomes a normal character and>
becomes the index level separator.If calling
makeindex
directly you would needmakeindex -s mlc.ist
but as you are usingimakeidx
specify the option to\makeindex
: