# index entry pointing to book cover

I'd like an index entry for a page in the book and the book cover. The answer at created a fixed page number of an index entry doesn't handle a text reference. The one at Make index entries refer to something other than the page numbers looks much more complex than my need-just-once use case.

This MWE (not absolutely minimal but maybe fun to read) produces the correct .ilg file

\indexentry{molasses}{1}
\indexentry{molasses}{cover}


but not the right index.

\documentclass[10pt]{article}

\usepackage{makeidx}
\makeindex

\begin{document}
The story headlined in the Boston Post on the cover of this book tells
of a January 15th, 1919 disaster in Boston's North End.
Chuck Lyons retold the story in \emph{History Today} in 2009,
describing how a tank of molasses ruptured, releasing two million
gallons of molasses in a 15 foot high, 160 foot wide wave.''
Several blocks were flooded to a depth of 2 to 3 feet.''
\index{molasses}
\makeatletter
\protected@write\@indexfile{}{\string\indexentry{molasses}{cover}}
%\protected@write\@indexfile{}{\string\indexentry{molasses}{0}}
\makeatother

Several years later the auditor appointed to decide on compensation
recommended

\begin{quotation}
\ldots around \$300,000 in damages, equivalent to around \$30
million today, with about \$6,000 going to the families of those killed, \$25,000 to the City of Boston, and \\$42,000 to the Boston
Elevated Railway Company.
\end{quotation}

\begin{enumerate}
\item How long was the wave?

\item
Estimate the number of blocks that could be covered two to three feet
deep.

\item
Is Lyons's inflation calculation correct?

\item
Estimate the number of families that lost loved ones.
How much would each receive, in today's dollars? How does that amount
compare to damage awards in similar cases today?
\end{enumerate}

In this short document, the index should include the line

molasses, cover, 1

A hack solution is fine since this only happens once.

\printindex

\end{document}


If you look at your file filename.ilg, you will find the error message:

!! Input index error (file = 274651.idx, line = 2):
-- Illegal Roman number: position 2 in cover.


which gives you a hint about the problem: Apparently, \indexentry always expects a number, or at most a roman number.

You can use the following workaround: The package makeidx provides commands to set page numbers in specific styles. For example, \index{molasses|textbf} would print the corresponding page number in bold face. So let's define a new "style" (i.e. a command with a single argument that formats the argument):

\newcommand{\coverpage}[1]{cover}


Then the following line adds the desired entry in the index:

\index{molasses|coverpage}