Bioconductor / BiocStyle

Issues and pull requests for BiocStyle should go here.
12 stars 19 forks source link

Width of code boxes is smaller in html_document2, figures not the same size as html_document by default #17

Open lcolladotor opened 7 years ago

lcolladotor commented 7 years ago

Hi,

I just started using the new html_document2 style and noticed a couple of things. The figures are smaller than in BiocStyle::html_document and rmarkdown::html_document. I see at https://github.com/Bioconductor/BiocStyle/issues/9 how to address this, but it'd be nice if the default size was the same (or about the same) as BiocStyle::html_document.

Similarly, the width of the code boxes are smaller, so code that is less than 80 characters long that used to fit in one line now gets split into two.

It's also missing some of the nice things from BiocStyle::html_document such as the colors (I loved the green/blue colors!). I don't really use tables like reported in https://github.com/Bioconductor/BiocStyle/issues/13 but the issue might be related.

In any case, I do like how html_document2 was written so it's very similar to rmardown::html_document and can work with the new stuff the rmarkdown folks keep adding.

Edit: messed up something here, will post it below.

Best, Leo

lcolladotor commented 7 years ago

Ok, now I fixed my comparison:

As a quick way to compare things, http://bioconductor.org/packages/release/bioc/vignettes/recount/inst/doc/recount-quickstart.html uses BiocStyle::html_document (in Bioc 3.4) and I made it so http://bioconductor.org/packages/devel/bioc/vignettes/recount/inst/doc/recount-quickstart.html will use BiocStyle::html_document2 (in Bioc 3.5). Since the new version hasn't been rendered yet, here are some screenshots.

screen shot 2016-11-02 at 2 45 20 pm

screen shot 2016-11-02 at 2 45 33 pm

screen shot 2016-11-02 at 2 45 46 pm

lcolladotor commented 7 years ago

http://www.bioconductor.org/packages/devel/bioc/vignettes/recount/inst/doc/recount-quickstart.html is now live with BiocStyle::html_document2() and can be easily be compared with the release version that uses BiocStyle::html_document()

lcolladotor commented 7 years ago

Regarding the width, is it just about making https://github.com/Bioconductor/BiocStyle/blob/2b9a7273aacff87c6d44058fde58c5e39402e010/R/html_document2.R#L120 larger than 768 px?

aoles commented 7 years ago

Dear Leo, thank you for your feedback on BiocStyle::html_document2(). The overall design goal of the new style was to match the appearance of HTML and PDF formats, including paragraph line length. The column width of BiocStyle::pdf_document2() is virtually the same as the LaTeX default, which corresponds to around 75 characters per line (10pt font-size) and is considered as "good typography". Note that the line width of monospaced font used to typeset code chunks is actually smaller (70 characters) because of the intrinsic properties of a fixed-width font. However, this is already an improvement over Sweave/knitr defaults, where the code line width is 66; this was possible by using a different, slightly narrower and scaled monospaced font.

Now back to BiocStyle::html_document2(). I did some tweaks in https://github.com/Bioconductor/BiocStyle/commit/2b9a7273aacff87c6d44058fde58c5e39402e010 to increase the line width a little bit, and better match the BiocStyle::pdf_document2() look. Please let me know whether these settings work better for you. I will continue looking into possible solutions to better accommodate wide code chunks.

Cheers, Andrzej

lcolladotor commented 7 years ago

Thanks for the reply Andrzej!

Regarding the number of characters, I said 80 because that's what BiocCheck checks for.

I haven't looked yet at how version 2.3.6 looks like (https://github.com/Bioconductor/BiocStyle/commit/2b9a7273aacff87c6d44058fde58c5e39402e010) but with BiocStyle 2.3.3 weird things like this happen:

screen shot 2016-11-07 at 9 44 42 am

In this case, the character vector 'chrY' gets split into two lines (visually), which might be quite confusing for users. I'm not sure that the changes you introduced will help with cases like that when the code chunk is wider than the width you have specified (whether it's 66, 75, 80 or another number).

Best, Leo

aoles commented 7 years ago

