如何指定使用 pandoc 导出的 word doc 使用的字体? [英] How to specify the font used for word doc exported using pandoc?

查看:168
本文介绍了如何指定使用 pandoc 导出的 word doc 使用的字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用pandoc渲染Microsoft Word文档.字体的标题似乎默认为 Calibri ,正文文本默认为 Cambri .目标是使文件使用Arial或Times罗马字体.

Rendering a microsoft word document using pandoc. The font seems to default to Calibri for headings and Cambri for body text. Goal is to have the file use Arial or Times roman fonts.

我不想用文字触摸/编辑/与文件有任何关系.

I don't want to touch/edit/have anything to do with the file in word.

如何从多重降价来源或 pandoc的调用中设置将在Word™中使用的字体?

How can I set the font that will be used in Word™ from either the multi-markdown source or in the call to pandoc?

Pandoc命令:

pandoc -s my_markdown.txt -o whycambriafont.docx

此问题: pandoc生成的docx缺少方程式中的斜体变量显示了一种通过创建一个zip文件然后编辑样式文件来编辑字体样式的方法,但这很麻烦.

This question: pandoc-generated docx misses italic variables in equations shows a way to edit the font styles by creating a zip and then editing the style files, but is a kludge.

推荐答案

您可以使用

You can supply a reference.docx file with the --reference-doc option to pandoc which acts sort of like a template.

  1. 使用 echo'hello word'生成文件|pandoc -o reference.docx 或类似的文件.
  2. 更改样式中的字体.通过在Word中打开文件,更改样式并保存它,或者例如使用 vim 打开它:
    • reference.docx 重命名为 reference.zip
    • vim reference.zip 并选择 reference/theme/theme1.xml
    • 找到并将 Calibri 更改为 Arial
    • 保存并将zip重命名为docx
  1. Generate a file with echo 'hello word' | pandoc -o reference.docx or similar.
  2. Change the font in the style. Either by opening the file in Word, changing the style and saving it, or alternatively opening it for example with vim:
    • Rename the reference.docx to reference.zip
    • vim reference.zip and select reference/theme/theme1.xml
    • find and change Calibri to Arial
    • save and rename zip back to docx

另请参见定义-custom-DOCX样式在LibreOffice中(和Word).

这篇关于如何指定使用 pandoc 导出的 word doc 使用的字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