A few suggestions
haozhu233 opened this issue · 7 comments
Hi, @yonicd,
Thanks again for this awesome package! Here are a few suggestions that I came up with when I was using this package. They are just my personal opinions in my special use cases. :)
-
The
stem
option: When I was trying to usetexPreview
for the first time, I didn't expect I need to provide astem
option to get it work. It makes sense to provide that when users want to save. However, if users only want to preview quickly, I guess you can just give it a random name internally or just use the time. -
margin_right: When I was trying to save a table to image, I did spent a while wondering why there is a large white space on the right side, before I found out the default setting for margin is
margin=list(left=10, top=5, right=50, bottom=5)
. I guess it helps improve the looks in the viewer but not so much when my only purpose is to save the image. -
latex packages: It is a little difficult to understand how to use
buildUsepackage
to load extra latex packages to the tex file. Also, I feel like it should be users' responsibility to make sure the packages they asked to include is in their computer. ;) -
I do hope there could be an option to change the default density because it's a little too low for me.
I hope you find these suggestions being useful. :)
thank you for the comments.
-
you are right, that can be defaulted (it has to have a name for the book keeping behind the scenes).
-
I never had that problem with extra padding in my testing (we use it to save most of the time), if you can give an example that would be great.
-
mapply is a bit heavy to use, i'll give that another stab (i wanted to keep the input as base r)
-
i can open up density as a param.
got it, dont know why it was set to 50. 10 should be more than enough (anyways it has svgpanzoom now in viewer by default so the padding doesnt matter)
btw why didnt you opt to have texPreview as a depends in kable in the end? (not a pressure to do it, just wondering for future pkg making to make them easier to have ppl dep on them).
it would be
pkgs <- c('preview',
'xcolor',
'varwidth',
'amssymb',
'ifxetex',
'ifluatex',
'fixltx2e',
'polyglossia',
'booktabs',
'longtable',
'array',
'wrapfig',
'colortbl',
'mathspec',
'xltxtra',
'xunicode'
)
opts <- rep(list(NULL), length(pkgs))
opts[[1]] <- c('active','tightpage')
opts[[2]] <- c('table')
texPkgs <- unlist(mapply(texPreview::buildUsepackage,
pkg = pkgs,
options= opts
))
texPreview(enc2utf8(as.character(kable_input)),
stem=paste0("table_", format(Sys.time(), "%Y-%m-%d_%H:%M:%S")),
engine='xelatex',
usrPackages=texPkgs)
Also, when the fileDir
is specified, it would be nice to do some auto clean ups for those latex log files. You may also set an option there and leave the decision to the users.
sure, that can be added as an option.
Closing this issue as we are collaborating.