Skip to content

word_document2 "multiple labels on one line" error #538

@mdlincoln

Description

@mdlincoln

I'm encountering an error when trying to render a word_document2 with more than one figure in a single chunk. Both #249 and #483 suggested this issue had been fixed, and should just result in a warning, but I'm getting it with the latest version of bookdown right now.

Sample document:

```{r figs, fig.cap = "Figure caption.", fig.show = "hold"}
plot(iris)
plot(mtcars)
```

Building with bookdown::pdf_document2 works fine. However, I get the following error if trying to use word_document2:

> bookdown::render_book("figures.Rmd", "bookdown::word_document2")


processing file: _main.Rmd
  |......................                                           |  33%
  ordinary text without R code

  |...........................................                      |  67%
label: figs (with options) 
List of 2
 $ fig.cap : chr "Figure caption."
 $ fig.show: chr "hold"

  |.................................................................| 100%
  ordinary text without R code


output file: _main.knit.md

Error in parse_fig_labels(x, global) : 
  There are multiple labels on one line: (#fig:figs), (#fig:figs)
In addition: Warning messages:
1: In (knit_hooks$get("plot"))(file, reduce_plot_opts(options)) :
  The chunk option fig.show="hold" is not supported for Word output
2: In (knit_hooks$get("plot"))(file, reduce_plot_opts(options)) :
 
 Show Traceback
 
 Rerun with Debug
 Error in parse_fig_labels(x, global) : 
  There are multiple labels on one line: (#fig:figs), (#fig:figs) Please delete _main.Rmd after you finish debugging the error.

While I expected the warning about fig.show="hold" for Word, I did not expect the error.

Details
Session info -----------------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.4.2 (2017-09-28)
 system   x86_64, darwin15.6.0        
 ui       RStudio (1.1.383)           
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       America/Los_Angeles         
 date     2018-02-25                  

Packages ---------------------------------------------------------------------------------------------------------------------------------
 package   * version date       source                            
 backports   1.1.2   2017-12-13 CRAN (R 3.4.3)                    
 base64enc   0.1-3   2015-07-28 CRAN (R 3.4.0)                    
 bookdown    0.7.1   2018-02-25 Github (rstudio/bookdown@06bd619) 
 digest      0.6.15  2018-01-28 CRAN (R 3.4.3)                    
 evaluate    0.10.1  2017-06-24 CRAN (R 3.4.1)                    
 glue        1.2.0   2017-10-29 cran (@1.2.0)                     
 graphics  * 3.4.2   2017-10-04 local                             
 grDevices * 3.4.2   2017-10-04 local                             
 highr       0.6     2016-05-09 CRAN (R 3.4.0)                    
 htmltools   0.3.6   2017-04-28 CRAN (R 3.4.0)                    
 jsonlite    1.5     2017-06-01 CRAN (R 3.4.0)                    
 knitr     * 1.20    2018-02-20 CRAN (R 3.4.3)                    
 magrittr    1.5     2014-11-22 CRAN (R 3.4.0)                    
 markdown    0.8     2017-04-20 CRAN (R 3.4.0)                    
 methods   * 3.4.2   2017-10-04 local                             
 mime        0.5     2016-07-07 CRAN (R 3.4.0)                    
 Rcpp        0.12.15 2018-01-20 CRAN (R 3.4.3)                    
 rmarkdown   1.8.10  2018-02-25 Github (rstudio/rmarkdown@1ccf6a0)
 rprojroot   1.3-2   2018-01-03 CRAN (R 3.4.2)                    
 stats     * 3.4.2   2017-10-04 local                             
 stringi     1.1.6   2017-11-17 CRAN (R 3.4.2)                    
 stringr     1.3.0   2018-02-19 CRAN (R 3.4.3)                    
 tinytex     0.3     2018-01-22 CRAN (R 3.4.3)                    
 tools       3.4.2   2017-10-04 local                             
 utils     * 3.4.2   2017-10-04 local                             
 xfun        0.1     2018-01-22 CRAN (R 3.4.3)                    
 yaml        2.1.16  2017-12-12 CRAN (R 3.4.2)                    
> rmarkdown::pandoc_version()
[1] ‘2.1.1’
> system('pdflatex --version')
pdfTeX 3.14159265-2.6-1.40.18 (TeX Live 2017)
kpathsea version 6.2.3
Copyright 2017 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.29; using libpng 1.6.29
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 3.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions