gpt4 book ai didi

pdf - pandoc Markdown 到 pdf : fixing missing character warnings?

转载 作者:行者123 更新时间:2023-12-03 18:59:38 25 4
gpt4 key购买 nike

我见过How do I fix "missing character" warnings when converting from docx to pdf using Pandoc and LaTeX? - 但不幸的是,那里的建议似乎不适用于这个测试用例:

$ git clone https://github.com/raspberrypi/documentation.git
$ cd documentation/configuration
$ pandoc *.md --pdf-engine=xelatex -o result.pdf
[WARNING] Missing character: There is no ┌ (U+250C) 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+2500) 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+2500) in font [lmmono10-regular]:!
[WARNING] Missing character: There is no ┘ (U+2518) in font [lmmono10-regular]:!
因此,Latin Modern Mono 中缺少一些特定的“框绘图”字形 - 因此它们可能用于代码片段的上下文中。
在这种情况下,有没有办法提供“后备字体”?或者我怎么能解决这个问题,所以我可以通过pandoc从这些 Markdown 文件生成(Latex)PDF?

编辑:发现:
  • https://tex.stackexchange.com/questions/512396/inserting-any-unicode-character-in-latex-document
  • https://tex.stackexchange.com/questions/139139/adding-headers-and-footers-using-pandoc

  • ......所以我试过: header-includes.yaml :
    ---
    header-includes: |
    \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
    ...
    ...然后我尝试了(注意,只使用来自 repo 的单个文件, raspi-config.md ,在这里):
    $ pandoc header-includes.yaml ./raspi-config.md --pdf-engine=lualatex -o result.pdf
    Error producing PDF.
    ! Paragraph ended before \setupcombofont was complete.
    <to be read again>
    \par
    l.61
    ......所以,也无法让这种方法发挥作用......

    最佳答案

    您可以通过检查 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}
    ---
    您会注意到某些部分不被识别为 TeX,而是被识别为纯文本。使用 raw attribute syntax 强制解释为 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
    ```
    ...
    或者,您可以将 TeX 片段写入文件并通过 -H 传递该文件。选项,这会将文件内容不变插入到中间 LaTeX 文件中。

    关于pdf - pandoc Markdown 到 pdf : fixing missing character warnings?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65177985/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com