You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing a book in pdf using bookdown and I'm facing right now a little problem.
I have a figure that fits almost the entire space of the page (B5 format) so when I add the caption to the figure, the caption starts in the same page and it disappears (right picture), it doesn't continue in the next page, and it even exceeds the margin limits. In fact, if I open the rendered PDF with a graphical vector editing software (Inkscape) the full caption is there but outside the page limits (left picture).
I've been reading a bit about how LaTex deals with figures and I guess the problem is that the figure by default is a floating element and LaTex tries to place together the figure and the caption, so my question is:
How can I make the figure not to be a floating element so the caption can be placed on the following page using bookdown?
Thank you so much in advance.
I've prepared a minimal example of this behaviour:
# Hello bookdown
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed a rutrum orci, in malesuada eros. Nunc et dignissim velit. Nunc vel nulla ipsum. Praesent ut velit arcu. Pellentesque in faucibus urna. Nam at iaculis augue, eu sagittis ligula. Nullam leo erat, mollis in ullamcorper at, fringilla id neque. Suspendisse ultricies quam sed aliquet suscipit. Vestibulum ac elementum quam, in finibus turpis. Morbi id mi ipsum.
Cras suscipit velit in dui sagittis faucibus. Mauris euismod et odio a mollis. Suspendisse quis fermentum libero, eu cursus lorem. Suspendisse diam risus, ullamcorper ut tellus sit amet, suscipit maximus arcu. Praesent laoreet fermentum nisl, quis tristique risus commodo a. Mauris aliquet in tellus in faucibus. Pellentesque auctor finibus purus, finibus porta risus volutpat vitae.
Cras suscipit arcu felis, non feugiat arcu commodo in. Aenean porttitor, turpis vel hendrerit placerat, ligula nulla tincidunt dolor, quis euismod libero sem sit amet magna. Morbi convallis eget enim nec maximus. Vestibulum finibus est in elit varius, eget bibendum sapien vehicula. Quisque ornare sit amet neque a interdum. Etiam ut venenatis urna, sit amet ornare elit. In pulvinar facilisis eros non egestas. Cras ac feugiat turpis.
Pellentesque at elit sed nulla malesuada sodales. Phasellus tincidunt tristique dapibus. Morbi vel nunc justo. Phasellus at scelerisque sem. Aliquam dictum maximus ex, eleifend blandit tortor cursus a. Duis pellentesque tincidunt finibus. Aliquam pharetra lorem volutpat velit gravida accumsan. Sed facilisis aliquam pretium. Quisque tincidunt, diam vel blandit vestibulum, urna ipsum ornare felis, eget ullamcorper magna odio at velit. Donec quis porta nisi.
Phasellus fringilla enim ac eros suscipit, nec euismod augue luctus. Quisque eget consectetur turpis. Curabitur tempor suscipit tristique. Vestibulum rutrum, libero ut molestie pellentesque, odio ante feugiat mi, ac hendrerit risus erat at dolor. Donec faucibus blandit purus, vitae accumsan metus accumsan sed. Fusce faucibus ornare ex in gravida. Ut.
```{r figure, echo=FALSE, fig.align="center", out.width='\\textwidth', fig.cap="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed a rutrum orci, in malesuada eros. Nunc et dignissim velit. Nunc vel nulla ipsum. Praesent ut velit arcu. Pellentesque in faucibus urna. Nam at iaculis augue, eu sagittis ligula. Nullam leo erat, mollis in ullamcorper at, fringilla id neque. Suspendisse ultricies quam sed aliquet suscipit. Vestibulum ac elementum quam, in finibus turpis. Morbi id mi ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed a rutrum orci, in malesuada eros. Nunc et dignissim velit. Nunc vel nulla ipsum. Praesent ut velit arcu. Pellentesque in faucibus urna. Nam at iaculis augue, eu sagittis ligula. Nullam leo erat, mollis in ullamcorper at, fringilla id neque. Suspendisse ultricies quam sed aliquet suscipit. Vestibulum ac elementum quam, in finibus turpis. Morbi id mi ipsum."}
download.file(url = "https://images.unsplash.com/photo-1563204996-8965f0a4a860?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&i",
destfile = "image.jpeg",
mode = 'wb')
knitr::include_graphics(path = "image.jpeg")
This seems to be LaTeX problem, and you may have more success for answers at LaTeX forums.
You have a big figures with a long caption, so LaTeX needs to know how to handle that. This is definitely not standard for bookdown nor pandoc.
I'm writing a book in pdf using bookdown and I'm facing right now a little problem.
I have a figure that fits almost the entire space of the page (B5 format) so when I add the caption to the figure, the caption starts in the same page and it disappears (right picture), it doesn't continue in the next page, and it even exceeds the margin limits. In fact, if I open the rendered PDF with a graphical vector editing software (Inkscape) the full caption is there but outside the page limits (left picture).
I've been reading a bit about how LaTex deals with figures and I guess the problem is that the figure by default is a floating element and LaTex tries to place together the figure and the caption, so my question is:
How can I make the figure not to be a floating element so the caption can be placed on the following page using bookdown?
Thank you so much in advance.
I've prepared a minimal example of this behaviour:
Index.rmd file
01-intro.rmd file
The text was updated successfully, but these errors were encountered: