Introduction 🐸
One of froggeR
’s core strengths is its ability to
maintain consistent settings and styling across multiple projects. This
vignette demonstrates how to set up and customize your Quarto documents
using froggeR
’s powerful configuration system.
Setting Up Reusable Options
Initial Configuration
The froggeR_settings()
function manages your document settings through an interactive
interface. This is typically a one-time setup that benefits all future
projects:
froggeR::froggeR_settings()
This creates a configuration file at
~/.config/froggeR/config.yml
that persists across R
sessions:
name: Your Name
email: your.email@example.com
orcid: 0000-0000-0000-0000 # Optional
url: https://github.com/username # Optional
affiliations: Your Institution # Optional
toc: Table of Contents # Defaults if empty
Note: Leaving values blank will not cause errors, but modify these values carefully.
To view your current settings without modifying them, use:
froggeR::froggeR_settings(update = FALSE)
These settings flow through your projects in this order:
-
config.yml
stores your permanent settings (exact location depends on your OS) -
froggeR
reads these when creating new projects - Settings populate
_variables.yml
in your project - Quarto documents use these variables automatically
Note: While you can update these settings at any time, most users find they only need to set them once or very infrequently.
Document Styling with SCSS
Understanding SCSS Structure
The write_scss()
function creates a template with three main sections:
-
Defaults (
/*-- scss:defaults --*/
)- Basic styling variables
- Color schemes
- Font settings
-
Mixins (
/*-- scss:mixins --*/
)- Reusable style patterns
- Custom style functions
-
Rules (
/*-- scss:rules --*/
)- Specific element styling
- Custom classes
- Layout adjustments
Working with Comments
The SCSS template uses //
for commented styles. These
act like a menu of styling options:
/*-- scss:defaults --*/
// $primary: #2c365e; // Main theme color
// $body-bg: #fefefe; // Background color
// $link-color: $primary; // Inherit from primary
To activate any style:
- Remove the
//
at the start of the line - Save the file
- Re-render your document
Working with Multiple SCSS Files
froggeR allows you to create and manage multiple SCSS files for different styling needs:
froggeR::write_scss(name = "modern_theme")
froggeR::write_scss(name = "presentation_theme")
To use a specific SCSS file in your Quarto document, update the YAML header:
---
title: "My Document"
format:
html:
theme:
- default
- modern_theme.scss # Or presentation_theme.scss
---
froggeR will attempt to automate the revision of your YAML header. Don’t be dismayed – we’ll provide you with feedback if this is unsuccessful and provide an example like the code block above to walk you through each step.
Basic Customization Examples
Advanced Customization
Combine multiple elements for sophisticated styling:
/*-- scss:defaults --*/
// First, set your variables
$primary: #2c365e;
$font-family-monospace: "Fira Code", monospace;
/*-- scss:rules --*/
// Then create custom rules
.title-block {
margin-bottom: 2rem;
border-bottom: 3px solid $primary;
h1 {
color: darken($primary, 10%);
font-weight: 600;
}
}
// Style code elements
code {
color: lighten($primary, 10%);
padding: 0.2em 0.4em;
border-radius: 3px;
}
Common Issues and Solutions
Settings Issues
-
Variables Not Updating
- Restart R session after
config.yml
changes - Check
_variables.yml
exists in project - Verify YAML structure in documents
- Restart R session after
-
Multiple Projects
- Settings apply to new projects only
- Existing projects keep their settings
- Update
_variables.yml
manually if needed
Styling Problems
-
Styles Not Applying
- Verify
custom.scss
is listed in YAML undertheme
- Check file location (should be in project root)
- Ensure no syntax errors in SCSS
- Try clearing Quarto cache
- Verify
-
Font Issues
- Include Google Fonts in YAML
- Check font name spelling
- Use web-safe fallbacks
-
Variable Scope
- Define all variables in
scss:defaults
- Reference variables after definition
- Use proper SCSS syntax (
$variable
)
- Define all variables in
SCSS File Management
-
Project Creation vs. Individual Documents
-
quarto_project()
automatically createscustom.scss
-
write_quarto()
uses existingcustom.scss
if available - For standalone documents, manually create SCSS with
write_scss()
-
Summary
froggeR
streamlines document customization:
- Set up once with
froggeR_settings()
- Style with
write_scss()
- Reuse across all your projects
- Update easily when needed
Happy styling! 🐸
Consistent, professional documents with minimal effort