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

Bolded columns are misaligned in print_screen #201

Closed karol27 closed 3 years ago

karol27 commented 3 years ago

Describe the bug When column names are bold then column width with names is another than other rows.

Minimal Reproducible Example

library(tidyverse)
df = data.frame(
  stringsAsFactors = FALSE,
              Type = c("a", "b", "c", "d"),
                 AAAAAAAAAAAAAA = c(51, 5, 10, 155.5),
                 BBBBBBBBBBBBBB = c(40.1, 50.5, 127.8, 216),
                 CCCCCCCCCCCCCC = c(40, 45, 50, 255)
     )
library(huxtable)
ht = as_hux(df)
ht = ht %>% 
  theme_basic() %>%
  set_all_borders()
ht

table

Expected behavior Vertical lines of borders are in the same line for row with names and values

System details huxtable_5.3.0 R version 4.0.5 /i386 R Studio 1.4.1106

karol27 commented 3 years ago

Table in R has this problem but in markdown is OK

hughjonesd commented 3 years ago

I can't reproduce on my machine. Weird... what's your options("width")?

> ht
          ┌──────┬────────────────┬────────────────┬────────────────┐
          │ Type │ AAAAAAAAAAAAAA │ BBBBBBBBBBBBBB │ CCCCCCCCCCCCCC │
          ├──────┼────────────────┼────────────────┼────────────────┤
          │ a    │             51 │           40.1 │             40 │
          ├──────┼────────────────┼────────────────┼────────────────┤
          │ b    │              5 │           50.5 │             45 │
          ├──────┼────────────────┼────────────────┼────────────────┤
          │ c    │             10 │          128   │             50 │
          ├──────┼────────────────┼────────────────┼────────────────┤
          │ d    │            156 │          216   │            255 │
          └──────┴────────────────┴────────────────┴────────────────┘

Column names: Type, AAAAAAAAAAAAAA, BBBBBBBBBBBBBB, CCCCCCCCCCCCCC
hughjonesd commented 3 years ago

I think this may be an effect of your terminal font. Can you try a fixed width font in Rstudio and see what happens?

karol27 commented 3 years ago

I see that in your tabel above row with column names is not bold. Try to make it bold. The problem is only when font is bold.

options("width") $width [1] 209

hughjonesd commented 3 years ago

It was using your code which indeed makes the title bold. Just that the bold doesn't display when copy-pasted. Have you tried with a fixed-width font?

hughjonesd commented 3 years ago

Feel free to reopen if you think this is still a problem.