
Markdown ファイルから PDF を作成していますが、出力をカスタマイズしたいと考えています。具体的には、結果の PDF の目次のタイトルを変更したいと考えています。
現在は「コンテンツ」です:
タイトルを変更するにはどうすればいいですか?
私は Arch Linux 5.1.2 で Pandoc 2.7.2 を次のように呼び出しています:
pandoc --pdf-engine=xelatex --toc test.md -o doc.pdf
完全を期すと、次のようになりますtest.md
。
# First Heading
Some text
# Second Heading
More text
# Third Heading
Even more text
答え1
と-V toc-title:"Custom text"
のテンプレートを見ると/usr/share/pandoc/data/templates/default.latex
、次の部分があります:
$if(toc)$
$if(toc-title)$
\renewcommand*\contentsname{$toc-title$}
$endif$
toc-title
これは、 Pandoc にパラメータを渡すことができることを示唆しています。
pandoc --pdf-engine=xelatex --toc test.md -V toc-title:"Custom text" -o doc.pdf
実際、目次のタイトルは変更されました。
テンプレートの変更の詳細については、この答えそしてドキュメント。
抄録のタイトルを「抄録」から別のものに変更するには、次のように入力します。
header-includes:
\renewcommand{\abstractname}{Different abstract title}