MakeIndex, Nomenclature, Glossaries and AcronymsMakeindex: group extra sorted subentries that have |see

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
Post Reply
user49915
Posts: 81
Joined: Wed Apr 17, 2019 12:51 pm

Makeindex: group extra sorted subentries that have |see

Post by user49915 »

Let us create a source file mwe.tex containing

\documentclass{article}
\pagestyle{empty}
\usepackage[USenglish,ngerman]{babel}
\usepackage{makeidx}
\makeindex
\newcommand{\indexUSeWithSubsubentryAsGer}[4]{\index{000#1 #2 #3@\foreignlanguage{USenglish}{#1}!\foreignlanguage{USenglish}{#2}!\foreignlanguage{USenglish}{#3}|see{#4}}} % for 3-level USenglish English -> German "siehe" entries
\begin{document}
\index{Zustandsraum!lokaler}\emph{geteilter Zustandsraum} (engl.\@ \indexUSeWithSubsubentryAsGer{space}{state}{shared}{Zustandsraum, geteilter}\emph{\foreignlanguage{USenglish}{shared state space}})

\index{Zustandsraum!geteilter}\emph{lokaler Zustandsraum} (engl.\@ \indexUSeWithSubsubentryAsGer{space}{state}{local}{Zustandsraum, lokaler}\emph{\foreignlanguage{USenglish}{local state space}})

\printindex
\end{document}


and feed it to the loop pdflatex mwe && makeindex mwe. The intention of 000 above is to obtain first an index of English terms then followed by an index of German terms. The result is this:
page1.png
page1.png (22.89 KiB) Viewed 12105 times
page2.png
page2.png (47.65 KiB) Viewed 12105 times
However, you expected that the subentries would be grouped compactly, as in

Code: Select all

space
  state
    local, siehe Zustandsraum, lokaler
    shared, siehe Zustandsraum, geteilter

Zustandsraum
  geteilter, 1
  lokaler, 1
How to make the pdflatex-makeindex loop do it? (Aside: please stay with pdflatex and makeindex programs. If possible, do not switch to [xe|lua]latex, do not abandon makeindex, and retain English-language switches (which are useful in case of differences in ligatures, microtyping in general, and hyphenation). As you might imagine, the actual, non-minimal source file is a large book with its own ecosystem of hacks around indexing that jive with each other, and switching to another setup is very likely to incur a different question.)

Crossposts: http://texwelt.de/fragen/26229 , http://golatex.de/viewtopic,p,110783.html .
Last edited by user49915 on Thu Mar 26, 2020 11:57 am, edited 3 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Makeindex: group extra sorted subentries that have |see

Post by Ijon Tichy »

Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Makeindex: group extra sorted subentries that have |see

Post by Ijon Tichy »

Can you please translate the accepted answer given on TeXwelt, that the users, who do not understand German, can also read and understand it? IMHO in the principle of reciprocity this would be fair and appropriate after you've thrown the same question into at least four forums in two different languages.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Post Reply