首页 > 解决方案 > 从 Markdown 文件创建 PDF 时使用 makeindex 和 pandoc

问题描述

我有一个markdown file并且喜欢将其转换为pdf. 我需要一个索引。为此我找到了makeindx

我正在使用此命令从降价文件创建 pdf:

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"

我在github上找到的 Eisvogel 模板。我也在这里的一个问题中问了这个问题。

该文件index.tex具有以下内容:

\usepackage{makeidx}
\makeindex

在我的文档中,我使用

Installation\index{Installation}

最后

\printindex

不幸的是,没有打印索引。

难道我做错了什么?


编辑我找到了一个临时解决方案:

首先我创建一个 *.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 \

然后我手动运行命令。

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

makeindex 1.en.idx

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

然后我创建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 \

标签: pdflatexmarkdownpandoc

解决方案


推荐阅读