ox-pandoc

latex 内嵌公式的支持

  • 不推荐使用 $formula$ 格式,这种格式对中文支持不友好,会导致转换 mathjax 公式失败
  • 推荐使用 \(formula\) 格式

inline 图片支持

在 org 文件中添加设置:

1
#+PANDOC_OPTIONS: self-contained:t

全部 resources 数据 inline 支持

  1. 修改 ox-pandoc

    1
    2
    
    (with-eval-after-load 'ox-pandoc
     (add-to-list  'org-pandoc-valid-options 'embed-resources))
  2. 修改 org-mode 文件 header

    1
    2
    
    #+PANDOC_OPTIONS: standalone:t embed-resources:t reference-doc:./custom-reference_1.docx
    #+OPTIONS: ^:{}
    • 这里设置了 pandoc options: standalone:t embed-resources:t
  3. 导出 C-c C-e
  4. 特点:

    • css, js, 图片等等,各种数据都会被下载下来,整合到单个 html 文件中

如何避免下划线格式文本被当做下标

比如:table_next, 这里 next 在 export 后的文档中变成了下标

修复方法:

1
#+OPTIONS: ^:{}

输出成 docx MS Word 文件方法

参考:

步骤:

  • 使用 ox-pandoc
  • C-c C-e 选择 pandoc –> docx

已知问题:

  • 转换后的 docx 文件中可能存在​~字体~​问题,需要手动修复
  • 转换后的 图片大小和版式 需要手动调整

版式模板文件设置 reference.docx

  1. 制作方法:

    1. 生成一个 custom-reference.docx

      pandoc -o custom-reference.docx --print-default-data-file reference.docx
      
    2. 手动修改成自己满意的格式

  2. 使用 custom-reference.docx 的几种方法

    • ox-pandoc 中使用:

      1
      2
      
      #+PANDOC_OPTIONS: reference-doc:~/.config/pandoc/custom-reference.docx
      #+PANDOC_OPTIONS: reference-doc:~/.config/pandoc/custom-reference-chinese.docx
    • pandoc-mode 中使用

      1. 设定 pandoc-data-dir
      2. 在 pandoc-data-dir 中存放一个 docx.pandoc 文件

    • 命令行添加参数 --reference-doc ./custom-reference.docx

      pandoc --reference-doc ./custom-reference.docx your.org your-output.docx
      

latex 公式编写注意事项

  1. 上下标编写

    • 注意取消 pretty-entities 模式,查看实际编写的代码
    • 命令: org-toggle-pretty-entities
  2. 中文时少用 $formula$, 推荐使用 \(formula\)