How can I change the default PDF output of #| code-fold: true?
#14229
-
DescriptionI have written a textbook that I want to render to both HTML and PDF. The HTML version contains some folded code chunks, which means that readers of the HTML version have the option of clicking to view the code underlying a figure, for example (see example Quarto doc below). When I render to PDF (see attachment), the code folds are ignored and the code is printed regardless of whether I specified ---
title: "Code-fold default in PDF"
date: last-modified
author: Elen Le Foll
format: pdf
---
```{r}
#| label: demo-chunk
#| code-fold: true
#| code-summary: "See `R` code to generate plot."
plot(1:10)
```
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
|
How do you want the code to fold in static formats?
Side note: avoid writing your request/question as part of the reproducible example, it makes reading harder because your actual question is hidden. It's also less accessible, because your question is now "code" and not prose. |
Beta Was this translation helpful? Give feedback.
There are no default to change.
code-foldis HTMLdetails/summary. This does not exist outside HTML-based formats thus why it's "ignored".Soo you have to use any approaches mentioned before.
or