新手对 pandoc 和 pdf 导出时更改字体感到困惑

新手对 pandoc 和 pdf 导出时更改字体感到困惑

pandoc当我将 .MD 转换为 .PDF 时,我已经并且想要更改糟糕的默认字体。

我知道我可以传递-V命令行,默认情况下pandoc会使用它--pdf-engine=pdflatex。我想将字体系列更改为https://tug.org/FontCatalogue/clearsans/。我尝试:

pandoc -V fontfamily="ANYTHING" test.md -o test.pdf

然后得到

Error producing PDF.
! LaTeX Error: File `ANYTHING.sty' not found.

我正在阅读有关不同引擎的信息,但似乎没有安装。我可以看到一个完全是胡言乱语的配置文件。

我可以列出可用的字体或字体系列并在命令行上选择一个吗?

texlive在 Centos 8 上安装了很多东西...但似乎还有更多软件包。更改字体似乎很费劲!

tex --version
TeX 3.14159265 (TeX Live 2018)
kpathsea version 6.3.0

我还看到安装中包括:

Name         : texlive-latex-fonts
Summary      : A collection of fonts used in LaTeX distributions
URL          : http://tug.org/texlive/
License      : LPPL
Description  : This is a collection of fonts for use with standard latex
             : packages and classes. It includes 'invisible' fonts (for use
             : with the slides class), line and circle fonts (for use in the
             : picture environment) and 'latex symbol' fonts. For full support
             : of a latex installation, some Computer Modern font variants
             : cmbsy(6-9), cmcsc(8,9), cmex(7-9) and cmmib(5-9) from the
             : amsfonts distribution, are also necessary. The fonts are
             : available as Metafont source, and metric (tfm) files are also
             : provided. Most of the fonts are also available in Adobe Type 1
             : format, in the amsfonts distribution.

Name         : texlive-collection-basic
Summary      : Essential programs and files
URL          : http://tug.org/texlive/
License      : Artistic 2.0 and GPLv2 and GPLv2+ and LGPLv2+ and LPPL and MIT
             : and Public Domain and UCD and Utopia
Description  : These files are regarded as basic for any TeX system, covering
             : plain TeX macros, Computer Modern fonts, and configuration for
             : common drivers; no LaTeX.

Name         : texlive-collection-fontsrecommended
Summary      : Recommended fonts
URL          : http://tug.org/texlive/
License      : Artistic 2.0 and GPLv2 and GPLv2+ and LGPLv2+ and LPPL and MIT
             : and Public Domain and UCD and Utopia
Description  : Recommended fonts, including the base 35 PostScript fonts,
             : Latin Modern, TeX Gyre, and T1 and other encoding support for
             : Computer Modern, in outline form.

答案1

在最近安装的 TeX Live 上

pandoc -V fontfamily:ClearSans -V fontfamilyoptions:sfdefault test.md -o test.pdf

应该可以正常工作。要确保安装了正确的软件包,请使用软件包管理器tlmgr¹

tlmgr install clearsans

  1. 也许你需要使用sudo,取决于你的安装

相关内容