A way to remove "\spxentry" before index entries in Latex output?

30 views
Skip to first unread message

Nigel Barth

unread,
Mar 15, 2023, 2:22:06 PM3/15/23
to sphinx-users
Hi --

Has anyone seen "\spxentry" appear before index entries in Latex output?

Like this:

         \spxentryportait orientation, 28
         \spxentryPrint command, 26
         \spxentryPrinter dialog, 29

If so... how did you remove that prefix?

Thanks.

jfbu

unread,
Mar 20, 2023, 9:52:54 AM3/20/23
to sphinx...@googlegroups.com
Le 15/03/2023 à 19:22, Nigel Barth a écrit :
> Hi --
>
> Has anyone seen *"\spxentry"* appear before index entries in Latex output?
>
> Like this:
>
>          \spxentryportait orientation, 28
>          \spxentryPrint command, 26
>          \spxentryPrinter dialog, 29
>
> If so... how did you remove that prefix?
>

Hi,

You probably see that because \spxentry was not redefined as it should.

The normally produced .ind file will be something like this:

/----------- <foo>.ind
\begin{sphinxtheindex}
\let\bigletter\sphinxstyleindexlettergroup
\let\spxpagem \sphinxstyleindexpagemain
\let\spxentry \sphinxstyleindexentry
\let\spxextra \sphinxstyleindexextra

\bigletter P
\item \spxentry{Print command}, \hyperpage{1}

\end{sphinxtheindex}
\-----------

Notice the line \let\spxentry \sphinxstyleindexentry.

The default definition of \spxentry is used at an earlier stage
when latex produces the .idx file. That default definition,
if not later overwritten, can explain what you see in PDF.

The stuff above is put in .ind file via the default python.ist
placed in latex build repertory by Sphinx

Its contents are

/----------- python.ist
line_max 100
headings_flag 1
heading_prefix " \\bigletter "

preamble "\\begin{sphinxtheindex}
\\let\\bigletter\\sphinxstyleindexlettergroup
\\let\\spxpagem \\sphinxstyleindexpagemain
\\let\\spxentry \\sphinxstyleindexentry
\\let\\spxextra \\sphinxstyleindexextra

"

postamble "\n\n\\end{sphinxtheindex}\n"

symhead_positive "{\\sphinxsymbolsname}"
numhead_positive "{\\sphinxnumbersname}"
\-----------

I guess you have something interfering, or all directly running
makeindex without "-s python.ist"

This should not happen if you use "make latexpdf" or "sphinx-build -M latexpdf"
(for the latter see https://www.sphinx-doc.org/en/master/man/sphinx-build.html)

Maybe you are on Windows? I can't help much there but the make.bat should
work.

In short, Sphinx puts auxiliary support files for building the PDF,
these support files will let Latexmk work appropriately.

For example there is

/----------- latexmkrc
$latex = 'latex ' . $ENV{'LATEXOPTS'} . ' %O %S';
$pdflatex = 'pdflatex ' . $ENV{'LATEXOPTS'} . ' %O %S';
$lualatex = 'lualatex ' . $ENV{'LATEXOPTS'} . ' %O %S';
$xelatex = 'xelatex --no-pdf ' . $ENV{'LATEXOPTS'} . ' %O %S';
$makeindex = 'makeindex -s python.ist %O -o %D %S';
add_cus_dep( "glo", "gls", 0, "makeglo" );
sub makeglo {
return system( "makeindex -s gglo.ist -o '$_[0].gls' '$_[0].glo'" );
}
\-----------

Bypassing this and trying to build the PDF directly from the .tex file
maybe why you have this issue.

(in particular executing makeindex without the "-s python.ist")

If, on the other hand, you obtain this from a genuine "make latexpdf"
at source level or "make all-pdf" inside the LaTeX build repertory
after "make latex", then please raise an issue at https://github.com/sphinx-doc/sphinx

Regards
Jean-François


Nigel Barth

unread,
Mar 20, 2023, 6:19:00 PM3/20/23
to sphinx-users
Thank you very much.
Reply all
Reply to author
Forward
0 new messages