I want to index the name of a book that ends in a question mark. What I get is

\textit{What is Life?}, 27,

but what I'd like is

\textit{What is Life?} 27.

In other words I want to suppress the comma. Only when I've succeeded in doing it will I know if it looks better like that.

  • 2
    Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – albert Aug 21 '18 at 10:08

You have to use a suitable index style, where the standard delimiter, a comma followed by a space, is changed into a macro that adds the comma only if no punctuation comes along.

delim_0 "\\possiblecomma "
delim_1 "\\possiblecomma "
delim_2 "\\possiblecomma "

\usepackage{amsthm} % for \@addpunct

\makeindex[options=-s athel]

\newcommand{\possiblecomma}{\@addpunct{,} }


Here we index that title\index{whatislife@\textit{What is life?}}

We also index another entry\index{normal}



enter image description here

  • Thanks. That worked fine (once I figured out how to incorporate it into my file). I thought there was a button to say"Yes. That answered my question", but I don't find it. – Athel Aug 21 '18 at 11:44
  • @Athel You should see a dimmed checkmark next to the arrows for voting – egreg Aug 21 '18 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.