LaTeX: index entry changed by makeindex without warning

I'm having a problem with makeindex -g, quoting, and using Y':

I create two index entries like this:

\index{Y'@$Y'$|see{Luma}}
\index{Farbmodell!Y'CBCR@$Y'C_BC_R'$|main}


(with \newcommand{\main}[1]{\textbf{#1}})

This generates these .idx entries:

\indexentry{Y'@$Y'$|see{Luma}}{43}
\indexentry{Farbmodell!$'CBCR@$Y'C_BC_R'$|main}{43}  To use -g (I also use -r), I've set up an index style using quote '\'' (and some more formatting). This seems to mess with having ' in the index entries, while makeindex (version 2.15 [TeX Live 2017] (kpathsea + Thai support)) does not print an error related to it. The output in .ind is:  \item Farbmodell \subitem$YC_BC_R$\hspace{1em}\dotfill\hspace{1em}\main{43} \item Y@$Y$\hspace{1em}\dotfill\hspace{1em}\see{Luma}{43}  So the ' got lost in the first output, and Y@ is being displayed for the second. Unfortunately I have no idea how to fix it (the set of usable quote characters seems quite limited). I case this matters, here's my document preamble: \documentclass[a4paper,twoside]{report} \usepackage{german} \usepackage[latin1]{inputenc} \usepackage{a4} \usepackage{makeidx} \usepackage{showidx} \usepackage{amsmath} \usepackage{url} \usepackage{graphicx} \usepackage{ifthen} \input{styledefs} \makeindex \begin{document}  1 Answer If you set the quote character to ', then you have to quote it when using it in an index entry. Here's a schematic solution. The filecontents* environment is just to make the example self-contained. If the current directory contains a file with the same name as the main TeX file and extension .mst, this one will be automatically used by MakeIndex. File main.tex \begin{filecontents*}{\jobname.mst} quote '\'' \end{filecontents*} \documentclass{article} \usepackage{makeidx} \makeindex \providecommand{\main}[1]{#1} % I don't know what \main should do \begin{document} Some text \index{Y''@$Y''$|see{Luma}} \index{Farbmodell!Y''CBCR@$Y''C_BC_R''$|main} \printindex \end{document}  File main.idx \indexentry{Y''@$Y''$|see{Luma}}{1} \indexentry{Farbmodell!Y''CBCR@$Y''C_BC_R''$|main}{1}  File main.ind (after running MakeIndex) \begin{theindex} \item Farbmodell \subitem$Y'C_BC_R'$, \main{1} \indexspace \item$Y'\$, \see{Luma}{1}

\end{theindex}


Output

• You find the definition of |main below the first code block in the question, but it's irrelevant to the problem anyway. – U. Windl Apr 8 at 12:21
• I searched my candidates in Emacs using \\index{[^}]*'[^}]*}, and it worked perfectly! – U. Windl Apr 8 at 19:15