Discussion:
[XeTeX] index not showing up as an entry in the table of contents
Kamal Abdali
2018-04-24 21:09:27 UTC
Permalink
To get the index listed in the table of contents, I include these two lines
in the preamble of a xelatex+polyglossia+bidi program:

\usepackage[imakeidx]
\makeindex[intoc]

My problem is that while the index does get produced it doesn’t get listed
in the TOC. The trouble can be reproduced in this small program:

%%%%%%%%%%%%%%%%%%%
\documentclass{book}

\usepackage{imakeidx}
\makeindex[intoc]

\usepackage{polyglossia}
\usepackage{bidi} %%%%%
\setmainlanguage{english}

\title{Facts}
\author{Aleck}
\date{}

\begin{document}
\maketitle
\tableofcontents
\chapter{Stars}
Sirius, the brightest star in the night sky, is actually a double star.
\index{Sirius}
\printindex
\end{document}
%%%%%%%%%%%%%%%%%%%%

The above program produces the index without listing it in the TOC.
However, if you comment out the \usepackage{bidi} line, the index IS
produced and listed in TOC as expected.

Note that the above program doesn’t really need bidi as all of its output
text is in the Latin script. But I do need the bidi feature in the actual
document that I need to process.

Any help will be appreciated.

Kamal Abdali
Zdenek Wagner
2018-04-25 08:25:33 UTC
Permalink
You have to redefine the header, it automatically inserts \chapter*{Index}.
You have to remove the asterisk. I do not remember the details, I would
have to search in the documentatin but it is written there.


Zdeněk Wagner
http://ttsm.icpf.cas.cz/team/wagner.shtml
http://icebearsoft.euweb.cz

2018-04-24 23:09 GMT+02:00 Kamal Abdali <***@acm.org>:

> To get the index listed in the table of contents, I include these two
> lines in the preamble of a xelatex+polyglossia+bidi program:
>
> \usepackage[imakeidx]
> \makeindex[intoc]
>
> My problem is that while the index does get produced it doesn’t get listed
> in the TOC. The trouble can be reproduced in this small program:
>
> %%%%%%%%%%%%%%%%%%%
> \documentclass{book}
>
> \usepackage{imakeidx}
> \makeindex[intoc]
>
> \usepackage{polyglossia}
> \usepackage{bidi} %%%%%
> \setmainlanguage{english}
>
> \title{Facts}
> \author{Aleck}
> \date{}
>
> \begin{document}
> \maketitle
> \tableofcontents
> \chapter{Stars}
> Sirius, the brightest star in the night sky, is actually a double star.
> \index{Sirius}
> \printindex
> \end{document}
> %%%%%%%%%%%%%%%%%%%%
>
> The above program produces the index without listing it in the TOC.
> However, if you comment out the \usepackage{bidi} line, the index IS
> produced and listed in TOC as expected.
>
> Note that the above program doesn’t really need bidi as all of its output
> text is in the Latin script. But I do need the bidi feature in the actual
> document that I need to process.
>
> Any help will be appreciated.
>
> Kamal Abdali
>
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex
>
>
Kamal Abdali
2018-04-25 14:50:23 UTC
Permalink
Thanks, Zdeněk. I found the problem and a solution for it discussed here:
https://tex.stackexchange.com/questions/263696/polyglossias-setotherlanguage-blocks-imakeindexs-indexprologue.
The solution did work for me.

Briefly, the problem is attributed to bidi's restoring the book definition
of the theindex environment for no apparent reason. The solution is to
insert the following lines between the \usepackage{imakeindex} and
\makeindex[intoc] lines:

% nullify bidi redefinition

% this should go after polyglossia and imakeidx have been loaded

\let\imakeidxtheindex\theindex

\let\imakeidxendtheindex\endtheindex

\AtBeginDocument{%

\let\theindex\imakeidxtheindex

\let\endtheindex\imakeidxendtheindex

}


Kamal Abdali

On Wed, Apr 25, 2018 at 4:25 AM, Zdenek Wagner <***@gmail.com>
wrote:

> You have to redefine the header, it automatically inserts
> \chapter*{Index}. You have to remove the asterisk. I do not remember the
> details, I would have to search in the documentatin but it is written there.
>
>
> Zdeněk Wagner
> http://ttsm.icpf.cas.cz/team/wagner.shtml
> http://icebearsoft.euweb.cz
>
> 2018-04-24 23:09 GMT+02:00 Kamal Abdali <***@acm.org>:
>
>> To get the index listed in the table of contents, I include these two
>> lines in the preamble of a xelatex+polyglossia+bidi program:
>>
>> \usepackage[imakeidx]
>> \makeindex[intoc]
>>
>> My problem is that while the index does get produced it doesn’t get
>> listed in the TOC. The trouble can be reproduced in this small program:
>>
>> %%%%%%%%%%%%%%%%%%%
>> \documentclass{book}
>>
>> \usepackage{imakeidx}
>> \makeindex[intoc]
>>
>> \usepackage{polyglossia}
>> \usepackage{bidi} %%%%%
>> \setmainlanguage{english}
>>
>> \title{Facts}
>> \author{Aleck}
>> \date{}
>>
>> \begin{document}
>> \maketitle
>> \tableofcontents
>> \chapter{Stars}
>> Sirius, the brightest star in the night sky, is actually a double star.
>> \index{Sirius}
>> \printindex
>> \end{document}
>> %%%%%%%%%%%%%%%%%%%%
>>
>> The above program produces the index without listing it in the TOC.
>> However, if you comment out the \usepackage{bidi} line, the index IS
>> produced and listed in TOC as expected.
>>
>> Note that the above program doesn’t really need bidi as all of its output
>> text is in the Latin script. But I do need the bidi feature in the actual
>> document that I need to process.
>>
>> Any help will be appreciated.
>>
>> Kamal Abdali
>>
>>
>>
>>
>> --------------------------------------------------
>> Subscriptions, Archive, and List information, etc.:
>> http://tug.org/mailman/listinfo/xetex
>>
>>
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex
>
>
Vafa Khalighi
2018-04-25 14:55:52 UTC
Permalink
The comment about bidi is wrong.

Sent from my iPhone

On 26 Apr 2018, at 12:51 am, Kamal Abdali <***@acm.org<mailto:***@acm.org>> wrote:

Thanks, Zdeněk. I found the problem and a solution for it discussed here:
https://tex.stackexchange.com/questions/263696/polyglossias-setotherlanguage-blocks-imakeindexs-indexprologue. The solution did work for me.

Briefly, the problem is attributed to bidi's restoring the book definition of the theindex environment for no apparent reason. The solution is to insert the following lines between the \usepackage{imakeindex} and \makeindex[intoc] lines:


% nullify bidi redefinition

% this should go after polyglossia and imakeidx have been loaded

\let\imakeidxtheindex\theindex

\let\imakeidxendtheindex\endtheindex

\AtBeginDocument{%

\let\theindex\imakeidxtheindex

\let\endtheindex\imakeidxendtheindex

}


Kamal Abdali

On Wed, Apr 25, 2018 at 4:25 AM, Zdenek Wagner <***@gmail.com<mailto:***@gmail.com>> wrote:
You have to redefine the header, it automatically inserts \chapter*{Index}. You have to remove the asterisk. I do not remember the details, I would have to search in the documentatin but it is written there.


Zdeněk Wagner
http://ttsm.icpf.cas.cz/team/wagner.shtml
http://icebearsoft.euweb.cz

2018-04-24 23:09 GMT+02:00 Kamal Abdali <***@acm.org<mailto:***@acm.org>>:
To get the index listed in the table of contents, I include these two lines in the preamble of a xelatex+polyglossia+bidi program:

\usepackage[imakeidx]
\makeindex[intoc]

