【问题标题】:Pandoc: Different outputs to docx and LaTeX formatsPandoc:docx 和 LaTeX 格式的不同输出
【发布时间】:2019-05-29 22:42:14
【问题描述】:

例如,在 LaTeX 中,可以有一个很好的内联方程,如 $x^2=4$,我很乐意使用 docx 格式的斜体文本。 有没有办法告诉 Pandoc 根据输出格式使用其中一种解决方案?
在寻找可能的解决方案时,我意识到 pandoc 有过滤器和模板。我真的不明白,该遵循哪个方向。
但我真的很想得到一个更通用的解决方案,它也适用于类似的任务,例如,数字和单位之间的较小空间:在 LaTeX 中直接$\;$,但在我的 Markdown 文档中包含这个不会给出我在 DOCX 或 ODT 输出中取得了令人满意的结果。

【问题讨论】:

标签: pandoc


【解决方案1】:

这是我从 pandoc manual找到的

For docx output, styles will be defined in the output file as inheriting from normal
text, if the styles are not yet in your reference.docx. If they are already defined,
pandoc will not alter the definition.

请阅读手册的 --reference-doc=FILE 部分

--reference-doc=FILE
Use the specified file as a style reference in producing a docx or ODT file.
...

如何在pandoc中使用reference-doc???

  1. 创建一个空的 docx 文件并重命名(例如,refer.docx)
  2. 定义要显示的样式
  3. 将“--reference-doc=(refer.docx path)”添加到您的 pandoc 命令行中。

【讨论】:

    猜你喜欢
    • 2021-02-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-08
    • 2019-05-01
    • 2014-12-06
    • 2011-06-12
    相关资源
    最近更新 更多