ulyngs / oxforddown

Template for writing an Oxford University thesis in R Markdown; uses the OxThesis LaTeX template and was inspired by thesisdown.
https://ulyngs.github.io/oxforddown/
MIT License
220 stars 81 forks source link

Double spacing when a figure is mapped exactly at the location where the code snippet is #60

Closed maltehueckstaedt closed 1 year ago

maltehueckstaedt commented 1 year ago

Hi,

when I want to place an figure where the corresponding code snippet is located in the source code, it causes a double spacing in the text above it (see screenshot, top page). Any ideas on how I can prevent this?

Here is my chunk:

```{r hypcohe, echo=FALSE,  out.width="90%", fig.align = 'center', fig.pos="H", fig.cap="title"}
knitr::include_graphics("figures/04_promoting_problems/Hyp_Cohasion_Prob.pdf")```
Bildschirmfoto 2022-07-29 um 09 41 31
ulyngs commented 1 year ago

Can you provide a bit more context:

maltehueckstaedt commented 1 year ago

Hello @ulyngs , thank you for your answer!

  • Is there a double spacing on the entire page before it? Or just a few lines / the entire preceding paragraph / etc?

on the entire page before the illustration

  • if you have a look at docs/main.tex, do you see any hints in the LaTeX as to why this might be occuring?

no, unfortunately not at all

  • if you reduce the amount of content before the figure, does that have an effect, or is there always double spacing applied to a previous paragraph when you hold a figure in place?

This indeed causes the double spacing to disappear

What conclusion can be drawn from this?

ulyngs commented 1 year ago

the conclusion probably is that this does not have anything to do with oxforddown per se, but with how LaTeX tries to do type setting and minimise empty space etc. Try googling solutions to this in the LaTeX community.

A super simple solution you can try is to just manually add a pagebreak before the figure, with \pagebreak