Wandmalfarbe / pandoc-latex-template

A pandoc LaTeX template to convert markdown files to PDF or LaTeX.
BSD 3-Clause "New" or "Revised" License
6.21k stars 968 forks source link

Question: Is it possible to use makeindex with Eisvogel? #243

Closed astridx closed 3 years ago

astridx commented 3 years ago

Thank you very much for Eisvogel.

I like to add an index.

I found this page: https://en.wikibooks.org/wiki/LaTeX/Indexing

So I add via -include-in-header index.tex

this lines:

\usepackage{makeidx}
\makeindex

In my document I use

Installation\index{Installation}

and at the end

\printindex

Unfortunately, no index is printed.

This is my command

pandoc "test.md" \
    --from markdown --to latex \
    --toc \
    --toc-depth=1 \
    --include-in-header index.tex \
    --include-in-header chapter_break.tex \
    --include-in-header inline_code.tex \
    --include-in-header bullet_style.tex \
    --include-in-header pdf_properties.tex \
    --highlight-style pygments.theme \
    -V toc-title='Inhaltsverzeichnis' \
    -V title='Mein Titel' \
    -V author='Ich' \
    -V book=true \
    -V date="24. Mai 2021" \
    -V classoption='oneside' \
    --template ./eisvogel.latex \
    --listings \
    -o "test.pdf"

I am quite new to Pandoc and Latex. Maybe I am making a simple mistake. I would appreciate a hint.

Because I am not sure, if this is a Eisvogel related, I asked this question here, too: https://stackoverflow.com/questions/67670491/use-makeindex-with-pandoc-while-creating-a-pdf-from-a-markdown-file

ibayer commented 3 years ago

@astridx

I'm new to this template as well but just adding --toc to the pandoc comment worked for me without additional latex files. I would recommend to simplify your commend to the bare essentials keeping only --toc for index generation to see where the problem lays. Also remove all latex stuff from the md file for testing.

astridx commented 3 years ago

@ibayer Thank you very much. I think I did not explain myself well. Table of content (toc) works finde for me. I like to add an Index.

... an alphabetical list of words and expressions with the pages of the book upon which they are to be found

Unfortunately, I still have not found a solution here.

ibayer commented 3 years ago

@astridx After re-reading your initial post I realize that I confused index with toc. Sorry for the noise, your question surpasses my current experience with the template. :-) I hope someone else can help out.

astridx commented 3 years ago

Edit I found a temporarily solution:

First I create a *.latex.

pandoc JoomlaEnPDF.en.md \
-o 1.en.tex \
--from markdown \
--template ./eisvogel.latex \
--listings \
--toc \
--toc-depth=1 \
-V toc-title="Content" \
--top-level-division="part" \
--number-sections \

Then I run the commands manually.

pdflatex 1.en.tex
pdflatex 1.en.tex

makeindex 1.en.idx

cat  ./1.en.ind  >> JoomlaEnPDF.en.md

Then I create the pdf

pandoc JoomlaEnPDF.en.md \
-o 1.en.pdf \
--from markdown \
--template ./eisvogel.latex \
--listings \
--toc \
--toc-depth=1 \
-V toc-title="Table of Contents" \
--top-level-division="part" \
--number-sections \
Wandmalfarbe commented 3 years ago

The default pandoc template and Eisvogel have no support for an index. Your workaround is a nice solution for this shortcoming.