- Wrap Python figures in div with fig-env, fig-pos, fig-cap, fig-alt - Remove #| label from blocks when div has #fig-xxx - Add responsive figure CSS (max-width, height: auto) for HTML - Add figure headers to Python blocks (Context, Goal, Show, How, Imports, Exports)
Harvard ML Systems Book - Academic Excellence Styling
This directory contains the sophisticated styling system for the Harvard Machine Learning Systems textbook, designed to embody academic excellence and Harvard's prestigious standards.
Design Philosophy
Academic Excellence First
This styling system prioritizes sophistication, readability, and academic gravitas over flashy web design. Every element is carefully crafted to support serious academic study while maintaining visual elegance.
Harvard Brand Integration
- Primary: Harvard Crimson (#A51C30) - Used judiciously for accents and emphasis
- Academic Palette: Carefully chosen greys and blues that convey scholarly authority
- Typography: Crimson Text serif for body text (academic tradition) + Source Sans Pro for headings (modern clarity)
Scholarly Design Principles
- Hierarchy: Clear visual hierarchy that guides academic reading
- Legibility: Optimized line heights, spacing, and contrast for extended reading
- Elegance: Subtle shadows, refined borders, and sophisticated color transitions
- Professionalism: No flashy animations or distracting elements
Architecture & Organization
The stylesheet is meticulously organized into 20 logical sections for easy maintenance:
Section Organization
1. Color Palette & Design Tokens - All colors and design constants
2. Typography System - Font families, sizes, line heights
3. Spacing & Layout System - Consistent spacing scale
4. Shadows & Elevation - Subtle depth and hierarchy
5. Component Tokens - Shared component variables
6. Foundational Styles - Base HTML elements
7. Typography Hierarchy - Heading system (h1-h6)
8. Links & Navigation - Link behaviors and styles
9. Code & Syntax Highlighting - Academic code presentation
10. Academic Callouts & Alerts - Sophisticated information boxes
11. Academic Tables - Professional data presentation
12. Figures & Images - Academic figure formatting
13. Mathematical Content - Equation and formula styling
14. Lists & Enumeration - Academic list formatting
15. Quotations & Citations - Scholarly reference styling
16. Navigation & Sidebar - Book navigation interface
17. Responsive Design - Multi-device optimization
18. Print Styles - Academic print formatting
19. Accessibility Enhancements - WCAG compliance
20. Utility Classes - Helper classes
Key Features
🎓 Academic Typography
- Body Text: Crimson Text serif (inspired by academic tradition)
- Headings: Source Sans Pro (modern clarity and hierarchy)
- Code: JetBrains Mono (programming-optimized with ligatures)
- Reading Optimization: 1.7 line height, justified text, optimal font sizes
📚 Sophisticated Content Elements
Callout Boxes
Five distinct academic callout types with refined styling:
- Note 📚: Deep blue with scholarly presentation
- Tip 💡: Forest green for helpful insights
- Important ⚡: Harvard crimson for critical information
- Warning ⚠️: Academic brown for cautions
- Caution 🚨: Red for serious warnings
Each callout features:
- Elegant header with subtle gradients
- Professional typography
- Refined shadows and borders
- Academic color scheme
Academic Tables
- Professional Headers: Gradient backgrounds with proper typography
- Subtle Interactions: Gentle hover effects
- Clear Data Presentation: Optimal spacing and alignment
- Responsive Design: Maintains elegance across devices
Scholarly Figures
- Elevated Presentation: Subtle shadows and refined borders
- Academic Captions: Properly styled with italics and emphasis
- Professional Layout: Centered with appropriate spacing
📱 Responsive Excellence
- Mobile-First: Optimized for all device sizes
- Typography Scaling: Maintains readability across breakpoints
- Touch-Friendly: Appropriate touch targets for mobile devices
- Print-Optimized: Professional print styles for academic use
♿ Accessibility Leadership
- WCAG Compliance: High contrast ratios and proper focus indicators
- Reduced Motion: Respects user motion preferences
- Keyboard Navigation: Clear focus indicators throughout
- Screen Reader: Semantic markup and proper ARIA labels
Sidebar Configuration
The textbook navigation is configured with sophisticated organization:
Main Academic Sections (Always Expanded)
- Systems Foundations
- Design Principles
- Performance Engineering
- Robust Deployment
- Trustworthy Systems
- Frontiers of ML Systems
Laboratory Sections (Collapsible)
- Hands-on Labs (overview)
- Arduino (collapsed by default)
- Seeed XIAO ESP32S3 (collapsed by default)
- Grove Vision (collapsed by default)
- Raspberry Pi (collapsed by default)
- Shared (collapsed by default)
This organization allows students to focus on academic content while providing easy access to practical lab exercises when needed.
Typography Scale
Academic Hierarchy
h1: 2.75rem // Chapter titles - command attention
h2: 2.25rem // Major sections - clear organization
h3: 1.75rem // Subsections - readable hierarchy
h4: 1.5rem // Minor headings - subtle emphasis
h5: 1.25rem // Small headings - minimal prominence
h6: 1.125rem // Inline headings - text-level emphasis
Spacing System
xs: 0.25rem // Tight spacing
sm: 0.5rem // Small spacing
md: 1rem // Base spacing
lg: 1.5rem // Large spacing
xl: 2rem // Extra large spacing
xxl: 3rem // Section spacing
xxxl: 4rem // Chapter spacing
Color Psychology
Academic Authority
- Harvard Black (#1E1E1E): Primary text, conveying authority
- Academic Dark (#2C2C2C): Body text, optimal readability
- Accent Wisdom (#1B365D): Section headers, scholarly blue
Harvard Heritage
- Harvard Crimson (#A51C30): Links, emphasis, brand connection
- Academic Medium (#5A5A5A): Secondary text, captions
Sophisticated Backgrounds
- Surface Primary (#FFFFFF): Main content areas
- Surface Elevated (#F8F9FA): Callouts and figures
- Surface Subtle (#F5F6F7): Table stripes and dividers
Browser Support
Modern Standards
- Chrome/Edge: 88+ (full support)
- Firefox: 85+ (full support)
- Safari: 14+ (full support)
- Mobile: iOS 14+, Android 10+ (optimized)
Progressive Enhancement
- CSS Grid: Layout foundation (97%+ support)
- Custom Properties: Dynamic theming (96%+ support)
- Flexbox: Component layout (99%+ support)
Performance Optimization
Efficient Loading
- Font Display Swap: Prevents layout shifts
- Optimized Gradients: GPU-accelerated where possible
- Minimal Repaints: Smooth animations that don't trigger layout
- Compressed Delivery: Optimized CSS size
Academic Print Support
- Professional Layout: Optimized for academic printing
- Monochrome Conversion: Proper grayscale fallbacks
- Page Breaks: Intelligent break points for readability
- Citation Formatting: Academic reference standards
Maintenance Guidelines
Adding New Styles
- Follow Section Organization: Add styles to appropriate sections
- Use Design Tokens: Reference existing color and spacing variables
- Maintain Hierarchy: Respect established visual patterns
- Test Accessibility: Verify WCAG compliance
- Document Changes: Update this README for significant additions
Code Quality Standards
- Consistent Naming: Use semantic, descriptive class names
- Logical Grouping: Organize related styles together
- Comment Complex Rules: Explain sophisticated techniques
- Validate Regularly: Check for CSS errors and warnings
Harvard Standards Compliance
This styling system meets Harvard University's expectations for:
✅ Academic Excellence: Sophisticated, scholarly presentation ✅ Brand Consistency: Appropriate use of Harvard identity ✅ Professional Quality: Publication-ready design standards ✅ Accessibility: Universal design principles ✅ Responsive Design: Modern multi-device support ✅ Print Quality: Academic publication standards
Integration & Build
Quarto Integration
The stylesheet integrates seamlessly with Quarto's academic publishing pipeline:
format:
html:
theme: assets/styles/style.scss
Development Workflow
- Local Testing: Use
quarto previewfor development - Cross-Device Testing: Verify across multiple screen sizes
- Print Testing: Check print layouts regularly
- Accessibility Testing: Use screen readers and keyboard navigation
- Performance Monitoring: Monitor CSS size and loading times
Contributing
When enhancing the styling system:
Quality Standards
- Maintain Harvard's academic excellence standards
- Ensure changes enhance readability and scholarship
- Test thoroughly across devices and browsers
- Preserve accessibility features
- Document significant changes
Review Process
- Academic Review: Does it enhance scholarly presentation?
- Accessibility Review: Does it maintain WCAG compliance?
- Brand Review: Is it consistent with Harvard identity?
- Technical Review: Is the code well-organized and maintainable?
- User Testing: Does it improve the academic reading experience?
This styling system represents a commitment to academic excellence, ensuring that the Harvard ML Systems textbook maintains the highest standards of scholarly presentation while embracing modern web technologies.