sdb*_*bbs 8 pdf markdown latex pandoc
我已经看到使用 Pandoc 和 LaTeX 从 docx 转换为 pdf 时如何修复“缺失字符”警告?- 但不幸的是,那里的建议似乎不适用于这个测试用例:
\n$ git clone https://github.com/raspberrypi/documentation.git\n$ cd documentation/configuration\n$ pandoc *.md --pdf-engine=xelatex -o result.pdf\n[WARNING] Missing character: There is no \xe2\x94\x8c (U+250C) in font [lmmono10-regular]:!\n[WARNING] Missing character: There is no \xe2\x94\x80 (U+2500) in font [lmmono10-regular]:!\n[WARNING] Missing character: There is no \xe2\x94\x80 (U+2500) in font [lmmono10-regular]:!\n[WARNING] Missing character: There is no \xe2\x94\x80 (U+2500) in font [lmmono10-regular]:!\n[WARNING] Missing character: There is no \xe2\x94\x80 (U+2500) in font [lmmono10-regular]:!\n...\n[WARNING] Missing character: There is no \xe2\x94\x80 (U+2500) in font [lmmono10-regular]:!\n[WARNING] Missing character: There is no \xe2\x94\x80 (U+2500) in font [lmmono10-regular]:!\n[WARNING] Missing character: There is no \xe2\x94\x98 (U+2518) in font [lmmono10-regular]:!\nRun Code Online (Sandbox Code Playgroud)\n因此,拉丁现代单声道中缺少一些特定的“方框图”字形 - 因此它们可能在代码片段的上下文中使用。
\n在这种情况下有没有办法提供“后备字体”?或者我怎样才能解决这个问题,否则我可以通过 pandoc 从这些 Markdown 文件生成(Latex)PDF?
\n编辑:发现:
\n...所以我尝试:
\nheader-includes.yaml:
---\nheader-includes: |\n \\usepackage{combofont}\n \\setupcombofont{multiscript-regular}\n {\n {file:lmsans10-regular.otf:\\combodefaultfeat} at #1pt,\n {file:DejaVuSans.ttf} at #1pt,\n {file:NotoSansCJK-Regular.ttc(0)} at #1pt\n }\n {\n {} ,\n fallback,\n fallback\n }\n \\DeclareFontFamily{TU}{multiscript}{}\n \\DeclareFontShape {TU}{multiscript}{m}{n} {<->combo*multiscript-regular}{}\n \\fontfamily{multiscript}\\selectfont\n...\nRun Code Online (Sandbox Code Playgroud)\n...然后我尝试了(注意,仅使用存储库中的单个文件,raspi-config.md此处):
$ pandoc header-includes.yaml ./raspi-config.md --pdf-engine=lualatex -o result.pdf\nError producing PDF.\n! Paragraph ended before \\setupcombofont was complete.\n<to be read again>\n\\par\nl.61\nRun Code Online (Sandbox Code Playgroud)\n...所以,也无法让这种方法发挥作用...
\n您可以通过检查 pandoc 如何解析输入来查看发生了什么,例如将其转换回 Markdown:pandoc -t native -s -t markdown -V header-includes='' header-includes.yaml
---
header-includes: |
```{=tex}
\usepackage{combofont}
\setupcombofont{multiscript-regular}
```
{ {file:lmsans10-regular.otf:`\combodefaultfeat`{=tex}} at \#1pt,
{file:DejaVuSans.ttf} at \#1pt, {file:NotoSansCJK-Regular.ttc(0)} at
\#1pt } { {} , fallback, fallback }
`\DeclareFontFamily{TU}{multiscript}{}`{=tex}
`\DeclareFontShape {TU}{multiscript}{m}{n}`{=tex}
{\<-\>combo\*multiscript-regular}{}
`\fontfamily{multiscript}`{=tex}`\selectfont`{=tex}
---
Run Code Online (Sandbox Code Playgroud)
您会注意到某些部分不被识别为 TeX,而是被识别为纯文本。使用原始属性语法强制解释为 LaTeX 块:
---
header-includes: |
- ```{=latex}
\usepackage{combofont}
\setupcombofont{multiscript-regular}
{
{file:lmsans10-regular.otf:\combodefaultfeat} at #1pt,
{file:DejaVuSans.ttf} at #1pt,
{file:NotoSansCJK-Regular.ttc(0)} at #1pt
}
{
{} ,
fallback,
fallback
}
\DeclareFontFamily{TU}{multiscript}{}
\DeclareFontShape {TU}{multiscript}{m}{n} {<->combo*multiscript-regular}{}
\fontfamily{multiscript}\selectfont
```
...
Run Code Online (Sandbox Code Playgroud)
或者,您可以将 TeX 片段写入文件并通过-H选项传递该文件,这会将文件内容不变地插入到中间 LaTeX 文件中。
| 归档时间: |
|
| 查看次数: |
3772 次 |
| 最近记录: |