A minimal and elegant presentation theme
03 November, 2024
Before we dive a bit deeper, here is a simple example of the clean theme in action.
Next, we’ll take a brief tour of some theme components.
R libraries
While the clean theme is language agnostic, we will use several R coding examples in this demo to highlight some advanced theme features.
You will need the following libraries if you’d like to render the template “as-is”:
TinyTex
While reveal.js presentations are HTML format, we will show an example of how to embed LaTeX tables as images. This requires a working Tex distribution, of which TinyTex provides by far the easiest and lightest integration with Quarto. More details here.
Here we have an unordered list.
And next we have an ordered one.
To emphasize specific words or text, you can:
.alert
class, e.g. important note..fg
class for custom colour, e.g. important note..bg
class for custom background, e.g. important note..fragment
Fragments are a way to animate elements onto the slide.
Fade in
Semi fade out
Fade out
Highlight red
Fragments can also be nested.
Fade in > Highlight red > Highlight blue > Semi fade out
Fade in > Highlight red > Semi fade out
To cross-reference, you have several options, for example:
.button
class provided by this theme, e.g. AppendixCitations follow the standard Quarto format and be sourced from BibLaTex, BibTeX, or CLS files. For example:
Topic 1: Spatial Frictions (Fajgelbaum et al. 2018; Hsieh and Moretti 2019; Moretti 2011)
Topic 2: Blah (Suárez Serrato and Zidar 2016)
Quarto provides dedicated environments for theorems, lemmas, and so forth.
But in presentation format, it’s arguably more effective just to use a Callout Block.
Regression Specification
The main specification is as follows:
\[ y_{it} = X_{it} \beta + \mu_i + \varepsilon_{it} \]
Here is a long sentence that will wrap onto the next line as it hits the column width, and continue this way until it stops.
Some other text in another column.
A second paragraph.
Multicolumn support is very flexible and we can continue with a single full span column in the same slide.
Note that sub- and multi-panel figures are also natively supported by Quarto. See here.
tabset
# Set the palette
sns.set_palette("tab10")
# Set the font family and other parameters
rcParams['font.family'] = 'sans-serif'
rcParams['font.sans-serif'] = ['HersheySans']
rcParams['axes.labelsize'] = 12
rcParams['axes.titlesize'] = 14
rcParams['xtick.labelsize'] = 10
rcParams['ytick.labelsize'] = 10
# Load the iris dataset
iris = sns.load_dataset("iris")
# Create the pairwise scatterplot
sns.pairplot(iris, hue="species", markers=["o", "s", "D"])
# Show the plot
plt.show()
Quarto offers excellent table support, with further customization via user libraries. Let’s illustrate with a regression example:
import statsmodels.api as sm
import statsmodels.formula.api as smf
import pandas as pd
# Example data
data = {
'rating': [1, 2, 3, 4, 5],
'complaints': [1, 2, 3, 4, 5],
'privileges': [1, 2, 3, 4, 5],
'learning': [1, 2, 3, 4, 5],
'raises': [1, 2, 3, 4, 5],
'critical': [1, 2, 3, 4, 5],
'advance': [1, 2, 3, 4, 5]
}
attitude = pd.DataFrame(data)
# Fit the model
formula = 'rating ~ complaints + privileges + learning + raises + critical + advance'
model = smf.ols(formula=formula, data=attitude).fit()
# Coefficient mapping dictionary
coef_map = {
"rating": "Overall Rating",
"complaints": "Handling of Complaints",
"privileges": "No Special Privileges",
"learning": "Opportunity to Learn",
"raises": "Performance-Based Raises",
"critical": "Too Critical",
"advance": "Advancement"
}
attitude
dataset
Dependent variable: rating | |
(1) | |
Intercept | 0.000 |
(0.000) | |
Advancement | 0.167*** |
(0.000) | |
Handling of Complaints | 0.167*** |
(0.000) | |
Too Critical | 0.167*** |
(0.000) | |
Opportunity to Learn | 0.167*** |
(0.000) | |
No Special Privileges | 0.167*** |
(0.000) | |
Performance-Based Raises | 0.167*** |
(0.000) | |
Observations | 5 |
R2 | 1.000 |
Adjusted R2 | 1.000 |
Residual Std. Error | 0.000 (df=3) |
F Statistic | 8948121883963971980941456310272.000*** (df=1; 3) |
Note: | *p<0.1; **p<0.05; ***p<0.01 |
You can use the {.background-image}
container environment to completely fill the slide background with an image.
Ideally, your figure will be the same aspect ratio as the screen that you’re presenting on.
This theme also includes the Font Awesome icon set Just use the fa
class and the icon name:
If you want to toggle a Python terminal in your presentation, you can use the drop
plugin
You can toggle the terminal with the backtick key ( `) or with the button below
In this template, the plugin also comes with matplotlib
, numpy
, and pandas
pre-installed
You still need to import them in the terminal, though
If you want to run Python code in your presentation, you can use the pyodide
engine. Click on the terminal button on the bottom left to open a Python terminal.
This presentation theme also includes the Appearance plugin. You can use it to animate elements on your slides.
Multimodel can be used to showcase images, videos or code in your presentation.
Please refer to the quarto-presentation.qmd
file for the code to generate these multimodal elements.