# Pandoc: Images intersect with codeblock [duplicate]

I am generating a pdf with pandoc (source is markdown) and as latex formatting is want to do, the images sometimes go onto the next page and not exactly where they are inside the content.

This is okay, but my latest version of a document has an image which is intersecting a code block.

code here


IMAGE + image tile

code continues


For obvious reasons this is jarring and not what I expected to happen. Is there a way to fix this? I do not want to inline the image (everything about how the image is displayed is how I want it, except its location).

Thanks!

## marked as duplicate by user36296, Zarko, Troy, Henri Menke, CarLaTeXJul 13 '17 at 2:37

The answer is on @Fran comment. It's simple, you either add a backslash plus a blank line or a \newpage after the image.

![Alt text](image.png)
\
{blank line here}


or

![Alt text](image.png)
\newpage

• Neither of these are the desired result. Both remove the image Figure # and caption. The hardline break creates an inline image (no figure environment). I need the floating captioned image (figure environment) to not be intersecting the code block. Maybe equivalent to \begin{figure}[!] – bryfry Mar 17 '17 at 14:12
• Oh, please provide a MWE on your question for clarity... Now I know what you mean, and I had a similar problem in the past. I don't think pandoc can fix the figure position right now, but that can easily be programmed with a filter. – lf_araujo Mar 17 '17 at 21:22
• MWE? Minimum Working Example? I'll try to add one to the question. – bryfry Mar 18 '17 at 18:26
• Yes a minimal working example, to improve clarity. – lf_araujo Mar 19 '17 at 4:06