New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The :index: role and the glossary generate duplicate entries in the LaTeX index #8214
Comments
:index:
role and the glossary generate duplicate entries in the LaTeX index
The problem would be due to the The while the glossary entry is generating |
Thanks for reporting and analysis. Using An indexed :index:`term` and :index:`another` one.
.. glossary::
term
will it generate a duplicate entry?
.. raw:: latex
\clearpage
.. glossary::
another
will it generate a duplicate entry?
conf.py:
we will have
but the extra spaces are fine with xindy. I will investigate if a not too complicated work-around is feasible for the makeindex route, else the fix will be to use xindy as above (testing report welcome). edit: if testing with then without then with xindy, always do |
… glossary This makes .idx files contain \spxentry{..} with no space, whether or not the \index latex command is encountered in main text or e.g. in a label of a description list (like happens for terms from a glossary). Xindy does not care about spaces, but Makeindex doesn't merge entries whose typesetting is to be done via \spxentry{..} or \spxentry {..}. An alternative work-around would be for Sphinx LaTeX writer to use some wrapper, say, \sphinxindexwrap, only to fetch the argument and force TeX tokenization and then hand over it to \index command. But we choose to let \spxentry expand to its own name, with no trailing space (it gets its final definition only from the python.ist file in case of Makeindex). In case both the :index: role and the glossary are on same page, Xindy and Makeindex behave differently: the former gives only once the page number, the latter issues them twice (but the indexed term only once), and there is warning in the .ilg file. But this is unrelated and we can't do here anything about it.
… glossary This makes .idx files contain \spxentry{..} with no space, whether or not the \index latex command is encountered in main text or e.g. in a label of a description list (like happens for terms from a glossary). Xindy does not care about spaces, but Makeindex doesn't merge entries whose typesetting is to be done via \spxentry{..} or \spxentry {..}. An alternative work-around would be for Sphinx LaTeX writer to use some wrapper, say, \sphinxindexwrap, only to fetch the argument and force TeX tokenization and then hand over it to \index command. But we choose to let \spxentry expand to its own name, with no trailing space (it gets its final definition only from the python.ist file in case of Makeindex). In case both the :index: role and the glossary are on same page, Xindy and Makeindex behave differently: the former gives only once the page number, the latter issues them twice (but the indexed term only once), and there is warning in the .ilg file. But this is unrelated and we can't do here anything about it.
Fix #8214: duplicate entries in latex index if term also in glossary
Bug
A document contains both :
:index:`term`
The output PDF index contains a duplicate entry for the word "term":
Below is a snapshot :
Expected behavior
The index should contain only one entry for the word "term", with 2 page numbers pointing to the occurrences of that word.
Expected output index :
Possible cause
Looking at the generated
.idx
file:An extra whitespace between the command
\spxentry
and the argument{term}
is generated from the glossary entry.Removing that extra whitespace solves the problem.
Environment info
The text was updated successfully, but these errors were encountered: