dataReporter icon indicating copy to clipboard operation
dataReporter copied to clipboard

Left align tables

Open WillemSleegers opened this issue 2 years ago • 6 comments

Is it possible to left align the tables when exporting the codebook to a PDF?

WillemSleegers avatar May 11 '22 08:05 WillemSleegers

What exactly do you mean, is it the adjustment of the "Result" column in the summary tables under each variable?

Or is it the placement of the tables on the page?

annennenne avatar May 11 '22 09:05 annennenne

My apologies! I meant the placement of the tables on the page.

WillemSleegers avatar May 11 '22 09:05 WillemSleegers

That's a good question. It should definitely be possible, but I don't immediately see a way to do it. If you're familiar with Rmarkdown and Latex, I can give you a few pointers on where in the rmarkdown code this should probably be done?

annennenne avatar May 11 '22 09:05 annennenne

I've checked out the R code and it looks like the pander options are being set in the code itself (without a way to modify it), so I'm not even sure if editing the R Markdown code helps.

WillemSleegers avatar May 11 '22 09:05 WillemSleegers

I don't think the pander options we are setting are causing this. They only control text alignment within the table. They do not control where the table is placed on the page.

If you do

makeCodebook(toydata, render = FALSE, output = "pdf")

you will get the .Rmarkdown file. Here, you can see that we use the minipage setup from Latex in order to place the tables and figures in two columns. I would have thought that adding a \flushleft command to the minipage part with the table would have solved the issue, but apparently it doesn't.

Maybe this is something that can be controlled through rendering options, in which case it could make sense to look into e.g. rmarkdwon::render().

annennenne avatar May 11 '22 09:05 annennenne

Okay, I can take a look. Thanks!

WillemSleegers avatar May 11 '22 13:05 WillemSleegers