Pandoc md 到 pdf:在分页前插入图像时保持顺序

Pandoc md to pdf: keep order when inserting image before pagebreak

如标题所述,我的问题是关于 pandocs md 到 pdf。

当我转换像

这样的降价时
# Title

...... text that is about a 3/4 page

![image that is too large to fit page](image.png)

Some more text

然后图像 "some more text" 之后的文本显示在第一页上,图像被推送到第二页,这改变了我的内容的顺序。

我能做的就是

# Title

...... text that is about a 3/4 page

\newpage
![image that is too large to fit page](image.png)

Some more text

但是维护起来很烦人,因为当我想在之后添加内容时,我必须检查 \newpage 是否仍然是必需的,或者我是否必须在其他地方添加另一个内容。

有什么真正的解决办法吗?也许是 YAML header 中的设置?

我在谷歌上搜索了很多,但没有找到解决方案。

谢谢:)

尝试使用命令行中的 pandocdeactivating the implicit_figures option 进行渲染,如:

pandoc my_markdown.md -f markdown-implicit_figures -o rendered_md.pdf

这样做的缺点是它会从图中删除标题。在 header 中包含以下 tex 非常适合我(也从 here 复制):

\usepackage{float}
\let\origfigure\figure
\let\endorigfigure\endfigure
\renewenvironment{figure}[1][2] {
    \expandafter\origfigure\expandafter[H]
} {
    \endorigfigure
}