2020年12月19日星期六

Setting the caption position of huxtable when knitted into a RMD Word Docx

While trying to knit an RMD file containing Huxtable into a Word Docx, the Huxtable caption was not getting positioned in the word document. Whereas, while running the chunk, the position was aligned as per the caption position. Therefore, can there be a way where the caption of Huxtable is set as per requirement while knitting into a word doc?. If the changes are to be done in the Word Styles, kindly let me know where it can be done,

PS: Only Huxtable is to be followed, no other tables. Sorry. :P

title: "huxtable_cap_reprex"  output:    word_document: default  
knitr::opts_chunk$set(echo = TRUE)  library(tidyverse)  library(huxtable)  
  jams <- hux(    Type  = c("Strawberry", "Raspberry", "Plum"),    Price = c(1.90, 2.10, 1.80)  )    jams %>%     set_all_padding(4) %>%     set_outer_padding(0) %>%     set_number_format(2) %>%     set_bold(1, everywhere) %>%     set_bottom_border(1, everywhere) %>%     set_width(0.4) %>%     set_caption("Pots of jam for sale") -> j    caption_pos(j) <-"bottom"   j      

When only the chunk is run, the output looks like this(This is correct, since the caption is at the bottom):

enter image description here

After Knitting the RMD into word, you can see that table caption position has changed. It should have been at the bottom. enter image description here

Thanks in Advance!

https://stackoverflow.com/questions/65373281/setting-the-caption-position-of-huxtable-when-knitted-into-a-rmd-word-docx December 20, 2020 at 02:46AM

没有评论:

发表评论