# index entries for exactly !( and !)

I did look at this answer to a similar question. It is about my bismon GPLv3+ free software project on github (commit b08143a1478f if that matters) whose LaTeX-ed documentation (partly generated) is under its doc/ sub-directory. My computer is running on Linux/Debian/Sid, and its LaTeX subsystem is texlive-full 2018.20190227.

For this draft report (in PDF, its §2.3.2 near figure 4 page 34) obtained with pdflatex, called from my build-bismon-doc.sh shell script, invoked by make latexdoc) obtained from LaTeX source files (under doc/ ) I need to have an index entry for the exact strings !( and !), preferably formatted in a fixed-width teletype looking font (so using \texttt in LaTeX parlance). This is in file doc/datapersist-bm.tex around line 640 where the current (not yet git commit-ed, of course) LaTeX code has:

\begin{quote}
\begin{small}

The lines starting with \texttt{«} or \texttt{!(}
\index{{!(}@\texttt{!(}} \index{«@\texttt{«}}
and with \texttt{»} or \texttt{!)}
\index{{!)}@\texttt{!(}} \index{»@\texttt{»}}
are delimiting the object's persistent
representation. Comments~\footnote{Once the persistence code -
loading and dumping of the state - is mature enough, we will
bar \texttt{|} till the following bar, or with two slashes
\texttt{//} till the end of line.  {\verb+!~+} with matching
{\verb+(~+} ... \verb+~)+ are for modifications'' (here, we
set the \index{name}{\texttt{name}} of that object to
dumped in such modification'' form. \verb+!@+ puts the
\index{mtime}{\emph{mtime}}. \verb+!$+ \textit{classobjid} sets the \index{class}{class} to the object of objid \textit{classobjid}. \verb+!:+ \textit{attrobj} \textit{valattr} put the attribute \textit{attrobj} associated with the value \textit{valattr}. \verb+!#+ \textit{nbcomp} reserve the spaces for \textit{nbcomp}, and \verb/!&/~\textit{valcomp} appends the value \textit{valcomp} as a component. %% next paragraph was removed for brevity on this LaTeX forum question \end{small} \end{quote}  What am I doing wrongly above? And the suggested \index{"!"(@\texttt{!(}} does not work! • Did you try \index{"!"(@\texttt{!(}}? – egreg Jul 3 at 12:56 • Thanks, but it does not work... – Basile Starynkevitch Jul 3 at 12:58 • Start my making a full (but minimal) example we can copy and test as is. Additionally, exactly which indexing programme are you using? – daleif Jul 3 at 13:10 • @greg I cannot get that to work either, but \index{"!"(@\texttt{"!(}} does work. – daleif Jul 3 at 13:13 ## 1 Answer You need to quote the !, which is a special character for MakeIndex, both before and after @. \documentclass{article} \usepackage[T1]{fontenc} \usepackage{imakeidx} \makeindex \begin{document} \begin{quote}\small The lines starting with \index{«@\texttt{«}}\texttt{«} or \index{"!(@\texttt{"!(}}\texttt{!(} and with \index{»@\texttt{»}}\texttt{»} or \index{"!)@\texttt{"!(}}\texttt{!)} are delimiting the object's persistent representation. Comments~\footnote{Once the persistence code---loading and dumping of the state---is mature enough, we will disable generation of comments in data files.} can start with a bar~\texttt{|} till the following bar, or with two slashes~\texttt{//} till the end of line. % \verb+!~+ with matching \verb+(~+ ... \verb+~)+ are for modifications'' (here, we set the \index{name}{\texttt{name}} of that object to \texttt{first\_test\_module}). Object payloads are also dumped in such modification'' form. % \verb+!@+ puts the \index{mtime}{\emph{mtime}}. % \verb+!$+ \textit{classobjid} sets the \index{class}{class} to the object of
objid \textit{classobjid}.
%
\verb+!:+ \textit{attrobj} \textit{valattr} put the attribute \textit{attrobj}
associated with the value \textit{valattr}.
%
\verb+!#+ \textit{nbcomp} reserve the spaces for \textit{nbcomp}, and
%
\verb/!&/~\textit{valcomp} appends the value \textit{valcomp} as a component.
\end{quote}

\printindex

\end{document}


Here's the produced .ind file:

\begin{theindex}

\item \texttt{!(}, 1
\item \texttt{!(}, 1
\item \texttt{\IeC {\guillemotleft }}, 1
\item \texttt{\IeC {\guillemotright }}, 1

\indexspace

\item class, 1

\indexspace

\item mtime, 1

\indexspace

\item name, 1

\end{theindex}

• Thanks a big lot. That worked. – Basile Starynkevitch Jul 3 at 13:20
• Could you explain a bit more what exactly You need to quote the ! means. I don't know how in general should I quote something in LaTeX. I do know the role of quote or of ' in Scheme or Lisp (and the role of ' in C) – Basile Starynkevitch Jul 4 at 12:20
• Concretely, I also need to index !| and Σ and I cannot adapt your answer. A general short explanation (or just some URL) about quotation in LaTeX is welcome. I only vaguely know about catcodes – Basile Starynkevitch Jul 4 at 12:26
• @BasileStarynkevitch MakeIndex doesn't know Unicode/UTF-8 (as you see from «). The quote character for it is " and means “treat the following special character literally”. – egreg Jul 4 at 12:29
• So " is quoting a single byte, or potentially a single multi-byte UTF-8 character? – Basile Starynkevitch Jul 4 at 12:34