Fixes layout issue where an ad is placed above a figure

Fixes #2811 

I think how we place the inline ads is going to change soon, so this will hopefully be a temporary solution