Wackerly to QMD Lecture Converter
Wackerly to QMD Lecture Converter
Convert Wackerlyโs โMathematical Statistics and Applicationsโ (7th Edition) textbook chapters into interactive RevealJS lecture presentations.
๐ Target Audience
Students: Finance and Economics majors at ADA University
Implication: ALL examples, case studies, and practice problems should have financial or economic context. Abstract mathematical examples from Wackerly should be transformed into relatable finance/econ scenarios.
Quick Start Workflow
When creating lectures from a chapter:
- Extract the chapter content from the uploaded PDF using pymupdf
- Read the chapter text to identify definitions, theorems, examples, and figures
- Split into 2-3 lectures based on logical content breaks
- Transform content into QMD slides following the templates
- Transform examples into finance/economics contexts
- Add interactive elements: OJS visualizations, R case studies, quizzes
- Include financial applications relevant to each topic
- Run autopilot optimization: compile โ check fonts โ fix โ recompile
๐ฏ Critical Design Requirements
Font Size Requirements (MANDATORY)
- Minimum font size: 30pt equivalent (0.75em) for back-row visibility
- Always prioritize readability over fitting more content
- When in doubt, go LARGER
Revealjs Font Size Reference
| CSS em value | Approximate pt | Use Case | |โโโโโ|โโโโโ-|โโโ-| | 0.6em | ~24pt | โ Too small - NEVER use | | 0.75em | ~30pt | โ
Minimum acceptable | | 0.85em | ~34pt | โ
Good for dense slides | | 1.0em | ~40pt | โ
Preferred for text | | 1.2em | ~48pt | โ
Great for key points |
Content Strategy
- Split slides when content is dense rather than shrinking text
- One concept per slide is better than cramped content
- Use
{.smaller}class sparingly, only for interactive slides with controls - Maximum 80 words per slide
- Maximum 5 bullet points per slide
Accessing the Book
Method 1: Uploaded PDF (Preferred)
When the user uploads the Wackerly PDF (Mathematical_Statistics_-_7th_Edition_-_Wackerly.pdf):
- Use the extraction script to get chapter content:
python scripts/extract_wackerly.py /path/to/wackerly.pdf ch6 # Or specific pages: python scripts/extract_wackerly.py /path/to/wackerly.pdf 320 340 - Or extract directly with pymupdf:
import fitz doc = fitz.open('/mnt/user-data/uploads/Mathematical_Statistics_-_7th_Edition_-_Wackerly.pdf') # Extract pages (0-indexed) for page_num in range(start-1, end): text = doc[page_num].get_text() - Check
references/wackerly-chapters.mdfor page numbers and content structure
Chapter Page Numbers (PDF pages)
| Chapter | Title | Pages | |โโโ|โโ-|โโ-| | 1 | What Is Statistics? | 25-43 | | 2 | Probability | 44-109 | | 3 | Discrete Random Variables | 110-180 | | 4 | Continuous Variables | 181-246 | | 5 | Multivariate Distributions | 247-319 | | 6 | Functions of Random Variables | 320-369 | | 7 | Sampling Distributions & CLT | 370-413 | | 8 | Estimation | 414-467 | | 9 | Point Estimators & Estimation Methods | 468-511 | | 10 | Hypothesis Testing | 512-586 | | 11 | Linear Models | 587-663 | | 12 | Designing Experiments | 664-684 | | 13 | Analysis of Variance | 685-736 | | 14 | Categorical Data | 737-764 | | 15 | Nonparametric Statistics | 765-819 | | 16 | Bayesian Methods | 820-844 |
Method 2: Web Search (Fallback)
If PDF not available, use web_search: "Wackerly Mathematical Statistics" "Definition X.Y"
YAML Frontmatter Template
---
title: "Mathematical Statistics"
subtitle: "Topic Name Here"
author:
- name: "Samir Orujov, PhD"
affiliations:
- name: "ADA University, School of Business"
- name: "Information Communication Technologies Agency, Statistics Unit"
date: today
format:
revealjs:
theme: default
logo: ../ADA.png
transition: slide
slide-number: c/t
chalkboard: true
controls: true
navigation-mode: linear
width: 1280
height: 720
margin: 0.04
min-scale: 0.2
max-scale: 2.0
footer: "Mathematical Statistics - Topic Name"
incremental: false
highlight-style: tango
code-fold: true
menu: true
progress: true
history: true
mouse-wheel: true
overview: true
zoom: true
quiz:
checkKey: 'c'
resetKey: 'r'
shuffleKey: 's'
allowNumberKeys: true
disableOnCheck: false
disableReset: false
shuffleOptions: true
defaultCorrect: "โ
Correct! Well done."
defaultIncorrect: "โ Not quite. Try again or check the explanation."
includeScore: true
revealjs-plugins:
- quiz
---
Workflow
0. Extract Chapter Content from PDF
Before creating lectures, extract the relevant chapter content:
import fitz
doc = fitz.open('/mnt/user-data/uploads/Mathematical_Statistics_-_7th_Edition_-_Wackerly.pdf')
# Get chapter pages from references/wackerly-chapters.md
start_page, end_page = 320, 369 # Chapter 6 example
for page_num in range(start_page - 1, end_page):
page = doc[page_num]
text = page.get_text()
print(f"=== PAGE {page_num + 1} ===")
print(text)
Key elements to extract:
- Definition numbers and text (e.g., โDEFINITION 6.1โ)
- Theorem statements and proofs
- Example problems with solutions
- Figure descriptions (recreate with R/OJS)
- Exercise problems for practice/quiz questions
1. Analyze Chapter Content
Split each Wackerly chapter into 2-3 logical lectures based on:
- Conceptual boundaries: Group related definitions and theorems
- Complexity: ~45-60 min teaching content per lecture
- Dependencies: Earlier concepts before those that build on them
Example split for Chapter 5 (Multivariate Distributions):
- Lecture 1: Joint distributions, marginal distributions
- Lecture 2: Conditional distributions, independence
- Lecture 3: Expected values, covariance, correlation
2. Generate QMD Files
For each lecture, create a .qmd file following the template in references/qmd-template.md.
3. Transform Content
| Wackerly Element | QMD Transformation |
|---|---|
| Definition X.Y | {.callout-note} with ๐ Definition X.Y header |
| Theorem X.Y | {.callout-important} with Theorem X.Y header |
| Example X.Y | Example slide with . . . progressive reveals |
| Proof | Collapsible proof or separate slide if important |
| Exercise | Practice Problems section or Quiz question |
4. Add Interactive Elements
Each lecture MUST include:
- 1-2 OJS visualizations demonstrating key concepts
- 1 R case study with real financial data (use tidyquant for stock data)
- 3-4 quiz questions testing key concepts
- Practice problems adapted from chapter exercises
- 1 Think-Pair-Share activity with countdown timer
๐ Slide Layout Parameters
Slide Dimensions Reference
- Standard Revealjs: 1280ร720 pixels
- Usable content area: ~1200ร620 (after margins/headers)
Container Font Sizes
| Layout Type | Optimal Font Size | Margin Top | |โโโโ-|โโโโโโ-|โโโโ| | Dense interactive | 0.72em - 0.75em | -5px to -10px | | Standard content | 0.8em - 0.85em | 0px | | Sparse content | 0.9em - 1em | 5px |
Column Width Ratios
| Layout | Left (Controls/Text) | Right (Plot) | |โโโ|โโโโโโโ|โโโโโ| | Single plot | 20-25% | 75-80% | | Dual plots | 20% | 40% / 40% | | Text-heavy | 32-35% | 65-68% |
Plot Dimensions (for 1280ร720 slides)
| Plot Type | Small | Medium | Large | Max | |โโโโ|โโ-|โโโ|โโ-|โโ| | Single 2D | 400ร400 | 500ร500 | 600ร600 | 720ร600 | | Single 3D | 420ร380 | 500ร450 | 580ร520 | 650ร580 | | Dual plots | 380ร380 | 460ร460 | 520ร520 | - | | Contour | 600ร400 | 720ร480 | 820ร520 | 900ร580 |
Callout Box Font Sizing
| Content Density | Font Size | Use Case | |โโโโโโ|โโโโ|โโโ-| | Sparse (4 items) | 42-45px | Practice problems, summaries | | Medium (6-8 items) | 36-38px | Definitions, theorems | | Dense (10+ items) | 32-34px | Detailed examples |
Rule: If bottom 1/3 of slide is empty โ increase font by 8-10px
๐ฎ Smartboard Compatibility
Always add event propagation prevention to interactive elements:
viewof mySlider = {
const input = Inputs.range([0, 10], {value: 5, step: 0.1, label: "Parameter:"});
// Prevent slide navigation on touch/click
input.addEventListener('pointerdown', e => e.stopPropagation());
input.addEventListener('touchstart', e => e.stopPropagation());
input.addEventListener('mousedown', e => e.stopPropagation());
input.addEventListener('click', e => e.stopPropagation());
input.addEventListener('wheel', e => e.stopPropagation());
input.addEventListener('pointermove', e => e.stopPropagation());
input.addEventListener('touchmove', e => e.stopPropagation());
input.addEventListener('mousemove', e => e.stopPropagation());
return input;
}
For Plotly 3D containers:
// After creating the plot
const plotDiv = container.querySelector('.js-plotly-plot');
if (plotDiv) {
['pointerdown', 'touchstart', 'mousedown', 'click', 'wheel',
'pointermove', 'touchmove', 'mousemove'].forEach(eventType => {
plotDiv.addEventListener(eventType, e => e.stopPropagation());
});
}
๐ป R Code Visibility for Students
Best practice for teaching slides:
#| echo: true # Show code
#| code-fold: true # Collapsed by default
#| code-summary: "๐ Show Code" # Button label
#| message: false
#| warning: false
Folding Options
| Option | Behavior | |โโโ|โโโ-| | code-fold: true | Collapsed by default (click to expand) | | code-fold: show | Expanded by default (click to collapse) | | code-fold: false | Always visible, no toggle |
โฑ๏ธ Countdown Timer for Activities
Package: countdown (R package)
Basic Usage (Think-Pair-Share, Group Work)
#| echo: false
library(countdown)
countdown(minutes = 4, seconds = 0,
top = 0, right = 0, # Position: top-right corner
font_size = "1.5em",
color_running_background = "#31b09e", # Green while running
color_running_text = "white",
color_finished_background = "#cc3311", # Red when done
color_finished_text = "white",
color_warning_background = "#f7dc6f", # Yellow warning
warn_when = 60, # Warn at 60 seconds left
play_sound = TRUE) # ๐ Alarm when finished
Activity Duration Guidelines
| Activity Type | Duration | Timer Setting | |โโโโโ|โโโ-|โโโโโ| | Quick Think | 1 min | minutes = 1 | | Think-Pair-Share | 4 min | minutes = 4 | | Group Problem | 5-8 min | minutes = 5 or minutes = 8 | | Case Study | 10-15 min | minutes = 10 or minutes = 15 |
๐ค Autopilot Compile-Check-Fix Workflow
After creating each lecture, run this workflow:
CYCLE 1: Compilation Check
1. COMPILE: quarto render "file.qmd" 2>&1
2. CHECK: Analyze output for errors/warnings
3. FIX: Apply fixes based on error type
4. REPEAT: Until clean compilation
CYCLE 2: Font Size Audit (Code Analysis)
1. SCAN: grep for font-size < 30px or em < 0.75
2. SCAN: grep for {.smaller} class usage
3. FIX: Increase fonts to minimum 30px/0.75em
4. SPLIT: If slide too dense, split into multiple
CYCLE 3: Visual Check (if user provides screenshots)
1. ANALYZE: Empty space โ increase fonts
2. ANALYZE: Overflow โ split slide or reduce slightly
3. FIX: Apply adjustments
4. RECOMPILE: Verify changes
Grep Patterns for Font Audit
# Find fonts below 30px
grep -E "font-size:\s*(2[0-9]|1[0-9])px" file.qmd
# Find fonts below 0.75em
grep -E "font-size:\s*0\.[56]" file.qmd
# Find .smaller class usage
grep "{.smaller}" file.qmd
Common Quarto Errors & Fixes
| Error | Fix | |โโ-|โโ| | no package called 'X' | install.packages('X') | | object not found | Check variable scope in R chunks | | unexpected token | Check OJS syntax, missing brackets | | duplicate attribute | Merge width into style attribute | | weight= typo | Change to width= | | Overfull content | Split slide or reduce font by 2-4px | | Empty space | Increase font by 4-10px |
๐ Quick Reference Templates
Two-Column: Controls + Single Large Plot
## ๐ฎ Interactive: [Title] {.smaller}
:::::: {style="font-size: 0.72em; margin-top: -8px;"}
::::: columns
::: {.column width="25%"}
```{ojs}
// Slider controls + text panel
:::
::: {.column width=โ75%โ}
// Large plot (width: 820, height: 520)
::: ::::: ::::::
### Three-Column: Controls + 2D + 3D Plots
```markdown
## ๐ฎ Interactive: [Title] {.smaller}
:::::: {style="font-size: 0.75em; margin-top: -5px;"}
::::: columns
::: {.column width="20%"}
```{ojs}
// Controls + text
:::
::: {.column width=โ40%โ}
// 2D plot (width: 460, height: 460)
:::
::: {.column width=โ40%โ}
// 3D plot (width: 480, height: 460)
::: ::::: ::::::
### Think-Pair-Share Activity
```markdown
## ๐ค Think-Pair-Share: [Topic] {.larger}
::::: {style="font-size: 38px;"}
:::: callout-note
## ๐ญ Activity (4 minutes)
**Problem setup here**
::: columns
::: {.column width="33%"}
**๐ง Think (1 min):**
- Task 1
- Task 2
:::
::: {.column width="33%"}
**๐ซ Pair (2 min):**
- Discussion point 1
- Discussion point 2
:::
::: {.column width="33%"}
**๐ฃ๏ธ Share (1 min):**
- Synthesis question
:::
:::
::::
:::::
```{r}
#| echo: false
library(countdown)
countdown(minutes = 4, seconds = 0,
top = 0, right = 0,
font_size = "1.5em",
color_running_background = "#31b09e",
color_running_text = "white",
color_finished_background = "#cc3311",
color_finished_text = "white",
warn_when = 60,
play_sound = TRUE)
---
## File Naming
{topic}_lecture{N}.qmd ```
Examples:
multivariate_lecture1.qmdhypothesis_testing_lecture2.qmdregression_lecture1.qmd
Required Sections (in order)
- YAML frontmatter (see template above)
- Learning Objectives (5 bullet points with action verbs)
- Overview (topics covered today)
- Motivation (why this topic matters)
- Content slides (definitions, theorems, examples)
- Interactive visualization (OJS with smartboard compatibility)
- Think-Pair-Share activity (with countdown timer)
- Case Study (R with financial data, code-fold: true)
- Quizzes (3-4 questions)
- Summary (key takeaways)
- Practice Problems (4-5 problems)
- Thank You (contact info, next class)
- Questions (discussion prompts)
Slide Design Guidelines
- Use
{.smaller}class ONLY for interactive slides with controls - Use
. . .for progressive reveal in solutions - Use
{.columns}with{.column width="50%"}for side-by-side content - Use
{.fragment}for animated reveals within columns - Keep math in display mode (
$$...$$) for important equations - Use inline math (
$...$) for references within text - Always use
width=notweight=in column definitions
๐ฐ Financial & Economic Applications (CRITICAL)
ALL examples must have finance/economics context. Students are finance/econ majors and learn better with relevant applications.
Concept Transformation Table
| Mathematical Concept | Finance/Economics Application | |โโโโโโโ|โโโโโโโโโโ-| | Random variables | Asset returns, GDP growth, inflation rates | | Discrete distributions | Number of defaults, trading days, customer arrivals | | Continuous distributions | Stock prices, interest rates, exchange rates | | Joint distributions | Portfolio returns (multiple stocks) | | Independence | Diversification benefits, uncorrelated assets | | Conditional probability | Default given recession, returns given market state | | Covariance/Correlation | Portfolio risk analysis, asset co-movement | | Expected value | Expected portfolio return, fair price | | Variance | Volatility, risk measurement | | Moment generating functions | Option pricing, risk-neutral valuation | | Order statistics | Best/worst performing assets, VaR | | Sampling distributions | Estimating market parameters | | Hypothesis testing | Testing market efficiency, comparing strategies | | Regression | CAPM, factor models, forecasting |
Example Transformations
| Wackerly Example | Finance Version | |โโโโโโ|โโโโโ-| | โBalls in urnsโ | โStocks in a portfolioโ | | โDefective itemsโ | โDefaulting loansโ | | โWaiting timeโ | โTime between tradesโ | | โHeights of peopleโ | โDaily returns of S&P 500โ | | โMachine failureโ | โMarket crash probabilityโ | | โDice experimentโ | โEconomic scenarios (boom/recession/stable)โ |
Real Data Sources
- Stock tickers: AAPL, MSFT, GOOGL, AMZN, SPY, QQQ, TLT, GLD
- R packages:
quantmod,tidyquant,fredr(FRED economic data) - Economic indicators: GDP, CPI, unemployment rate, Fed funds rate
Case Study Ideas by Topic
| Chapter | Case Study | |โโโ|โโโโ| | Probability | Portfolio allocation under uncertainty | | Discrete RV | Loan default modeling | | Continuous RV | Stock return distributions | | Multivariate | Two-asset portfolio optimization | | Sampling | Estimating market beta | | Estimation | Confidence intervals for expected returns | | Hypothesis Testing | Testing CAPM, market efficiency | | Regression | Factor models, risk decomposition |
โ Quality Checklist
Before finalizing each lecture:
- YAML frontmatter complete with quiz plugin and scaling settings
- 5 clear learning objectives with action verbs
- All Wackerly definitions/theorems properly numbered
- All fonts โฅ 30pt (0.75em) - CRITICAL
- All examples have finance/economics context - CRITICAL
- Examples have progressive reveal (
. . .) - At least 1 interactive OJS visualization with smartboard compatibility
- R case study with real financial data and
code-fold: true - Think-Pair-Share activity with countdown timer
- 3-4 quiz questions with finance/econ scenarios
- Summary matches learning objectives
- Next class preview in Thank You slide
- Autopilot workflow completed (compile โ check โ fix)
- No slides with > 80 words or > 5 bullet points (split if needed)
- No abstract โballs in urnsโ type examples (transform to finance)
Reference Files
references/qmd-template.md- Complete YAML and slide templatesreferences/slide-patterns.md- Patterns for different slide types (OJS, R, quizzes)references/wackerly-chapters.md- Chapter structure, definitions, theorems, page numbersscripts/extract_wackerly.py- Python script to extract PDF contentlectures/SLIDE_OPTIMIZATION_SKILL.md- Complete optimization parameters and workflows
Last updated: February 2, 2026 Based on: Dr. Samir Orujovโs lecture format for ADA University
