How to use Pandoc image alignment to align two images on the same line?

From the pandoc documentation I know how to insert an image

http://johnmacfarlane.net/pandoc/README.html#images

Now I want to align two images on one line, how can I do this? My desired output format is pdf.

+9
source share
4 answers

You can try something like this:

![](tests/lalune.jpg)\ ![](tests/lalune.jpg) 

This will give you two side-by-side images. However, you will not have an inscription; pandoc only treats the image as a title if it is in itself in a paragraph.

+14
source

If you continue with John’s answer, if you want two adjacent numbers to have signatures under one signature, the “hack” would be to do this:

 ![](https://upload.wikimedia.org/wikipedia/commons/7/70/Example.png){width=60%} ![](https://upload.wikimedia.org/wikipedia/commons/7/70/Example.png){width=40%} \begin{figure}[!h] \caption{A single caption for the two subfigures} \end{figure} 

This results in a single title for two images placed side by side. You may need to adjust each individual image width parameter or header placement qualifier !h to make it look like this:

hacked caption

I found this useful because you do not need to download a picture from the Internet, as in the pure LaTeX \subfigure . Those. just use pandoc markdown to get the image, and LaTeX to generate the title.

If you want to go crazy, you can use the same idea as above to create sub-figure signatures, for example:

 ![](https://upload.wikimedia.org/wikipedia/commons/7/70/Example.png){width=60%} ![](https://upload.wikimedia.org/wikipedia/commons/7/70/Example.png){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} 

enter image description here

Edit 20180910:

You will need to include the following packages in the pandoc YAML header / header:

 header-includes: | \usepackage{caption} \usepackage{subcaption} 
+5
source

You can use a preprocessor like gpp to enable options such as image alignment. Or you could do it like John told you:

 ![](tests/lalune.jpg)\ ![](tests/lalune.jpg) 
+2
source

One easy way is to first convert the file to a .tex file, where you can adjust the alignment of the image using the LaTeX minipage command or so. Then you can get the .pdf file with latex or pandoc on the command line. See Pandoc Demos , for example.

+1
source

All Articles