使用 pandoc 转换“tree”命令的输出时缺少字符

使用 pandoc 转换“tree”命令的输出时缺少字符

我有一个包含 Unix 命令输出的 markdown 文档tree

output/
├── cutadapt
│   ├── 0001.PbANKA_820_S1_R1.log
│   ├── 0002.PbANKA_820_S2_R1.log
│   └── 0003.PbANKA_R1.log
├── fastqc
│   ├── PbANKA_820_S1_R1_fastqc.html
│   ├── PbANKA_820_S1_R1_fastqc.zip
etc etc...

当我使用 pandoc 转换为 pdf 时,我收到许多警告:

pandoc --pdf-engine=xelatex README.md -o README.pdf

[WARNING] Missing character: There is no ├ (U+251C) in font [lmmono10-regular]:!
[WARNING] Missing character: There is no ─ (U+2500) in font [lmmono10-regular]:!
[WARNING] Missing character: There is no ─ (U+2500) in font [lmmono10-regular]:!
[WARNING] Missing character: There is no │ (U+2502) in font [lmmono10-regular]:!
[WARNING] Missing character: There is no ├ (U+251C) in font [lmmono10-regular]:!
[WARNING] Missing character: There is no ─ (U+2500) in font [lmmono10-regular]:!
...etc etc

(文档中的其他内容使用简单的即可顺利转换pandoc README.md -o README.pdf)。

我知道我需要设置适当的选项-V "mainfont:..."?但我似乎无法做到正确。我尝试使用:

fc-list ':charset=251C'

据我了解,它fc-list为我提供了一系列支持角色的列表├ (U+251C),但我应该从中选择哪一个呢?无论如何,我尝试了其中几个,但警告仍然存在:

pandoc --pdf-engine=xelatex -V "mainfont:DejaVu Sans" README.md -o README.pdf

[WARNING] Missing character: There is no ├ (U+251C) in font [lmmono10-regular]:!
[WARNING] Missing character: There is no ─ (U+2500) in font [lmmono10-regular]:!
[WARNING] Missing character: There is no ─ (U+2500) in font [lmmono10-regular]:!
...

此外,是否可以使用pdflatex而不是进行转换xelatex


附加信息:

pandoc -v
pandoc 2.17.1.1
Compiled with pandoc-types 1.22.1, texmath 0.12.4, skylighting 0.12.2,
citeproc 0.6.0.1, ipynb 0.2
User data directory: /home/dario/.local/share/pandoc
Copyright (C) 2006-2022 John MacFarlane. Web:  https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.

xelatex -v
XeTeX 3.14159265-2.6-0.99998 (TeX Live 2017/Debian)
kpathsea version 6.2.3
Copyright 2017 SIL International, Jonathan Kew and Khaled Hosny.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the XeTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the XeTeX source.
Primary author of XeTeX: Jonathan Kew.
Compiled with ICU version 60.2; using 60.2
Compiled with zlib version 1.2.11; using 1.2.11
Compiled with FreeType2 version 2.8.1; using 2.8.1
Compiled with Graphite2 version 1.3.11; using 1.3.11
Compiled with HarfBuzz version 1.7.2; using 1.7.2
Compiled with libpng version 1.6.34; using 1.6.34
Compiled with poppler version 0.62.0
Compiled with fontconfig version 2.12.6; using 2.12.6

答案1

由于您可能将树放在代码块内,因此您还必须指定单声道字体:

pandoc --pdf-engine=xelatex -V "mainfont:DejaVu Sans" -V "monofont:DejaVu Sans Mono" README.md -o README.pdf

在此处输入图片描述

相关内容