In a Tufte layout, I would like a figure to occupy the full width of the page. I have double-checked that my PDF does not have large margins in the image, itself. After searching through many similar questions, I have tried several options including "fig.fullwidth", "flafter" and "knitr::include_graphics", but either the figure goes to the end on a page all by itself (but I can scale it, at least a little) or it goes where "fig.pos=h" places it but then it is followed by a lower margin that takes up most of the page and I cannot scale the image.
In the minimal code example that follows, the image placement is correct, but small and there is a large margin below image. Is there any way to reduce the space around images or force the layout to put an image in a specific place on a specific page?
---
title: "Minimal"
subtitle: "minimal"
author: "me"
date: "`r Sys.Date()`"
header-includes: #allows you to add in your own Latex packages
- \usepackage{float} #use the 'float' package
- \floatplacement{figure}{H} #make every figure with caption = h
output:
tufte::tufte_handout:
extra_dependencies: ["flafter"]
tufte::tufte_html:
output: html_document
tufte::tufte_book:
citation_package: natbib
latex_engine: xelatex
bibliography: Feynman_Tufte/skeleton.bib
link-citations: yes
---
{r setup, include=FALSE}
library(tufte)
# invalidate cache when the tufte version changes
knitr::opts_chunk$set(tidy = FALSE, cache.extra = packageVersion('tufte'))
options(htmltools.dir.version = FALSE)
library(dplyr)
output_dir <- "."
{r setup fig-fullwidth, fig.cap = "A full width figure.", warning=FALSE, message=FALSE, echo=FALSE, cache=FALSE}
knitr::opts_chunk$set(out.extra='',fig.pos= "h")
par(mar=c(1,1,1,1))
knitr::include_graphics(<path to pdf>)