Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error to present two plots in one panel with word_document2 #249

Closed
sammo3182 opened this issue Nov 22, 2016 · 6 comments
Closed

Error to present two plots in one panel with word_document2 #249

sammo3182 opened this issue Nov 22, 2016 · 6 comments
Milestone

Comments

@sammo3182
Copy link

sammo3182 commented Nov 22, 2016

I tried to present two plots in one panel using the bookdown::word_document2. The specification are as following:

---
output: bookdown::word_document2
---

```{r fig.cap='A figure example with the specified aspect ratio, width, and alignment.', fig.show="hold"}
plot(pressure, pch = 19, type = 'b')
plot(pressure$temperature)
```

The codes produce the following error of label once I specified fig.show="hold". The same codes work fine in pdf_document2 or without the arugment fig.show="hold".

Error in parse_fig_labels(x, global) : 
  There are multiple labels on one line: (#fig:unnamed-chunk-1), (#fig:unnamed-chunk-1)
Calls: <Anonymous> ... <Anonymous> -> process_markdown -> parse_fig_labels
Execution halted

I'm using the developed version of bookdown (0.2.4).

@yihui yihui added this to the v0.3 milestone Nov 22, 2016
@yihui
Copy link
Member

yihui commented Nov 22, 2016

fig.show='hold' does not really work for Word output. I just added a warning in the development version of knitr.

@sammo3182
Copy link
Author

Thank you for the reply. It could be more convenient, though if the compiling of bookdown::word_document2 can just ignore the fig.show option as the word_document does even if the function cannot be correctly transferred to MS Word. In that case, users do not need to change the codes in the content but the header to successfully compile the codes and use the cross-reference function of markdown.

@yihui
Copy link
Member

yihui commented Nov 23, 2016

That is exactly what I did in the development version of knitr.

@sammo3182
Copy link
Author

sammo3182 commented Nov 23, 2016

Great! Thank you for keeping improving these valuable packages!!
Just tried the developing version of knitr. The multiple labels on one line still appears, though, when the fig.show is involved.

@yihui
Copy link
Member

yihui commented May 10, 2019

The error has been fixed (see #538).

@github-actions
Copy link

github-actions bot commented Nov 6, 2020

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants