My latest project is about scanning an old book in German Fraktur typeface and putting the scanned page, Tesseract OCR text and English Google translation side-by-side. Humans can then easily correct the robots work.
How can I get precise control over location, size and scaling of mixed images, plots and tables in a PDF document? Banging my head against the wall. I want to display an image next to two tables and scale all three of those objects to fit a landscape pdf page. No matter what I try I can't seem to get the objects to scale AND fill up the page. It seems that the default graphics device size is constraining the output and I can't figure out how to override that. Here is an illustrative reprex (although I've tried many permuations of YAML headers, chunk headers, LaTex code and multipanelfigure
parameters). This code produces a figure that crops the constituent elements and occupies only the upper right quadrant of the page. Thanks for any help.
---
output: pdf_document
classoption: landscape
---
```{r sample, message=FALSE, warning=FALSE, include=FALSE}
library(knitr)
library(grid)
library(gridExtra)
library(magick)
library(multipanelfigure)
one_line <- "Here is some rando text that is 40 lines about 80 columns. See what I did there?"
df <- data.frame(text=rep(one_line,40))
img <- "https://jeroen.github.io/images/frink.png"
# instantiate
figure <- multi_panel_figure(
columns = 4,
rows = 1)
figure <- figure %>%
fill_panel(panel = img,scaling = "stretch",column = c(1,2)) %>%
fill_panel(tableGrob(df, theme = ttheme_default(base_size = 7)),
row= 1,column = 3,panel_clip = "off") %>%
fill_panel(tableGrob(df, theme = ttheme_default(base_size = 7), rows = NULL),
row= 1,column = 4,panel_clip = "off")
figure