安装 pandoc:
$ sudo apt install texlive-latex-base pandoc
使用 pandoc 将 Markdown 文件制作成 pdf:
$ pandoc file.md -o file.pdf
错误信息:
kpathsea: Running mktextfm ecrm1000
/usr/share/texlive/texmf-dist/web2c/mktexnam: Could not map source abbreviation for ecrm1000.
/usr/share/texlive/texmf-dist/web2c/mktexnam: Need to update ?
mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input ecrm1000
This is METAFONT, Version 2.7182818 (TeX Live 2019/Debian) (preloaded base=mf)
kpathsea: Running mktexmf ecrm1000
! I can't find file `ecrm1000'.
<*> ...ljfour; mag:=1; nonstopmode; input ecrm1000
Please type another input file name
! Emergency stop.
<*> ...ljfour; mag:=1; nonstopmode; input ecrm1000
Transcript written on mfput.log.
grep: ecrm1000.log: No such file or directory
mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input ecrm1000' failed to make ecrm1000.tfm.
kpathsea: Appending font creation commands to missfont.log.
kpathsea: Running mktextfm ecrm1000
/usr/share/texlive/texmf-dist/web2c/mktexnam: Could not map source abbreviation for ecrm1000.
/usr/share/texlive/texmf-dist/web2c/mktexnam: Need to update ?
mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input ecrm1000
This is METAFONT, Version 2.7182818 (TeX Live 2019/Debian) (preloaded base=mf)
kpathsea: Running mktexmf ecrm1000
! I can't find file `ecrm1000'.
<*> ...ljfour; mag:=1; nonstopmode; input ecrm1000
Please type another input file name
! Emergency stop.
<*> ...ljfour; mag:=1; nonstopmode; input ecrm1000
Transcript written on mfput.log.
grep: ecrm1000.log: No such file or directory
mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input ecrm1000' failed to make ecrm1000.tfm.
kpathsea: Appending font creation commands to missfont.log.
Error producing PDF.
! Font T1/cmr/m/n/10=ecrm1000 at 10.0pt not loadable: Metric (TFM) file not fou
nd.
<to be read again>
relax
l.105 \fontencoding\encodingdefault\selectfont
make: *** [Makefile:4: lifting.pdf] Error 43
答案1
您还必须安装 texlive-fonts-recommended。
因此,为了让 pandoc 真正创建 PDF,您需要执行以下操作:
$ sudo apt install texlive-latex-base pandoc texlive-fonts-recommended
现在上述命令可以正常工作(一个名为 file.md 的有效 markdown 文档):
$ pandoc file.md -o file.pdf