ekstroem / dataReporter

85 stars 4 forks source link

Left align tables #6

Open WillemSleegers opened 2 years ago

WillemSleegers commented 2 years ago

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

annennenne commented 2 years ago

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?

WillemSleegers commented 2 years ago

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

annennenne commented 2 years ago

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?

WillemSleegers commented 2 years ago

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.

annennenne commented 2 years ago

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().

WillemSleegers commented 2 years ago

Okay, I can take a look. Thanks!