Code
1 + 1
#> [1] 2
Overview
I have embedded most of the pre-defined cross-references in callout boxes. The exceptions are figure (fig
) and table (tbl
)
What follows is an overview of
- crossref-cnj-title: "R Code" # replaces "Conjecture"
- crossref-cor-title: "Assessment" # replaces "Corollary"
- crossref-def-title: "Experiment" # remains "Definition"
- crossref-exm-title: "R Code Collection" # replaces "Example"
- crossref-exr-title: "Exercise" # remains "Exercise"
- crossref-fig-title: "Screenshot" # replaces "Figure"
- crossref-rem-title: "Remark " # remains "Remark"
- crossref-lem-title: "Resource" # replaces "Lemma"
- crossref-lst-title: "Listing / Output" # replaces "Listing"
- crossref-prp-title: "Procedure" # replaces "Proposition"
- crossref-sol-title: "Solution" # remains "Solution"
- crossref-tbl-title: "Table" # remains "Table"
- crossref-thm-title: "Formula" # replaces "Theorem" (needs "formula")
The following table lists all callout boxes. Besides of the difference between numbered boxes and unnumbered boxes there are two different types of (numbered) boxes:
exr
), Definition (def
) and Conjecture (con
).
quarto.yml
under the metadata heading language
. For instance I replaced Definition
with Experiment
, Conjecture
with R Code
, but kept Exercise
.bul
) and Checklists (tdo
).The fourth column snippet
shows the shortcut to call the Markdown snippet I have prepared. (Learn more about RStudio code snippets.) For each of these snippets there exist a corresponding CSS style. As I am not very experienced in CSS I gratefully adapted code by Andreas Handel (2023). (I just noticed there there was recently an update (2025) that I still need to read.)
The fifth column is a reference to an empty example showing just the bones of the callout-boxes. It is not necessary to jump to the location. If you hover with the mouse over the link Quarto will show you a small version of the callout box.
My Title | Quarto | Ref | Snippet | Reference to example |
---|---|---|---|---|
Assessment | Corollary | — | my-assessment | Section C.2.1 |
Assessment | Corollary | cor | num-assessment | Section C.2.2 |
Bullet List | ———- | — | my-bullet | Section C.3.1 |
Bullet List | ———- | bul | num-bullet | Section C.3.2 |
Checklist | ———- | — | my-check | Section C.4.1 |
Checklist | ———- | tdo | num-check | Section C.4.2 |
Exercise | Exercise | — | my-exercise | Section C.6.1 |
Exercise | Exercise | exr | num-exercise | Section C.6.2 |
Exercise | Exercise | exr | ab-exercise | Section C.6.3 |
Exercise | Exercise | exr | abc-exercise | Section C.6.4 |
Experiment | Definition | — | my-experiment | Section C.7.1 |
Experiment | Definition | def | num-experiment | Section C.7.2 |
Important | ———- | — | my-important | Section C.8.1 |
Listing / Output | Listing | lst | ——————- | Section C.14 |
Objectives | ———- | obj | my-objectives | Section C.9.1 |
Package Profile | ———- | — | my-package | Section C.10.1 |
Package Profile | ———- | — | packagebox | Section C.10.2 |
Procedure | Proposition | — | my-procedure | Section C.11.1 |
Procedure | Proposition | prp | num-procedure | Section C.11.2 |
R Code | Conjecture | — | my-r-code | Section C.12.1 |
R Code | Conjecture | cnj | num-r-code | Section C.12.2 |
R Code | Conjecture | cnj | num-r-code-listing | Section C.12.3 |
R Code Collection | Example | exm | ab-code | Section C.12.4 |
R Code Collection2 | ———- | col | ab-code2 | Section C.12.5 |
R Code Shiny | Conjecture | cnj | num-r-shiny | Section C.18.1 |
Remark | Remark | — | my-remark | Section C.15.1 |
Remark | Remark | rem | num-remark | Section C.15.2 |
Report | ———- | rep | num-report | Section C.16.1 |
Resource | Lemma | my-resource | Section C.17.1 | |
Resource | num-resource | Section C.17.2 | ||
Screenshot | Figure | figure | Section C.13.1 | |
Screenshot | figure-border | Section C.13.2 | ||
Solution | sr2 | Section C.19.1 | ||
Solution | my-solution | Section C.19.2 | ||
Solution | num-solution | Section C.19.3 | ||
Table | Table | ——————- | Section C.20 | |
Tip | ———- | — | my-tip | Section C.21.1 |
Typo | ———- | — | my-typo | Section C.23.1 |
Theorem | Theorem | formula | Section C.22.1 | |
Theorem | Theorem | my-theorem | Section C.22.2 | |
Theorem | Theorem | num-theorem | Section C.22.3 | |
Watch Out | ———- | my-watch | Section C.24.1 | |
Watch Out | ———- | num-watch | Section C.24.2 |
Title for assessment comes here
Here include text for assessment
Assessment C.1 : Numbered Assessment Title
Here include assessment text
Title for bullet text
Here include bullet text
Title for checklist text
Here include checklist text
Title for my example
Here include text
Code Collection C.1 : Numbered Example Title
Here include example text
Exercise Title
Here include exercise text
Exercise C.1 : Numbered Exercise Title
Here include exercise text
Exercise C.2 : Numbered Exercise Title
R Code C.3 : Numbered R Code Title 1
1 + 1
#> [1] 2
R Code C.4 b: Numbered R Code Title (Tidyverse)
1 + 1
#> [1] 2
Exercise C.3 : Title of abc-exercise
R Code C.5 : Title of code exercise
Solution C.1. : Title of solution
Solution C.2. : Title of Shiny app
Title of Experiment
Here include text for experiment
Experiment C.1 : Numbered Experiment Title
Here include text for experiment
Experiment C.2 : Numbered Experiment Title
Important Title
Here include text for important box
Learning Objectives:
Here include text for objectives
Package Name
Here include package description
The following snippet packagebox
is used in extra annex chapter where all used package are listed with their profiles. The snippet is a kind of template to facilitate writing package profiles. Because of the internal links I have added here the {dplyr} packages as a complete example.
The following first line of package-name
was originally a two-level header including a reference generated by the snippet. The idea is that I can refer from every chapter to the package by a simple syntax format: @sec-annex-[package-name]
To prevent destroying the table of content for this document I have changed this header to a normal line but with capital letters. Additionally I have deleted the anchor for the reference {#sec-annex-package-name}
.
package-name {#sec-annex-package-name}
I changed all the following line:
- "## package-name {#sec-annex-package-name}" to "PACKAGE-NAME"
-
PACKAGE-NAME
Package Profile: package-name
personal comment
Procedure Title
Here include procedure text
Procedure C.1 : Numbered Procedure Title
Here include procedure text
Title for R-Code
1 + 1
#> [1] 2
R Code C.8 : Numbered R Code Title
1 + 1
#> [1] 2
Code Collection C.3 : Title for code collection
R Code C.10 : Numbered R Code Title (Original)
1 + 1
#> [1] 2
R Code C.11 : Numbered R Code Title (Tidyverse)
1 + 1
#> [1] 2
The following snippet is not used in this book. I have it just included because it may be of interest how to develop a call-out box with own numbering system. The interesting part is not here but in the quarto.css
file of this book.
There is no snippet for listings. Listings is included in num-r-code-listing
(see: Section C.12.3).
Title for remark
Here include remark lines
Remark C.1. : Numbered Remark Title
Here include remark text
Title for resource
Here include resource text
Resource C.1 : Numbered Resource Title
Here include text for the resource
R Code C.14 : Numbered R Code Title
Exercise ID: Header
Description more in Detail
My Solution
Here comes the solution
The above box is intended for the text description of a task or challenge, followed by the R code as the solution. But it has no numbering!
Solution:
Here include solution text
Solution C.3. : Numbered Solution Title
Here include text for the solution
No changes, no snippet.
Title for Tip / Hint
Here include text for tip / hint box
Read Mathematics in R Markdown
The numbering for theorems / formula is different than from the other cross-references / callout boxes.
Title of theorem
Here include theorem text
Formula C.1 : Numbered Theorem Title
Typo Title
Here include typo text
Title for watch-out text
Here include watch-out text
The following boxes are pre-designed in Quarto. They can be adapted in three ways:
Next I will show the tip
box as a unnumbered demo box with a title and colored text. You can provide whatever color you want.
Consectetur cursus iaculis ad? Potenti taciti orci lobortis aenean sociis egestas: maecenas pulvinar lobortis, lectus auctor ultricies blandit elementum! Orci nibh risus convallis semper duis ut, ultrices tincidunt fames curae. Na curae.
In the following listing I will provide the untitled and uncolored numbered version.
Dolor mus interdum in sollicitudin: dictum interdum, ante, integer sed, sed dignissim fames. Placerat viverra aptent. Lectus vehicula cras, mi est vivamus ultricies, nunc sollicitudin auctor. Tortor.
Dolor interdum nulla ridiculus, magnis habitant a. Mollis habitant – cubilia nulla nibh id sapien. Pellentesque facilisi fusce fermentum nibh sodales. Na sodales.
Here I have changed the title from “Warning” to “Watch-out”. This done in _quarto.yml
file:
language:
callout-warning-title: "Watch out!" # orange
For a list of all the different language specific expressions see the Quarto `CLI GitHub resource language page. (CLI stands for Command Line Interface.)
Adipiscing lobortis facilisis, commodo aliquet ligula odio. Est in ultricies augue – volutpat tristique faucibus? Est habitant vestibulum feugiat elementum aliquam penatibus. Na penatibus.
Ipsum aptent himenaeos, feugiat cras primis fusce, vitae in. Gravida pretium dignissim sem platea velit, diam sed mollis? Per aptent aenean augue: mollis: senectus potenti taciti elementum? Na elementum!
Amet sociosqu nascetur purus fringilla, commodo: aliquam nisi blandit a. Inceptos risus eros quam sagittis vitae turpis dignissim? Bibendum hac dis: tellus commodo primis conubia proin eu auctor. Na auctor?
The following box counts with my own numbering. I have added the following line to the _quarto.yml
file. The box is still experimental and has not the same appearance as the other Quarto callout boxes. Additionally it it refers only to the CSS selector .callout
that I have not defined and seems to be part of the Bootstrap framework. I have to investaige this further.
crossref:
appendix-title: "Appendix"
appendix-delim: ":"
custom: - kind: float
reference-prefix: Report key: rep
I just remembered (2025-06-30) that I have used nice uncolored boxes in my older rmarkdown books, for example in Exercises for ‘Introduction to The New Statistics’.
I am thinking if I should use them in this newer books.
Colored paragraphs give you a visual overview of things to watch out.
The following explanation is a text snippet in RStudio and can be called with the block
snippet.
This is a colored block for Quarto The idea is taken from my previous bookdown books See itns-exercises. Adapted for working easier with snippet shortcodes in Quarto Snippets are three times the first letter after ‘rmd’ For example “aaa” stands for “rmdattention” See: learning-shiny It needs special adaption in the CSS file (look for .rmdattention and friends)
Change label-name!
The yellow-colored block with the warning triangle tells you how to avoid troubles before it starts.
The red-colored block with the stop sign explains procedures you should avoid, explain error messages and how to recover from the problem.
The dark blue block with the info symbol offers you some essential information, tip, or hint. I use it also for decriptions of my experiences (motto: lesson learnend)
The gray box with the book icon refers to books and web reources alike.The difference to the web resources box is that it contains references to citations.
This green-colored block with the checkmark presents a successful operation or solved problem.
The light blue block with the WWW symbol explains a download and/or installations procedure. Sometimes it is also refering to a web resource (similar as in the resource-box) but this block refers always only to web pages without a citation reference.
attention-text
danger-text
infobox-text
resource-text
success-text
web-resouce-text
Info: This is example text.
Success: This is example text.
Warning: This is example text.
Danger: This is example text.
term | definition |
---|---|
CLI | The abbreviation CLI stands for Command Line Interface. A Command Line Interface is a text-based interface used for entering commands directly to a computer system. It allows users to interact with a computer's operating system or software by typing commands into a console or terminal. Unlike graphical user interfaces (GUIs), which use windows, icons, and mouse interactions, CLIs rely on text input and output. |
CSS | Cascading Style Sheets (CSS) is a style sheet language used for specifying the presentation and styling of a document written in a markup language such as HTML or XML (including XML dialects such as SVG, MathML or XHTML). CSS is a cornerstone technology of the World Wide Web, alongside HTML and JavaScript. CSS is designed to enable the separation of content and presentation, including layout, colors, and fonts. (<a href="https://en.wikipedia.org/wiki/CSS">Wikipedia</a>) |
Session Info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.5.1 (2025-06-13)
#> os macOS Sequoia 15.5
#> system aarch64, darwin20
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz Europe/Vienna
#> date 2025-07-02
#> pandoc 3.7.0.2 @ /opt/homebrew/bin/ (via rmarkdown)
#> quarto 1.8.4 @ /usr/local/bin/quarto
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> cli 3.6.5 2025-04-23 [1] CRAN (R 4.5.0)
#> commonmark 1.9.5 2025-03-17 [1] CRAN (R 4.5.0)
#> curl 6.4.0 2025-06-22 [1] CRAN (R 4.5.0)
#> dichromat 2.0-0.1 2022-05-02 [1] CRAN (R 4.5.0)
#> digest 0.6.37 2024-08-19 [1] CRAN (R 4.5.0)
#> evaluate 1.0.4 2025-06-18 [1] CRAN (R 4.5.0)
#> farver 2.1.2 2024-05-13 [1] CRAN (R 4.5.0)
#> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.5.0)
#> glossary * 1.0.0.9003 2025-06-08 [1] local
#> glue 1.8.0 2024-09-30 [1] CRAN (R 4.5.0)
#> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.5.0)
#> htmlwidgets 1.6.4 2023-12-06 [1] CRAN (R 4.5.0)
#> jsonlite 2.0.0 2025-03-27 [1] CRAN (R 4.5.0)
#> kableExtra 1.4.0 2024-01-24 [1] CRAN (R 4.5.0)
#> knitr 1.50 2025-03-16 [1] CRAN (R 4.5.0)
#> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.5.0)
#> litedown 0.7 2025-04-08 [1] CRAN (R 4.5.0)
#> lorem 1.0.0 2023-03-09 [1] CRAN (R 4.5.0)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.5.0)
#> markdown 2.0 2025-03-23 [1] CRAN (R 4.5.0)
#> R6 2.6.1 2025-02-15 [1] CRAN (R 4.5.0)
#> RColorBrewer 1.1-3 2022-04-03 [1] CRAN (R 4.5.0)
#> rlang 1.1.6 2025-04-11 [1] CRAN (R 4.5.0)
#> rmarkdown 2.29 2024-11-04 [1] CRAN (R 4.5.0)
#> rstudioapi 0.17.1 2024-10-22 [1] CRAN (R 4.5.0)
#> rversions 2.1.2 2022-08-31 [1] CRAN (R 4.5.0)
#> scales 1.4.0 2025-04-24 [1] CRAN (R 4.5.0)
#> sessioninfo 1.2.3 2025-02-05 [1] CRAN (R 4.5.0)
#> stringi 1.8.7 2025-03-27 [1] CRAN (R 4.5.0)
#> stringr 1.5.1 2023-11-14 [1] CRAN (R 4.5.0)
#> svglite 2.2.1 2025-05-12 [1] CRAN (R 4.5.0)
#> systemfonts 1.2.3 2025-04-30 [1] CRAN (R 4.5.0)
#> textshaping 1.0.1 2025-05-01 [1] CRAN (R 4.5.0)
#> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.5.0)
#> viridisLite 0.4.2 2023-05-02 [1] CRAN (R 4.5.0)
#> xfun 0.52 2025-04-02 [1] CRAN (R 4.5.0)
#> xml2 1.3.8 2025-03-14 [1] CRAN (R 4.5.0)
#> yaml 2.3.10 2024-07-26 [1] CRAN (R 4.5.0)
#>
#> [1] /Library/Frameworks/R.framework/Versions/4.5-arm64/library
#> [2] /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library
#> * ── Packages attached to the search path.
#>
#> ──────────────────────────────────────────────────────────────────────────────