8

I have a line that says \index{flamingo's ``knee''}. As one would expect, it produces an entry

flamingo’s “knee”, 3

in the index. Unfortunately the publisher wants it to be

flamingo’s “knee,” 3

and I haven’t succeeded in getting that. If I change \index{flamingo's ``knee''} to \index{flamingo's ``knee,''} I get two commas:

flamingo’s “knee,”, 3

How can I get rid of the second comma in this entry only, while not affecting any entries that don’t contain quotation marks?

8

Interesting question!

\documentclass{book}
\usepackage{imakeidx}

\makeindex

\newrobustcmd{\invertcomma}[2]{#2#1}

\begin{document}

Flamingo's ``knee''\index{flamingosknee@flamingo's ``knee\invertcomma{''}}

\printindex

\end{document}

enter image description here

  • 5
    but misguided publisher. – barbara beeton Mar 16 '16 at 14:14
  • 2
    @barbarabeeton Certainly so! – egreg Mar 16 '16 at 14:20
  • I have a question that is similar, but different. 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. – Athel Aug 21 '18 at 7:41
  • @Athel This should be a new question. – egreg Aug 21 '18 at 8:33

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.