7

Dear all I think I have a problem with the collation of makeidx.

following some suggestions found here I have got in the text something like this

\index[p]{Plutarco!demalignitate@\textit{De Malignitate Herodoti}!00855 @855A|qt}

\index[p]{Plutarco!demalignitate@\textit{De Malignitate Herodoti}!00868 @868f-869b|nn{\thefootnote}}

the first is an \index entry in the text, the second in a footnote. My problem is that even if I put the sort also on the second level of indexing it keeps keeping them separated.

I use this package information

\usepackage[splitindex]{imakeidx}
\makeindex[name=n, title=Nomi di persone e luoghi] 
\makeindex[name=p, title=Passi citati nel testo]
\makeindex[name=t, title=Altri testi citati]
\makeindex[name=pap, title=Papiri e manoscritti citati nel testo]

\newcommand{\nn}[2]{#2 \textit{n}#1}
\newcommand{\qt}[1]{\textbf{#1}}

in the .idx file I get this

\indexentry{Plutarco!demalignitate@\textit{De Malignitate Herodoti}!00855 @855A|hyperindexformat{\qt}}{8}

\indexentry{Plutarco!demalignitate@\textit  {De Malignitate Herodoti}!00868 @868 b-c|hyperindexformat{\nn{33}}}{10}

can somebody advise me on what I am doing wrong here, please? I have tried to use \string after the first sort with no effect.


sure, sorry: this is the file I'm using

\documentclass[12pt,a4paper]{book}
\usepackage[utf8x]{inputenx} 
\usepackage{palatino}       
\usepackage[LGR,T1]{fontenc}
\usepackage[english,german,polutonikogreek,italian]{babel}

\usepackage[splitindex]{imakeidx}
\makeindex[name=p, title=Passi citati nel testo,columns=1]
\newcommand{\nn}[2]{#2 \textit{n}#1}
\newcommand{\qt}[1]{\textbf{#1}}
\usepackage[hidelinks]{hyperref}
\begin{document} 
(855A\index[p]{Plutarco!demalignitate@\textit{De Malignitate Herodoti}!00855 @855A|qt})%
\footnote{DHM 868 B-C\index[p]{Plutarco!demalignitate@\textit{De Malignitate Herodoti}!00868 @868 b-c|nn{\thefootnote}}}
\printindex[p]
\end{document}
  • Please provide a complete minimal working example. – Marco Daniel Nov 16 '13 at 8:38
  • Your example works fine. It's important to know that you are using multicol and so the contents is balanced. You can use \makeindex[name=p, title=Passi citati nel testo,columns=1] to see that everything works well. – Marco Daniel Nov 16 '13 at 9:19
  • Thank you for your comment here and below. What I would like to do is to get those passages together. What I get now is "De Malignitate Herodoti 868f-869b, 13 n52" and after that "De Malignitate Herodoti 855A, 8" what I would instead like to have is both of these entries under De Malignitate, sorted according to the passage number only. Could you please advise me on how can I achieve this? thank you very much. – Pietro Maria Liuzzo Nov 16 '13 at 9:25
  • I can't provide a solution but I can tell you the error. If you don't use textit it works like expected: (855A\index[p]{Plutarco!demalignitate@{De Malignitate Herodoti}!00855 @855A|qt})% \footnote{DHM 868 B-C\index[p]{Plutarco!demalignitate@{De Malignitate Herodoti}!00868 @868 b-c|nn{\thefootnote}}} – Marco Daniel Nov 16 '13 at 10:08
  • Here an very old answer of Bern Raichle, but it describes your issue: groups.google.com/forum/#!topic/comp.text.tex/_Hwo6Hapcng – Marco Daniel Nov 16 '13 at 10:38
8

The problem is that \index tries hard not to tokenize its argument too early; but when the \index command appears in the argument to another command (in this case \footnote, the tokenization has already been done. Thus in the .idx file you get two non matching entries, one with

@\textit{De Malignitate Erodoti}!

and the other one with

@\textit  {De Malignitate Erodoti}!

A workaround is to always tokenize:

\newcommand{\indexp}[1]{\index[p]{#1}}

and using \indexp instead of \index[p]: this gives

enter image description here

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.