Pandoc Markdown to PDF image position

vktec picture vktec · Mar 26, 2018 · Viewed 8.8k times · Source

When converting a Markdown document to PDF with pandoc, my images are not placed in the same position I put them in the source code. I believe this is due to the conversion through LaTeX, but I'm not sure how to remedy this in the Markdown source.

If I use a placeholder image with several paragraphs of sample text and strategically place the image in the source, it becomes too big to fit on the page in the place where I've put it, so the LaTeX layout engine kindly places it on the next page. However, I'd rather this didn't happen because it means the image isn't where I expect and is harder to reference.

I can include an example if necessary, but it's trivial to reproduce and the source needs to be somewhat extensive to fill an entire page.

Answer

Bruno BEAUFILS picture Bruno BEAUFILS · Mar 28, 2018

Did you try to deactivate the implicit_figures as in

pandoc -f markdown-implicit_figures -t pdf myfile.md

To solve the size problem you could also try to fix the size within the markdown file with an attribute. Something like that can do the trick:

![Caption text](/path/to/image){ width=50% }