制作目录 toc (table of content)

  1. 指定参数 --toc
  2. 设置目录标题名称 --variable=toc-title:"目录"

    1
    
    pdf -s demo.md -o demo.pdf --pdf-xelatex --toc --variable=toc-title:"目录"

bookmarks 书签制作

参考:

步骤:

  1. 制作 .tex 文件

    1
    
    pdf -s demo.md -o demo.pdf --pdf-xelatex --toc --variable=toc-title:"目录"
  2. 运行 遍 latex 制作 pdf 的命令

    1
    2
    3
    
    xelatex demo.tex
    
    xelatex demo.tex

pandoc 需要额外 latex package 解决方法

通过 .tex 文件做为中间步骤

步骤:

  1. 先通过 pandoc 把 markdown + pandoc 独有功能通过命令行转换到 .tex 文件

    1
    2
    
    pandoc -s demo.md -o demo.tex \
             -H ./deeplists.tex --toc --variable=toc-title:"目录"
  2. 通过 xelatex

    1
    
    xelatex ./demo.tex -o demo.pdf

通过 .org 文件作文中间步骤

  1. 通过 pandoc 把 .md 文件转换文 .org 文件
  2. 通过 ox-pandoc, C-c C-e 转换成 pdf

中文支持

参考:

不支持中文字符问题

需要使用 xelatex

1
pdf -s demo.md -o demo.pdf --pdf-xelatex

不使用导致的问题

tools ❯ pandoc -s request-research.md -o demo.pdf
Error producing PDF.

! Package inputenc Error: Unicode character 半 (U+534A)
(inputenc)                not set up for use with LaTeX.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
...

l.70 ...0ux6a21ux5757-c-ux9700ux6c42ux6587ux6863}}

Try running pandoc with --pdf-engine=xelatex.

字体错误,missing character for '中'

1
pdf -s demo.md -o demo.pdf --pdf-xelatex -V CJKmainfont='Microsoft YaHei UI'

列表嵌套太多问题

参考:

方法:

  1. 创建文件 deeplists.tex

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    \usepackage{enumitem}
    \setlistdepth{9}
    
    \setlist[itemize,1]{label=$\bullet$}
    \setlist[itemize,2]{label=$\bullet$}
    \setlist[itemize,3]{label=$\bullet$}
    \setlist[itemize,4]{label=$\bullet$}
    \setlist[itemize,5]{label=$\bullet$}
    \setlist[itemize,6]{label=$\bullet$}
    \setlist[itemize,7]{label=$\bullet$}
    \setlist[itemize,8]{label=$\bullet$}
    \setlist[itemize,9]{label=$\bullet$}
    \renewlist{itemize}{itemize}{9}
    
    \setlist[enumerate,1]{label=$\arabic*.$}
    \setlist[enumerate,2]{label=$\alph*.$}
    \setlist[enumerate,3]{label=$\roman*.$}
    \setlist[enumerate,4]{label=$\arabic*.$}
    \setlist[enumerate,5]{label=$\alpha*$}
    \setlist[enumerate,6]{label=$\roman*.$}
    \setlist[enumerate,7]{label=$\arabic*.$}
    \setlist[enumerate,8]{label=$\alph*.$}
    \setlist[enumerate,9]{label=$\roman*.$}
    \renewlist{enumerate}{enumerate}{9}
  2. pandoc 命令指定 -H ./deeplists.tex

    1
    
    pandoc -s demo.md -o demo.md -H ./deeplists.tex