For implementing Single Source Publishing based on a common language for all formats (namely Markdown) with help of Quarto, manage a common syntax in Markdown for customized callout (nice box) compatible with revealjs, beamer. It should be possible to put these callouts inside columns delimited by fenced div.
- install the extension
quarto add frederic-baucher/callout-custom
- add the following to _quarto.yml
format:
revealjs:
filters:
- _extensions/frederic-baucher/callout-custom/revealjs-callout-custom.lua
beamer:
include-in-header:
file: _extensions/frederic-baucher/callout-custom/callout-custom.tex
First, create a fork of this repo. Suppose we create the example callout. Then add 3 files to manage the callout in the 3 corresponding format
- callout-example-html.lua
- callout-example-revealjs.lua
- callout-example.tex
:::{.callout-example data-latex="{a nice title for callout}"}
* Know how to make your own callouts.
* Be able to mess with some SCSS/CSS styling.
:::
:::{.callout-example data-latex="{a nice title for callout}"}
* Know how to make your own callouts.
* Be able to mess with some SCSS/CSS styling.
:::
Syntax B : title given by first header after fenced div
:::{.callout-example data-latex=""}
### a nice title for callout
* Know how to make your own callouts.
* Be able to mess with some SCSS/CSS styling.
:::
- Should be OK in beamer but the tags are mixed because a bug in latex ?
:::{.callout-example data-latex=""}
::::{.callout-example-header data-latex=""}
a nice title for callout
::::
* Know how to make your own callouts.
* Be able to mess with some SCSS/CSS styling.
:::
format:
html:
theme:
- cosmo
- diy/callout-example.scss
quarto render example.qmd quarto preview example.qmd
- https://stackoverflow.com/questions/73984001/change-default-behavior-of-callout-blocks-in-quarto: custom callout with lua
- https://tex.stackexchange.com/questions/525924/with-pandoc-how-to-apply-a-style-to-a-fenced-div-block You need that data-latex="" in there too to get it to work.
- quarto-dev/quarto-cli#4755
- https://groups.google.com/g/pandoc-discuss/c/PkF04EkUqzQ
function latex(s)
return pandoc.RawBlock('latex', s)
end
function Div(el)
if el.classes[1] == 'solution' then
return { latex('\begin{solution}'), el.content, latex('\end{solution}') }
end
end
---
output:
html_document:
css: style.css
pdf_document:
includes:
in_header: preamble.tex
---