Hi Leo, the wrapping is performed only when the content of the source code chunk exceeds the box width. Another strategy would be to let the box scroll horizontally. Clearly, neither solution is perfect. Nevertheless, this is still better compared to the overflowing lines in LaTeX - you can check it for yourself by switching the output format to BiocStyle::pdf_document2.

Proper formatting of source code chunks is typically at the author's discretion. However, this can be automatized by including at the beginning of your document a code chunk setting the following knitr option.

```{r knitr_tidy, include=FALSE}
knitr::opts_chunk$set(tidy = TRUE)


This option is not set by default because it will re-format all code, which might be undesirable.

Cheers,
Andrzej
lcolladotor commented 7 years ago

Hi,

If I add the code chunk about setting tidy = TRUE and run R CMD build recount with BiocStyle 2.3.6, I still get code lines that get soft wrapped with BiocStyle::html_document2 as shown below:

screen shot 2016-11-07 at 2 59 53 pm

I can see the overflowing in BiocStyle::pdf_document2 like you mentioned in both long code lines and long output lines (also with tidy = TRUE):

screen shot 2016-11-07 at 3 11 59 pm

screen shot 2016-11-07 at 3 12 10 pm

I think that trying to make the PDF and HTML documents look very similar is a hard problem. In any case, I think that letting the scroll box horizontally (like in BiocStyle::html_document) is an advantage in favor of HTML vignettes over PDF vignettes. Which is why I would definitely prefer if BiocStyle::html_document2 also allowed scrolling boxes like BiocStyle::html_document.

Finally, regarding the number of characters per line, I'll just expand my previous point a bit. With BiocCheck checking for 80 character lines, I set my text editor to show me a line at 80 characters and is what I use when writing code to make sure that it'll be ok. I would prefer if the number of characters was consistent across the board. Maybe you want to make the case that BiocCheck should change to 66 character lines. In any case, from my earlier tests it doesn't look like setting tidy = TRUE does the job.

Session Info

## Session info -----------------------------------------------------------------------------------------------------------
##  setting  value                                      
##  version  R version 3.3.1 Patched (2016-10-18 r71535)
##  system   x86_64, darwin13.4.0                       
##  ui       X11                                        
##  language (EN)                                       
##  collate  C                                          
##  tz       America/New_York                           
##  date     2016-11-07
## Packages ---------------------------------------------------------------------------------------------------------------
##  package                * version  date       source                                   
##  AnnotationDbi          * 1.36.0   2016-10-18 Bioconductor                             
##  AnnotationHub            2.6.0    2016-10-18 Bioconductor                             
##  BSgenome                 1.42.0   2016-10-18 Bioconductor                             
##  Biobase                * 2.34.0   2016-10-18 Bioconductor                             
##  BiocGenerics           * 0.20.0   2016-10-18 Bioconductor                             
##  BiocInstaller            1.24.0   2016-10-18 Bioconductor                             
##  BiocParallel             1.8.1    2016-10-30 Bioconductor                             
##  BiocStyle              * 2.3.6    2016-11-07 Github (Bioconductor/BiocStyle@2b9a727)  
##  Biostrings               2.42.0   2016-10-18 Bioconductor                             
##  DBI                      0.5-1    2016-09-10 cran (@0.5-1)                            
##  DEFormats                1.2.0    2016-10-18 Bioconductor                             
##  DESeq2                 * 1.14.0   2016-10-18 Bioconductor                             
##  DT                     * 0.2      2016-08-09 CRAN (R 3.3.0)                           
##  EnsDb.Hsapiens.v79     * 1.1.0    2016-11-01 Bioconductor                             
##  Formula                  1.2-1    2015-04-07 CRAN (R 3.3.0)                           
##  GEOquery                 2.40.0   2016-10-18 Bioconductor                             
##  GenomeInfoDb           * 1.10.1   2016-11-04 Bioconductor                             
##  GenomicAlignments        1.10.0   2016-10-18 Bioconductor                             
##  GenomicFeatures        * 1.26.0   2016-10-18 Bioconductor                             
##  GenomicFiles             1.10.3   2016-10-21 Bioconductor                             
##  GenomicRanges          * 1.26.1   2016-10-20 Bioconductor                             
##  Hmisc                    4.0-0    2016-11-01 CRAN (R 3.3.0)                           
##  IRanges                * 2.8.0    2016-10-18 Bioconductor                             
##  Matrix                   1.2-7.1  2016-09-01 CRAN (R 3.3.1)                           
##  R6                       2.2.0    2016-10-05 CRAN (R 3.3.0)                           
##  RColorBrewer           * 1.1-2    2014-12-07 cran (@1.1-2)                            
##  RCurl                    1.95-4.8 2016-03-01 cran (@1.95-4.)                          
##  RJSONIO                  1.3-0    2014-07-28 cran (@1.3-0)                            
##  RSQLite                  1.0.0    2014-10-25 CRAN (R 3.3.0)                           
##  Rcpp                     0.12.7   2016-09-05 cran (@0.12.7)                           
##  RefManageR               0.11.0   2016-09-11 CRAN (R 3.3.0)                           
##  Rsamtools                1.26.1   2016-10-22 Bioconductor                             
##  S4Vectors              * 0.12.0   2016-10-18 Bioconductor                             
##  SummarizedExperiment   * 1.4.0    2016-10-18 Bioconductor                             
##  VariantAnnotation        1.20.0   2016-10-18 Bioconductor                             
##  XML                      3.98-1.4 2016-03-01 CRAN (R 3.3.0)                           
##  XVector                  0.14.0   2016-10-18 Bioconductor                             
##  acepack                  1.4.1    2016-10-29 CRAN (R 3.3.0)                           
##  annotate                 1.52.0   2016-10-18 Bioconductor                             
##  assertthat               0.1      2013-12-06 cran (@0.1)                              
##  backports                1.0.4    2016-10-24 CRAN (R 3.3.0)                           
##  bibtex                   0.4.0    2014-12-31 CRAN (R 3.3.0)                           
##  biomaRt                  2.30.0   2016-10-18 Bioconductor                             
##  bitops                   1.0-6    2013-08-17 cran (@1.0-6)                            
##  bumphunter               1.14.0   2016-10-18 Bioconductor                             
##  checkmate                1.8.2    2016-11-02 CRAN (R 3.3.1)                           
##  chron                    2.3-47   2015-06-24 CRAN (R 3.3.0)                           
##  cluster                  2.0.5    2016-10-08 CRAN (R 3.3.1)                           
##  codetools                0.2-15   2016-10-05 CRAN (R 3.3.1)                           
##  colorspace               1.2-7    2016-10-11 cran (@1.2-7)                            
##  data.table               1.9.6    2015-09-19 CRAN (R 3.3.0)                           
##  derfinder                1.9.1    2016-11-02 Bioconductor                             
##  derfinderHelper          1.9.1    2016-11-02 Bioconductor                             
##  devtools               * 1.12.0   2016-06-24 CRAN (R 3.3.0)                           
##  digest                   0.6.10   2016-08-02 CRAN (R 3.3.0)                           
##  doRNG                    1.6      2014-03-07 CRAN (R 3.3.0)                           
##  downloader               0.4      2015-07-09 CRAN (R 3.3.0)                           
##  edgeR                    3.16.1   2016-10-26 Bioconductor                             
##  ensembldb              * 1.6.0    2016-10-18 Bioconductor                             
##  evaluate                 0.10     2016-10-11 cran (@0.10)                             
##  foreach                  1.4.3    2015-10-13 CRAN (R 3.3.0)                           
##  foreign                  0.8-67   2016-09-13 CRAN (R 3.3.1)                           
##  formatR                  1.4      2016-05-09 cran (@1.4)                              
##  genefilter               1.56.0   2016-10-18 Bioconductor                             
##  geneplotter              1.52.0   2016-10-18 Bioconductor                             
##  ggplot2                * 2.1.0    2016-03-01 CRAN (R 3.3.0)                           
##  gridExtra                2.2.1    2016-02-29 CRAN (R 3.3.0)                           
##  gtable                   0.2.0    2016-02-26 CRAN (R 3.3.0)                           
##  highr                    0.6      2016-05-09 cran (@0.6)                              
##  htmlTable                1.7      2016-10-19 CRAN (R 3.3.0)                           
##  htmltools                0.3.5    2016-03-21 cran (@0.3.5)                            
##  htmlwidgets              0.7      2016-08-02 CRAN (R 3.3.0)                           
##  httpuv                   1.3.3    2015-08-04 CRAN (R 3.3.0)                           
##  httr                     1.2.1    2016-07-03 CRAN (R 3.3.0)                           
##  interactiveDisplayBase   1.12.0   2016-10-18 Bioconductor                             
##  iterators                1.0.8    2015-10-13 CRAN (R 3.3.0)                           
##  jsonlite                 1.1      2016-09-14 CRAN (R 3.3.0)                           
##  knitcitations          * 1.0.7    2015-10-28 CRAN (R 3.3.0)                           
##  knitr                  * 1.14     2016-08-13 cran (@1.14)                             
##  knitrBootstrap           1.0.0    2016-10-19 Github (jimhester/knitrBootstrap@cdaa4a9)
##  labeling                 0.3      2014-08-23 cran (@0.3)                              
##  lattice                  0.20-34  2016-09-06 CRAN (R 3.3.1)                           
##  latticeExtra             0.6-28   2016-02-09 CRAN (R 3.3.0)                           
##  limma                    3.30.2   2016-10-28 Bioconductor                             
##  locfit                   1.5-9.1  2013-04-20 CRAN (R 3.3.0)                           
##  lubridate                1.6.0    2016-09-13 CRAN (R 3.3.0)                           
##  magrittr                 1.5      2014-11-22 cran (@1.5)                              
##  markdown                 0.7.7    2015-04-22 cran (@0.7.7)                            
##  matrixStats              0.51.0   2016-10-09 CRAN (R 3.3.0)                           
##  memoise                  1.0.0    2016-01-29 CRAN (R 3.3.0)                           
##  mime                     0.5      2016-07-07 CRAN (R 3.3.0)                           
##  munsell                  0.4.3    2016-02-13 cran (@0.4.3)                            
##  nnet                     7.3-12   2016-02-02 CRAN (R 3.3.1)                           
##  org.Hs.eg.db           * 3.4.0    2016-10-19 Bioconductor                             
##  pheatmap               * 1.0.8    2015-12-11 CRAN (R 3.3.0)                           
##  pkgmaker                 0.22     2014-05-14 CRAN (R 3.3.0)                           
##  plyr                     1.8.4    2016-06-08 cran (@1.8.4)                            
##  qvalue                   2.6.0    2016-10-18 Bioconductor                             
##  recount                * 1.1.3    2016-11-07 Bioconductor                             
##  regionReport           * 1.9.1    2016-11-02 Bioconductor                             
##  registry                 0.3      2015-07-08 CRAN (R 3.3.0)                           
##  rentrez                  1.0.4    2016-10-26 CRAN (R 3.3.0)                           
##  reshape2                 1.4.2    2016-10-22 CRAN (R 3.3.0)                           
##  rmarkdown                1.1      2016-10-16 cran (@1.1)                              
##  rngtools                 1.2.4    2014-03-06 CRAN (R 3.3.0)                           
##  rpart                    4.1-10   2015-06-29 CRAN (R 3.3.1)                           
##  rstudioapi               0.6      2016-06-27 CRAN (R 3.3.0)                           
##  rtracklayer              1.34.1   2016-11-02 Bioconductor                             
##  scales                   0.4.0    2016-02-26 cran (@0.4.0)                            
##  shiny                    0.14.2   2016-11-01 CRAN (R 3.3.0)                           
##  stringi                  1.1.2    2016-10-01 cran (@1.1.2)                            
##  stringr                  1.1.0    2016-08-19 cran (@1.1.0)                            
##  survival                 2.40-1   2016-10-30 CRAN (R 3.3.0)                           
##  tibble                   1.2      2016-08-26 cran (@1.2)                              
##  withr                    1.0.2    2016-06-20 CRAN (R 3.3.0)                           
##  xtable                   1.8-2    2016-02-05 CRAN (R 3.3.0)                           
##  yaml                     2.1.13   2014-06-12 cran (@2.1.13)                           
##  zlibbioc                 1.20.0   2016-10-18 Bioconductor