如果要生成目录, 并且目录要带上页数,可以在 markdown 文档的开头加入了属性值:
---
title: 'The Grand AI Lexicon'
author: 'Kellen Sun'
date: 'July, 2025'
mainfont: 'Times New Roman'
cjkmainfont: 'Microsoft YaHei'
monofont: 'Doulos SIL'
documentclass: book
classoption: twoside
fontsize: 11pt
geometry:
- "paperwidth=6in"
- "paperheight=9in"
- "inner=0.75in"
- "outer=0.5in"
- "top=0.75in"
- "bottom=1in"
toc: true
number-sections: true
toc-depth: 1
header-includes: |
\usepackage{tipa}
\usepackage{fontspec}
\usepackage{xeCJK}
\setCJKmainfont{Microsoft YaHei}
\setCJKmonofont{Doulos SIL}
\setcounter{tocdepth}{1}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[CE,CO]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\usepackage{enumitem}
\setlist[itemize,1]{label=$\bullet$}
\setlist[itemize,2]{label=$\circ$}
\setlist[itemize,3]{label=$\ast$}
---
之后在终端执行命令
pandoc AI_lexicon_20250726.md -o AI_lexicon_20250726.tex -s --from markdown+hard_line_breaks --table-of-contents
xelatex mybook.tex
如果有无法转换的字符, 可以在 mybook.log 中查找 missing character , 看是哪个字符转换不了, 用 Latex 语法替换修改后再次执行命令转换。