I'm trying to write a novel using bookdown: HTML, EPUB, as well as PDF (pdfLaTeX). I'm using the indent mode, so paragraphs begin with an indent. I have the following custom LaTeX command, called \scenebreak
, which:
Here's the LaTeX:
% scene breaks
\renewcommand{\pfbreakdisplay}{%
\scriptsize\ding{86}}
\newcommand{\scenebreak}{\pfbreak*\noindent}
\newcommand{\forceindent}{\leavevmode{\indent}}
When introducing the scenebreak in LaTeX, I call it so
Text here
\scenebreak
New scene begins here.
In HTML, this is how I've done it:
<div style='text-align:center;'>•</div>
I'm aware that a block
in bookdown is like a LaTeX environment.
Is a similar setup possible with commands/macros?
I don't really understand your question, but if you are trying to write out different content depending on the different output format, here is what you could do:
```{r echo=FALSE}
knitr::asis_output(if (knitr:::is_latex_output()) {
"\\scenebreak"
} else {
"<div style='text-align:center;'>•</div>"
})
```
If you have to do this multiple times, create a function and call the function instead, e.g., insert this code chunk in the beginning of your book:
```{r, include=FALSE}
scenebreak = function() {
knitr::asis_output(if (knitr:::is_latex_output()) {
"\\scenebreak"
} else {
"<div style='text-align:center;'>•</div>"
})
}
```
Then use the function scenebreak()
where a break is needed:
```{r echo=FALSE}
scenebreak()
```