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

Support fig.show='hold' for office output #1755

Closed
3 tasks done
atusy opened this issue Sep 4, 2019 · 2 comments
Closed
3 tasks done

Support fig.show='hold' for office output #1755

atusy opened this issue Sep 4, 2019 · 2 comments
Assignees
Milestone

Comments

@atusy
Copy link
Collaborator

atusy commented Sep 4, 2019

When output is office formats (e.g., docx) and fig.show='hold', then knitr coerces fig.show='asis' with warning.
This is introduced by f6e3b62#diff-4910cdfe600c3874a655c6951e12daa0 to fix rstudio/bookdown#249 and is expanded by 575e18e#diff-4910cdfe600c3874a655c6951e12daa0 .

However, regardless of the coercion, fig.show='hold' seems working.
In addition, removing the coercion still works.
I do not face error reported by rstudio/bookdown#249

Although I don't know what made things possible, can we remove the relevant lines?
If not, I think we should also add the treatment here: https://github.com/yihui/knitr/blob/master/R/hooks-md.R#L20

Example Rmd

---
title: "Untitled"
output :
  word_document: default
  powepoint_presentation: default
  odt_document: default
  rtf_document: default
  bookdown::word_document2: default
---

# fig.show='hold'

```{r base, fig.show='hold', fig.cap=.cap}
.cap = c('a', 'b')
plot(1)
'a'
plot(2)
```

# fig.show='asis'

```{r ref.label='base', fig.show='asis', fig.cap=.cap}

```

BTW, when fig.show='hold', captions are not working in the above example.
I'm currently working to fix this.

xfun::session_info('knitr')

R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch), RStudio 1.2.1335

Locale:
  LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
  LC_MESSAGES=C              LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
  LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

Package version:
  evaluate_0.14   glue_1.3.1      graphics_3.6.1  grDevices_3.6.1 highr_0.8       knitr_1.24.4    magrittr_1.5    markdown_1.1    methods_3.6.1  
  mime_0.7        stats_3.6.1     stringi_1.4.3   stringr_1.4.0   tools_3.6.1     utils_3.6.1     xfun_0.9        yaml_2.2.0     

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.name/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('knitr'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('yihui/knitr').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@atusy atusy self-assigned this Sep 4, 2019
@atusy
Copy link
Collaborator Author

atusy commented Sep 5, 2019

Although I guess the change is caused by knitr or other R packages, I tried Pandoc 2.2.1 and 2.7.3 just for sure.
Both works fine.
I gonna make PR.

@github-actions
Copy link

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 10, 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