从Pandoc LaTeX到Word的转换过程中如何剥离图形和表格? [英] How can I strip figures and table during a pandoc LaTeX to Word conversion?

查看:512
本文介绍了从Pandoc LaTeX到Word的转换过程中如何剥离图形和表格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用pandoc将论文从乳胶转换为docx.通常,使用以下命令可以很好地解决此问题:

I am trying to use pandoc to convert a thesis from latex to docx. In general, this works well with the following command:

pandoc input.tex -f latex -t docx -s -o output.docx --bibliography references.bib --csl=mystyle.csl

但是,我还有其他无法满足的要求.我希望从源文件中包含的所有图形和表格中剥离输出.到目前为止,阅读pandoc文档和相关的stackoverflow问题并没有帮助我.

However, I have an additional requirement that I am unable to fulfill. I want the output to be stripped from any figures and tables that are included in the source files. Reading the pandoc documentation and related stackoverflow question has not helped me so far.

您对如何解决这个问题有建议吗?

Do you have suggestions on what could do the trick?

推荐答案

这是 pandoc过滤器.以下Lua过滤器将删除所有表和图像:

This is a poster use-case for pandoc filters. The following Lua filter will delete all tables and images:

function Image () return {} end
function Table () return {} end

将其保存到文件中,例如remove-tables-images.lua,然后通过--lua-filter参数将该文件传递给pandoc:

Save it to a file, say remove-tables-images.lua, and pass the file to pandoc via the --lua-filter parameter:

pandoc input.tex -s -o output.docx \
    --bibliography references.bib --csl=mystyle.csl \
    --lua-filter remove-tables-images.lua

这篇关于从Pandoc LaTeX到Word的转换过程中如何剥离图形和表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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