hughjonesd / huxtable

An R package to create styled tables in multiple output formats, with a friendly, modern interface.
http://hughjonesd.github.io/huxtable
Other
321 stars 28 forks source link

pdf issues #6

Closed helophilus closed 7 years ago

helophilus commented 7 years ago

Hi. Thanks for the package. I have one or two issues attempting to make a pdf document using R markdown.

I find with wider tables, they are not positioned centrally despite being 'told to'. And the thickness of border lines isn't affected by the value .


title: "Example" output: pdf_document

knitr::opts_chunk$set(echo = TRUE)
library(huxtable)
options(huxtable.print=print_latex)

Example

Example of a table.

But i) isn't positioned in the centre of the page and, ii) horizontal borders are all reproduced with the same thickness.

ht <- hux(
Employee = c('John Smith', 'Jane Doe', 'David Hugh-Jones'),
Salary = c(50000, 50000, 40000),
Age = c(42, 57, 29),
Sex = c('Male','Female','Male'),
HouseNo = c(132,87,56),
Present = c("Yes","Yes","No"),
add_colnames = TRUE
)
position(ht) = "center"
top_border(ht)[1,]=5
bottom_border(ht)[1,]=1
bottom_border(ht)[4,]=3
ht

Are these just r markdown issues that I have to live with, or might there be a fix? Thanks.

hughjonesd commented 7 years ago

The thickness issue you have to live with (see the "design principles" vignette; I'll mention this in the docs for ?xxx_border). The position issue is more subtle. One issue is that your table is wider than the default of 0.5. If you set width(ht) = 0.75, you get a more acceptable outcome.

David

helophilus commented 7 years ago

Thanks for replying so quickly, and the tip for centering.

Colin

On 27/04/17 19:41, David Hugh-Jones wrote:

The thickness issue you have to live with (see the "design principles" vignette; I'll mention this in the docs for ?xxx_border). The position issue is more subtle. One issue is that your table is wider than the default of 0.5. If you set width(ht) = 0.75, you get a more acceptable outcome.

David

On 27 April 2017 at 19:07, helophilus notifications@github.com wrote:

Hi. Thanks for the package. I have one or two issues attempting to make a pdf document using R markdown.

I find with wider tables, they are not positioned centrally despite being 'told to'. And the thickness of border lines isn't affected by the value .

title: "Example" output: pdf_document

knitr::opts_chunk$set(echo = TRUE) library(huxtable) options(huxtable.print=print_latex)

Example

Example of a table.

But i) isn't positioned in the centre of the page and, ii) horizontal borders are all reproduced with the same thickness.

ht <- hux( Employee = c('John Smith', 'Jane Doe', 'David Hugh-Jones'), Salary = c(50000, 50000, 40000), Age = c(42, 57, 29), Sex = c('Male','Female','Male'), HouseNo = c(132,87,56), Present = c("Yes","Yes","No"), add_colnames = TRUE ) position(ht) = "center" top_border(ht)[1,]=5 bottom_border(ht)[1,]=1 bottom_border(ht)[4,]=3 ht

Are these just r markdown issues that I have to live with, or might there be a fix? Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hughjonesd/huxtable/issues/6, or mute the thread

https://github.com/notifications/unsubscribe-auth/AFjJ92uVhMZexsYDVI9eSIr__XqungP3ks5r0NlwgaJpZM4NKkq7 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hughjonesd/huxtable/issues/6#issuecomment-297803239, or mute the thread https://github.com/notifications/unsubscribe-auth/Aaz2OCPoycxdfyOuj9sWVHFtKd6_tDSuks5r0OFwgaJpZM4NKkq7.