My problem is that while the index does get produced it doesn’t get listed in the TOC. The trouble can be reproduced in this small program:

%%%%%%%%%%%%%%%%%%%
\documentclass{book}

\usepackage{imakeidx}
\makeindex[intoc]

\usepackage{polyglossia}
\usepackage{bidi} %%%%%
\setmainlanguage{english}

\title{Facts}
\author{Aleck}
\date{}

\begin{document}
\maketitle
\tableofcontents
\chapter{Stars}
Sirius, the brightest star in the night sky, is actually a double star.
\index{Sirius}
\printindex
\end{document}
%%%%%%%%%%%%%%%%%%%%

The above program produces the index without listing it in the TOC. However, if you comment out the \usepackage{bidi} line, the index IS produced and listed in TOC as expected.

Note that the above program doesn’t really need bidi as all of its output text is in the Latin script. But I do need the bidi feature in the actual document that I need to process.

Any help will be appreciated.

Kamal Abdali




--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex





--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex
Zdenek Wagner
2018-04-25 15:19:44 UTC
Permalink
Sure, bidi has nothing to do with it. And I woult prefer to modify the
prolog generated by the index. If you randomly redefine a few macros inside
\AtBeginDocument, it might fail unpredictably if a package is used with its
own modifications.

Stackexchange may contain useful solutions but the original documentation
is often a better and more reliable source of information.


Zdeněk Wagner
http://ttsm.icpf.cas.cz/team/wagner.shtml
http://icebearsoft.euweb.cz

2018-04-25 16:55 GMT+02:00 Vafa Khalighi <***@uowmail.edu.au>:

> The comment about bidi is wrong.
>
> Sent from my iPhone
>
> On 26 Apr 2018, at 12:51 am, Kamal Abdali <***@acm.org> wrote:
>
> Thanks, Zdeněk. I found the problem and a solution for it discussed here:
> https://tex.stackexchange.com/questions/263696/polyglossias-
> setotherlanguage-blocks-imakeindexs-indexprologue. The solution did work
> for me.
>
> Briefly, the problem is attributed to bidi's restoring the book
> definition of the theindex environment for no apparent reason. The
> solution is to insert the following lines between the
> \usepackage{imakeindex} and \makeindex[intoc] lines:
>
> % nullify bidi redefinition
>
> % this should go after polyglossia and imakeidx have been loaded
>
> \let\imakeidxtheindex\theindex
>
> \let\imakeidxendtheindex\endtheindex
>
> \AtBeginDocument{%
>
> \let\theindex\imakeidxtheindex
>
> \let\endtheindex\imakeidxendtheindex
>
> }
>
>
> Kamal Abdali
>
> On Wed, Apr 25, 2018 at 4:25 AM, Zdenek Wagner <***@gmail.com>
> wrote:
>
>> You have to redefine the header, it automatically inserts
>> \chapter*{Index}. You have to remove the asterisk. I do not remember the
>> details, I would have to search in the documentatin but it is written there.
>>
>>
>> Zdeněk Wagner
>> http://ttsm.icpf.cas.cz/team/wagner.shtml
>> http://icebearsoft.euweb.cz
>>
>> 2018-04-24 23:09 GMT+02:00 Kamal Abdali <***@acm.org>:
>>
>>> To get the index listed in the table of contents, I include these two
>>> lines in the preamble of a xelatex+polyglossia+bidi program:
>>>
>>> \usepackage[imakeidx]
>>> \makeindex[intoc]
>>>
>>> My problem is that while the index does get produced it doesn’t get
>>> listed in the TOC. The trouble can be reproduced in this small program:
>>>
>>> %%%%%%%%%%%%%%%%%%%
>>> \documentclass{book}
>>>
>>> \usepackage{imakeidx}
>>> \makeindex[intoc]
>>>
>>> \usepackage{polyglossia}
>>> \usepackage{bidi} %%%%%
>>> \setmainlanguage{english}
>>>
>>> \title{Facts}
>>> \author{Aleck}
>>> \date{}
>>>
>>> \begin{document}
>>> \maketitle
>>> \tableofcontents
>>> \chapter{Stars}
>>> Sirius, the brightest star in the night sky, is actually a double star.
>>> \index{Sirius}
>>> \printindex
>>> \end{document}
>>> %%%%%%%%%%%%%%%%%%%%
>>>
>>> The above program produces the index without listing it in the TOC.
>>> However, if you comment out the \usepackage{bidi} line, the index IS
>>> produced and listed in TOC as expected.
>>>
>>> Note that the above program doesn’t really need bidi as all of its
>>> output text is in the Latin script. But I do need the bidi feature in the
>>> actual document that I need to process.
>>>
>>> Any help will be appreciated.
>>>
>>> Kamal Abdali
>>>
>>>
>>>
>>>
>>> --------------------------------------------------
>>> Subscriptions, Archive, and List information, etc.:
>>> http://tug.org/mailman/listinfo/xetex
>>>
>>>
>>
>>
>>
>> --------------------------------------------------
>> Subscriptions, Archive, and List information, etc.:
>> http://tug.org/mailman/listinfo/xetex
>>
>>
>
Veesh Goldman
2018-04-25 19:05:41 UTC
Permalink
Actually, bidi does clobber imakeidx. In all of the document classes, bidi
redefines the \theindex environment. Some of the imakeidx functionality
also comes from redefining \theindex. I had problems with this in the past.
The only issue that would be presented with the op's patch is that there
won't be bidi support inside the index. That's easily solved by just using
othercode = \raggedleft when setting up the index.

On Wed, Apr 25, 2018 at 6:20 PM Zdenek Wagner <***@gmail.com>
wrote:

> Sure, bidi has nothing to do with it. And I woult prefer to modify the
> prolog generated by the index. If you randomly redefine a few macros inside
> \AtBeginDocument, it might fail unpredictably if a package is used with its
> own modifications.
>
> Stackexchange may contain useful solutions but the original documentation
> is often a better and more reliable source of information.
>
>
> Zdeněk Wagner
> http://ttsm.icpf.cas.cz/team/wagner.shtml
> http://icebearsoft.euweb.cz
>
> 2018-04-25 16:55 GMT+02:00 Vafa Khalighi <***@uowmail.edu.au>:
>
>> The comment about bidi is wrong.
>>
>> Sent from my iPhone
>>
>> On 26 Apr 2018, at 12:51 am, Kamal Abdali <***@acm.org> wrote:
>>
>> Thanks, Zdeněk. I found the problem and a solution for it discussed
>> here:
>>
>> https://tex.stackexchange.com/questions/263696/polyglossias-setotherlanguage-blocks-imakeindexs-indexprologue.
>> The solution did work for me.
>>
>> Briefly, the problem is attributed to bidi's restoring the book
>> definition of the theindex environment for no apparent reason. The
>> solution is to insert the following lines between the
>> \usepackage{imakeindex} and \makeindex[intoc] lines:
>>
>> % nullify bidi redefinition
>>
>> % this should go after polyglossia and imakeidx have been loaded
>>
>> \let\imakeidxtheindex\theindex
>>
>> \let\imakeidxendtheindex\endtheindex
>>
>> \AtBeginDocument{%
>>
>> \let\theindex\imakeidxtheindex
>>
>> \let\endtheindex\imakeidxendtheindex
>>
>> }
>>
>>
>> Kamal Abdali
>>
>> On Wed, Apr 25, 2018 at 4:25 AM, Zdenek Wagner <***@gmail.com>
>> wrote:
>>
>>> You have to redefine the header, it automatically inserts
>>> \chapter*{Index}. You have to remove the asterisk. I do not remember the
>>> details, I would have to search in the documentatin but it is written there.
>>>
>>>
>>> Zdeněk Wagner
>>> http://ttsm.icpf.cas.cz/team/wagner.shtml
>>> http://icebearsoft.euweb.cz
>>>
>>> 2018-04-24 23:09 GMT+02:00 Kamal Abdali <***@acm.org>:
>>>
>>>> To get the index listed in the table of contents, I include these two
>>>> lines in the preamble of a xelatex+polyglossia+bidi program:
>>>>
>>>> \usepackage[imakeidx]
>>>> \makeindex[intoc]
>>>>
>>>> My problem is that while the index does get produced it doesn’t get
>>>> listed in the TOC. The trouble can be reproduced in this small program:
>>>>
>>>> %%%%%%%%%%%%%%%%%%%
>>>> \documentclass{book}
>>>>
>>>> \usepackage{imakeidx}
>>>> \makeindex[intoc]
>>>>
>>>> \usepackage{polyglossia}
>>>> \usepackage{bidi} %%%%%
>>>> \setmainlanguage{english}
>>>>
>>>> \title{Facts}
>>>> \author{Aleck}
>>>> \date{}
>>>>
>>>> \begin{document}
>>>> \maketitle
>>>> \tableofcontents
>>>> \chapter{Stars}
>>>> Sirius, the brightest star in the night sky, is actually a double star.
>>>> \index{Sirius}
>>>> \printindex
>>>> \end{document}
>>>> %%%%%%%%%%%%%%%%%%%%
>>>>
>>>> The above program produces the index without listing it in the TOC.
>>>> However, if you comment out the \usepackage{bidi} line, the index IS
>>>> produced and listed in TOC as expected.
>>>>
>>>> Note that the above program doesn’t really need bidi as all of its
>>>> output text is in the Latin script. But I do need the bidi feature in the
>>>> actual document that I need to process.
>>>>
>>>> Any help will be appreciated.
>>>>
>>>> Kamal Abdali
>>>>
>>>>
>>>>
>>>>
>>>> --------------------------------------------------
>>>> Subscriptions, Archive, and List information, etc.:
>>>> http://tug.org/mailman/listinfo/xetex
>>>>
>>>>
>>>
>>>
>>>
>>> --------------------------------------------------
>>> Subscriptions, Archive, and List information, etc.:
>>> http://tug.org/mailman/listinfo/xetex
>>>
>>>
>>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex
>
Veesh Goldman
2018-04-25 19:29:55 UTC
Permalink
To clarify two points: to op used the intoc option, which should make the
index appear in the toc (very aptly named, egreg). Thus, this is an example
of bidi making a problem. It's just a lack of support really. The
workaround he used was to save away the imakeidx version of theindex and
restore it at the document beggining, which isn't dangerous at all.
Also, the solution I put in the previous post was only to make an RTL index
line up on the correct side. It doesn't actually add bidi support. Vafa
should do that.
Wilfred van Rooijen
2018-04-26 03:32:28 UTC
Permalink
I also tried to answer the original question, but since I could not find a proper solution I did not answer.
Indeed, the problem has something to do with bidi, and perhaps also with multicol. If you change the order of the packages, there is an error from bidi about multicolumn environment.
This is one of the perennial problems with (La)TeX, i.e. the interaction between the class file and the style files, which is nowadays even made worse with the various "modern" TeX engines (pdfLaTeX, XeLaTeX, LuaLaTeX) which have their own options about PDF settings etc. Add to that the fact that sometimes there are class files or style files which rely on outdated packages...... I am often surprised that most of the time, everything works as well as it does :-))
Wilfred


On Thursday, April 26, 2018 4:32 AM, Veesh Goldman <***@gmail.com> wrote:


To clarify two points: to op used the intoc option, which should make the index appear in the toc (very aptly named, egreg). Thus, this is an example of bidi making a problem. It's just a lack of support really. The workaround he used was to save away the imakeidx version of theindex and restore it at the document beggining, which isn't dangerous at all.
Also, the solution I put in the previous post was only to make an RTL index line up on the correct side. It doesn't actually add bidi support. Vafa should do that.


--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex
Loading...