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

Custom Environment Inline R code or nested chunks #924

Closed
3 tasks done
tchevri opened this issue Aug 3, 2020 · 3 comments · Fixed by #940
Closed
3 tasks done

Custom Environment Inline R code or nested chunks #924

tchevri opened this issue Aug 3, 2020 · 3 comments · Fixed by #940
Assignees

Comments

@tchevri
Copy link

tchevri commented Aug 3, 2020

Hi folks, so sorry to disturb again.

  1. Thanks so much for helping with bookdown/issues/883, which worked for me and resolved the issue.
  2. I posted on SO over a week ago, but seem to be getting very little traffic on my question. So i'd like to push it here, if you do not mind, please. stackoverflow.com/bookdown-proof-custom-environment-how-to-nest-code-chunks-or-inline-r-inside
    From my search, I believe and it looks like a lot of people have been looking for similar things over the years....

As I posted there in the comments, I don't know if a child document or more likely a lua filter approach would work - despite using XieYiHui's awesome code for so many years now, I am still a total newbie unfortunately. Therefore, your expert help is all the more appreciated. My only goal is to produce a book that can compile in pdf, epub, and html, BUT produce slides at the same time... in the original spirit of beamer...


By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/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('bookdown'). 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('rstudio/bookdown').
    • 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.

@yihui
Copy link
Member

yihui commented Aug 17, 2020

Eventually we hope to provide an alternative implementation of the theorem environments based on Pandoc's fenced Divs. Then you'll be able to mix R code chunks or inline code into these environments, e.g.

::: {.theorem}
```{r}
1 + 1
```

Inline value `r pi`.
:::

There is no ETA at the moment, but I'll prioritize this issue.

@yihui
Copy link
Member

yihui commented Oct 12, 2020

Now you may test the development version via:

remotes::install_github('rstudio/bookdown')

There isn't much documentation yet, but hopefully the syntax is straightforward enough. Here is an example: https://github.com/rstudio/bookdown/blob/master/tests/rmd/custom-environments.Rmd The new helper function bookdown::fence_theorems() may help you convert the old syntax to the new syntax.

I plan to make a new CRAN release soon, so you probably won't have time to test this new feature thoroughly, but we can definitely keep improving it in the future versions. Thanks!

@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 Apr 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants