8

I would like to make the example I have written in this question to work in Pandoc. When run using pandoc input-tex-file -o output-epub-file, pandoc produces a nice ebook using this tex file. However, the ebook lacks the indexes. How can I get the indexes in the output ebook?

2

2 Answers 2

1

You can add index to you Pandoc generated ebook using the two steps:

  1. Adding identifier to your heading, for example the following {#foo} syntax added the identifier for to the heading My heading,
# My heading {#foo}

we assume the file name was chap01.md.

  1. Creating a index type of file as your book index. In this file, you can write book index using markdown link format. eg:
# Index {epub:type=index}

#. [Index to My heading ](#foo)

we assume the file name was index.md.

Finally, your can generate the ebook with index using:

pandoc index.md chap01.md -s -o indexed_ebook.epub
1
  • 2
    This looks like a table of contents, rather than an index. Are you sure this is, what the OP meant?
    – DG'
    Commented Aug 15, 2019 at 7:41
0

Actually, often the first thing an editor does when transforming to an eBook e.g. ePUB is to remove the table of content page. This is because the eReader will generate a table of content based on the hierarchy of the document, and it will make it available through some special interactions, in the eBooks the page where a content is present will change depending on the setting the user uses (e.g. font-size) so there is no need for a page containing the table of content!

Pandoc actually can generate a table of content using --toc flag but this won't work with ePUB for the aforementioned reasons.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .