2

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
    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.

%% 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!

4
  • Did you try \index{"!"(@\texttt{!(}}?
    – egreg
    Jul 3, 2019 at 12:56
  • Thanks, but it does not work... Jul 3, 2019 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, 2019 at 13:10
  • @greg I cannot get that to work either, but \index{"!"(@\texttt{"!(}} does work.
    – daleif
    Jul 3, 2019 at 13:13

1 Answer 1

3

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}
8
  • Thanks a big lot. That worked. Jul 3, 2019 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) Jul 4, 2019 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 Jul 4, 2019 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, 2019 at 12:29
  • So " is quoting a single byte, or potentially a single multi-byte UTF-8 character? Jul 4, 2019 at 12:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .
https://tex.stackexchange.com/questions/498470/index-entries-for-exactly-and
tex.stackexchange.com
CC-MAIN-2024-22
157732
application/http; msgtype=response
sha1:CFQ2T5U4A652K4GDR6AVFB447IV4QCER
<urn:uuid:ec9a4df3-d7d7-4973-ba0b-433566fe3d5f>
2024-05-19T10:32:44Z
104.18.43.226
text/html
sha1:4BIMUCNZD7NYYFSCYH3TA7RFC67G2ZP5
<urn:uuid:99ad7bda-a330-4228-9d5e-bbe48e2c5dd8>
https://tex.stackexchange.com/questions/498470/index-entries-for-exactly-and
response
<urn:uuid:48c1e25d-e54d-445a-8153-d80e5efa96c9>
isPartOf: CC-MAIN-2024-22
publisher: Common Crawl
description: Wide crawl of the web for May 2024
operator: Common Crawl Admin (info@commoncrawl.org)
hostname: ip-10-67-67-76
software: Apache Nutch 1.19 (modified, https://github.com/commoncrawl/nutch/)
robots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)
format: WARC File Format 1.1
conformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/