| name | Create LaTeX Notes |
| description | Generate structured LaTeX exam cheat sheets from course materials. Extracts key concepts, definitions, formulas from PDFs, Jupyter notebooks, and markdown files. Compiles to PDF with error checking. |
Create LaTeX Notes
Purpose
This skill generates concise, exam-ready LaTeX cheat sheets from course materials in the src directory. It creates well-structured reference documents optimized for quick review during exams.
IMPORTANT: All generated notes MUST be in English, regardless of the language used during interaction with the user. The user studies in English and needs exam notes in English.
Instructions
1. Content Analysis
- Locate source materials: Identify all course content in the specified directory under
src/ - Process multiple formats:
.mdfiles: Extract headings, definitions, formulas, code examples.ipynbfiles: Extract markdown cells, code outputs, formulas, key visualizations.pdffiles: Extract text content, focus on definitions, theorems, formulas
- Prioritize content:
- Core concepts and definitions (always include)
- Mathematical formulas and equations (always include)
- Key algorithms and their complexity (always include)
- Important code snippets (include only the most critical examples)
- Diagrams descriptions (brief text descriptions only, no images unless space permits)
2. Structure Guidelines
Use the template from templates/template.tex as the base structure:
- 3-column layout for maximum information density
- Grouped by topic: Organize content into logical sections with topic-focused headers
- ✓ Good: "Linear Regression", "K-Means Clustering", "Decision Trees"
- ✗ Bad: "Module 2: Linear Regression", "Week 4: K-Means Clustering"
- Only include module/week numbers if user specifically requests them
- Tabular format: Use tables with
\textbf{Concept}:followed by brief explanation - Consistent formatting:
- Bold for key terms
- Math mode for formulas:
$...$for inline,$$...$$for display - Code snippets: Use
\texttt{...}for inline code or\begin{verbatim}...\end{verbatim}for blocks
Preventing Orphan Headers (title on one page, table on another):
Method 1: Use \topic command (Recommended for simple sections):
\topic{Topic Title}{
\concept{Item 1}: Description.\\
\concept{Item 2}: Description.\\
\concept{Item 3}: Description.\\
}
The \topic command keeps the title and table together as one unbreakable block.
IMPORTANT: Always end content with \\ before closing brace to ensure bottom table border renders correctly.
Method 2: Use gather* environment (For complex sections):
\needspace{4\baselineskip}
\begin{samepage}
\begin{gather*}
\textbf{Topic Title}\\[1pt]
\begin{tabular}{|p{6cm}|}
\hline
\concept{Item 1}: Description.\\
\concept{Item 2}: Description.\\
\hline
\end{tabular}
\end{gather*}
\end{samepage}
\vspace{2pt}
Use this when you need:
- Multiple tables under one heading
- Special formatting or custom spacing
- Complex mathematical content with tables
Key improvements:
\\[1pt]instead of\\[-2pt]- better spacing between title and table\needspace{4\baselineskip}- ensures minimum 4 lines available before startingsamepageenvironment - keeps content together on same page
3. Content Extraction Rules
- Language: ALL notes MUST be in English, regardless of the language used in communication
- Brevity first: Keep explanations to 1-2 lines maximum
- Formulas: Include all mathematical formulas exactly as written
- Code examples: Include only essential snippets (prefer pseudocode over full implementations)
- Definitions: Format as "Term: Brief definition"
- Avoid redundancy: Don't repeat information across sections
- No prose: Use bullet points, tables, and structured formats only
4. File Organization
- Output location: Save the generated
.texfile in the same course directory (e.g.,src/CM3010 Databases/.../cheat-sheet.tex) - Naming convention: Use descriptive names like
{course-code}-cheat-sheet.texor{topic}-notes.tex - Preserve template: Don't modify the original template file
5. Compilation Process
After generating the .tex file, compile it to PDF using the provided compilation script:
Compilation command:
bash .claude/skills/create-latex-notes/scripts/compile_latex.sh {tex_file_path}
The script automatically:
- Detects available LaTeX compiler (xelatex, pdflatex, or lualatex in order of preference)
- Creates
out/directory for auxiliary files - Runs compilation twice for proper references
- Copies final PDF to source directory
- Provides clear error messages if compilation fails
Alternative (manual compilation):
If you need to customize the compilation process, you can modify the script at:
.claude/skills/create-latex-notes/scripts/compile_latex.sh
Or compile manually:
# macOS (typical path)
/Library/TeX/texbin/xelatex -interaction=nonstopmode -output-directory=out {tex_file_path}
# Linux/other systems
xelatex -interaction=nonstopmode -output-directory=out {tex_file_path}
# or: pdflatex -interaction=nonstopmode -output-directory=out {tex_file_path}
Compilation verification:
- Check the exit code of the compilation command
- Verify the PDF file was created in the
outdirectory - If compilation fails:
- Parse the
.logfile for errors - Report the specific line number and error message
- Suggest corrections (common issues: missing packages, special characters, unescaped symbols)
- Offer to fix the
.texfile and recompile
- Parse the
- If successful, report the output PDF location
Error handling:
- No compiler found: Script provides installation instructions
- Missing packages: Suggest installation commands
- Unicode/encoding issues: Check for special characters that need escaping
- Overfull boxes: These are warnings, not errors - compilation still succeeds
- Math mode errors: Check for unmatched
$symbols
6. Quality Checklist
Before finalizing, ensure:
- All major topics from the course are covered
- Formulas are correctly formatted in math mode
- Content fits within page margins (no overflow)
- Tables are properly closed (all
\begin{}have matching\end{}) - No duplicate content across sections
- Code examples are properly escaped
- File compiles without errors
- PDF is readable at small font size
7. Content Prioritization
Focus on the most important exam-relevant content:
- Core definitions and formulas (essential)
- Key algorithms with complexity
- Critical code patterns
- Important examples (only most illustrative)
Pages will distribute automatically based on content volume. No need to calculate character counts.
8. Interaction Flow
- Identify course: Ask user which course to process if not specified
- Scan directory: List all source files found
- Extract content: Process all relevant files, prioritizing by importance
- Generate LaTeX: Create structured cheat sheet
- Save file: Write
.texfile to appropriate location - Compile: Run XeLaTeX compilation
- Verify: Check compilation success
- Report: Provide file locations and any warnings/errors
Template Structure
The template uses:
\documentclass[10pt,a4paper]{article}for compact layoutgeometrypackage with 0.5cm marginsmulticolpackage for 3-column layoutamsmath,amssymbfor mathematical notation\scriptsizefont for maximum content density
Best Practices
- Test compilation early: Generate a minimal version first, then add content
- Group related topics: Keep Week 1 content together, algorithms together, etc.
- Use consistent terminology: Match the course's terminology exactly
- Prioritize exam-relevant content: Focus on what's testable
- Include examples sparingly: Only the most illustrative examples
- Cross-reference when possible: "See Week 3 for details" to save space
- Avoid bullet points: Use
\concept{}formatting instead for better structure and readability
Common LaTeX Pitfalls
- Special characters: Escape
#,$,%,&,_,{,}with backslash - Math mode: Always use
$...$for math symbols - Line breaks in tables: Use
\\not just line breaks - Column width: Tables with
m{6cm}are already sized for 3-column layout - Page breaks: Use
\newpageto start fresh pages when sections are complete