Lit*_*eet 10 image alignment pandoc
从pandoc文档中我知道如何插入图像
http://johnmacfarlane.net/pandoc/README.html#images
现在我想在同一行中对齐两个图像,我该怎么做?我想要的输出格式是pdf.
Joh*_*ane 15
你可以尝试这样的事情:
\ 
Run Code Online (Sandbox Code Playgroud)
这将为您提供两个并排的图像.但是你不会有标题; pandoc仅将图像视为字幕图形,如果它本身在段落中.
从John的答案扩展,如果您确实希望在两个并排的图形下放置一个标题,那么“ hack”就是这样做的:
{width=60%}
{width=40%}
\begin{figure}[!h]
\caption{A single caption for the two subfigures}
\end{figure}
Run Code Online (Sandbox Code Playgroud)
这样就为两个并排放置的图像提供了一个标题。您可能需要调整每个单独图像的宽度设置,或调整!h字幕放置说明符,以使内容看起来像这样:
我发现这很有用,因为您不必像纯LaTeX \subfigure解决方案那样从互联网上下载图片。即只是使用pandoc markdown来获取图像,然后使用LaTeX来生成标题。
如果您想发疯,实际上可以使用与上述相同的方法来制作子图形标题,如下所示:
{width=60%}
{width=40%}
\begin{figure}[!h]
\begin{subfigure}[t]{0.6\textwidth}
\caption{Caption for the left subfigure}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.4\textwidth}
\caption{Caption for the right subfigure}
\end{subfigure}
\caption{A single caption for the two subfigures}
\end{figure}
Run Code Online (Sandbox Code Playgroud)
编辑20180910:
您需要在pandoc YAML frontmatter / header中包含以下软件包:
header-includes: |
\usepackage{caption}
\usepackage{subcaption}
Run Code Online (Sandbox Code Playgroud)