Claude-skill-registry latex-manual
Comprehensive LaTeX reference with commands, templates, and troubleshooting for document typesetting
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/latex-manual" ~/.claude/skills/majiayu000-claude-skill-registry-latex-manual && rm -rf "$T"
skills/data/latex-manual/SKILL.mdLaTeX Skill
Comprehensive assistance with LaTeX document preparation, typesetting, and formatting. This skill provides quick references, templates, and troubleshooting for academic papers, presentations, reports, and technical documents.
When to Use This Skill
This skill should be triggered when:
- Writing LaTeX documents (papers, theses, reports)
- Creating mathematical equations and formulas
- Formatting scientific or academic documents
- Making presentations with Beamer
- Debugging LaTeX compilation errors
- Creating tables, figures, or bibliographies
- Asking about LaTeX commands or syntax
- Converting documents to LaTeX format
- Setting up document structure or layout
- Troubleshooting LaTeX warnings or errors
Quick Reference
Essential Document Structure
\documentclass{article} % or book, report, beamer \usepackage{graphicx} % For images \usepackage{amsmath} % For math \usepackage{hyperref} % For hyperlinks \title{Document Title} \author{Author Name} \date{\today} \begin{document} \maketitle \section{Introduction} Your content here. \subsection{Background} More content. \section{Conclusion} Final thoughts. \end{document}
Common Commands
Text Formatting:
- Bold\textbf{bold text}
- Italic\textit{italic text}
- Underline\underline{underlined}
- Typewriter font\texttt{monospace}
- Emphasis (usually italic)\emph{emphasized}
Document Structure:
- Section heading\section{Title}
- Subsection\subsection{Title}
- Sub-subsection\subsubsection{Title}
- Paragraph heading\paragraph{Title}
- Label for cross-reference\label{sec:intro}
- Reference to label\ref{sec:intro}
Lists:
% Bulleted list \begin{itemize} \item First item \item Second item \end{itemize} % Numbered list \begin{enumerate} \item First item \item Second item \end{enumerate} % Description list \begin{description} \item[Term] Definition \item[Another] Explanation \end{description}
Math Mode:
- Inline:
$x^2 + y^2 = z^2$ - Display:
$$E = mc^2$$ - Numbered equation:
\begin{equation} \int_0^1 f(x)dx = F(1) - F(0) \label{eq:ftc} \end{equation}
Tables:
\begin{table}[h] \centering \begin{tabular}{|c|c|c|} \hline Header 1 & Header 2 & Header 3 \\ \hline Data 1 & Data 2 & Data 3 \\ Data 4 & Data 5 & Data 6 \\ \hline \end{tabular} \caption{Table caption} \label{tab:example} \end{table}
Figures:
\begin{figure}[h] \centering \includegraphics[width=0.8\textwidth]{image.pdf} \caption{Figure caption} \label{fig:example} \end{figure}
Cross-References:
- Reference sectionSee Section~\ref{sec:intro}
- Reference figureAs shown in Figure~\ref{fig:example}
- Reference equation (with parentheses)Equation~\eqref{eq:ftc}
Citations:
% In preamble \usepackage{natbib} \bibliographystyle{plain} % In text According to~\cite{author2024}... Multiple citations~\cite{author2024,smith2023}... % At end of document \bibliography{references} % references.bib file
Common Packages
Essential:
- Advanced mathematicsamsmath
- Include graphicsgraphicx
- Clickable links and URLshyperref
- Page layoutgeometry
- Custom headers/footersfancyhdr
Text and Fonts:
- Font encodingfontenc
- Input encoding (UTF-8)inputenc
- Language supportbabel
- Typography improvementsmicrotype
Tables and Lists:
- Professional tablesbooktabs
- Multi-page tableslongtable
- Customizable listsenumitem
Graphics:
- Programmatic graphicstikz
- Data plotspgfplots
- Subfiguressubfig
Bibliography:
- Citations and bibliographynatbib
- Modern bibliography systembiblatex
Code Listings:
- Source code formattinglistings
- Syntax highlighting (requires Python)minted
Advanced Graphics and Diagrams:
- Create diagrams, flowcharts, and complex graphics programmaticallytikz
- Publication-quality data plots and chartspgfplots
- Circuit diagramscircuitikz
- Chemical structure diagramschemfig
Algorithms and Pseudocode:
- Algorithm formattingalgorithm2e
- Pseudocodealgorithmic
- Enhanced pseudocodealgorithmicx
Advanced Math:
- Extensions to amsmathmathtools
- Physics notation shortcutsphysics
- SI unit formattingsiunitx
Advanced Patterns
TikZ Diagrams
\usepackage{tikz} \usetikzlibrary{shapes,arrows,positioning} \begin{tikzpicture}[node distance=2cm] % Define nodes \node (start) [circle, draw] {Start}; \node (process) [rectangle, draw, right of=start] {Process}; \node (end) [circle, draw, right of=process] {End}; % Draw arrows \draw [->] (start) -- (process); \draw [->] (process) -- (end); \end{tikzpicture}
Data Plots with PGFPlots
\usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{tikzpicture} \begin{axis}[ xlabel=$x$, ylabel=$f(x)$, legend pos=north west ] \addplot[blue, thick] {x^2}; \addplot[red, dashed] {2*x}; \legend{$x^2$, $2x$} \end{axis} \end{tikzpicture}
Algorithm Formatting
\usepackage{algorithm2e} \begin{algorithm}[H] \SetAlgoLined \KwData{Input data} \KwResult{Output result} initialization\; \While{condition}{ process data\; \If{condition}{ do something\; } } \caption{Algorithm Description} \end{algorithm}
Beamer Presentations
\documentclass{beamer} \usetheme{Madrid} % or Berlin, Copenhagen, etc. \usecolortheme{beaver} \title{Presentation Title} \author{Your Name} \date{\today} \begin{document} \frame{\titlepage} \begin{frame}{Outline} \tableofcontents \end{frame} \section{Introduction} \begin{frame}{Introduction} \begin{itemize} \item<1-> First point (appears first) \item<2-> Second point (appears second) \item<3-> Third point (appears third) \end{itemize} \end{frame} \begin{frame}[fragile]{Code Example} \begin{lstlisting}[language=Python] def hello_world(): print("Hello, World!") \end{lstlisting} \end{frame} \end{document}
SI Units with siunitx
\usepackage{siunitx} % Numbers with units \SI{3.14e8}{\meter\per\second} % 3.14×10⁸ m/s \SI{25}{\celsius} % 25 °C \SI{9.81}{\meter\per\second\squared} % Tables with aligned decimals \begin{tabular}{S[table-format=2.3]} \toprule {Value} \\ \midrule 1.234 \\ 12.567 \\ 0.001 \\ \bottomrule \end{tabular}
Subfigures
\usepackage{subcaption} \begin{figure}[htbp] \centering \begin{subfigure}[b]{0.45\textwidth} \includegraphics[width=\textwidth]{image1.pdf} \caption{First subfigure} \label{fig:sub1} \end{subfigure} \hfill \begin{subfigure}[b]{0.45\textwidth} \includegraphics[width=\textwidth]{image2.pdf} \caption{Second subfigure} \label{fig:sub2} \end{subfigure} \caption{Overall caption} \label{fig:main} \end{figure}
Performance Tips for Large Documents
Speed Up Compilation
- Use
to compile only specific chapters\includeonly{chapter1} - Draft mode:
(skips images)\documentclass[draft]{article} - Use
for smart recompilationlatexmk - Split large documents with
\include{chapter1}
Memory Management
- For large bibliographies: use
with backend=biberbiblatex - Reduce figure resolution in draft mode
- Use
for smaller files,\input
for chapters\include - Clear auxiliary files regularly
Package Load Order
Critical order to avoid conflicts:
\usepackage[utf8]{inputenc} % First \usepackage[T1]{fontenc} % Second \usepackage{babel} % Third \usepackage{amsmath} % Before hyperref \usepackage{graphicx} % Before hyperref \usepackage{cleveref} % After hyperref \usepackage{hyperref} % Near end \usepackage{bookmark} % After hyperref
Reference Files
This skill includes comprehensive documentation in
references/:
- quick-start.md - Getting started with LaTeX
- mathematics.md - Math mode, equations, symbols
- formatting.md - Text formatting, fonts, spacing
- tables-graphics.md - Tables, figures, images
- bibliography.md - Citations and bibliography management
- troubleshooting.md - Common errors and solutions
Templates
Ready-to-use templates in
assets/:
- article-template.tex - Basic article/paper
- report-template.tex - Report with chapters
- beamer-template.tex - Presentation slides
- letter-template.tex - Formal letter
- ieee-paper-template.tex - IEEE conference paper format
Scripts
Helper scripts in
scripts/:
- compile.sh - Compile LaTeX document
- clean.sh - Remove auxiliary files
- bibtex.sh - Run complete BibTeX workflow
Common Patterns
Two-Column Layout
\documentclass[twocolumn]{article} % or \usepackage{multicol} \begin{multicols}{2} Content in two columns \end{multicols}
Custom Page Margins
\usepackage{geometry} \geometry{ a4paper, left=1in, right=1in, top=1in, bottom=1in }
Custom Headers and Footers
\usepackage{fancyhdr} \pagestyle{fancy} \fancyhead[L]{Left Header} \fancyhead[C]{Center Header} \fancyhead[R]{Right Header} \fancyfoot[C]{\thepage}
Including Code
\usepackage{listings} \lstset{ language=Python, basicstyle=\ttfamily, numbers=left, frame=single } \begin{lstlisting} def hello(): print("Hello, World!") \end{lstlisting}
Multiple Authors
\author{ First Author\thanks{University A} \and Second Author\thanks{University B} \and Third Author\thanks{University C} }
Compilation Workflow
Standard:
pdflatex document.tex pdflatex document.tex # Run twice for references
With Bibliography:
pdflatex document.tex bibtex document pdflatex document.tex pdflatex document.tex
Modern (latexmk):
latexmk -pdf document.tex # Handles all compilation steps
Troubleshooting Quick Tips
Undefined control sequence:
- Missing package (add
)\usepackage{...} - Typo in command name
- Missing math mode delimiter
- Command from newer package version
Missing $ inserted:
- Math symbols used outside math mode
- Add
or$...$
around math\(...\) - Underscore
or caret_
outside math mode^
File not found:
- Check file path and extension
- Use relative paths or place in same directory
- For images, ensure file extension is specified
- Check for spaces in filenames (use
package)grffile
Overfull \hbox:
- Line too wide to fit
- Add
or break long URLs with\sloppy\url{} - Use
or rephrase text\linebreak - For tables: reduce font size or use
\resizebox
Undefined references:
- Run LaTeX twice (first pass creates labels, second resolves)
- Check label names match
commands\ref{...} - Ensure
appears after\label{}\caption{}
Package clash / Option clash:
- Packages loaded multiple times with different options
- Load package once with all options:
\usepackage[opt1,opt2]{pkg} - Some packages must load in specific order (see Package Load Order)
! LaTeX Error: Environment ... undefined:
- Missing package that defines the environment
- Typo in environment name
- Package not installed (install from CTAN)
Dimension too large:
- TikZ/PGF coordinates too large
- Use smaller units or scale down
- Increase TeX's dimension limit (rare)
! Missing number, treated as zero:
- Usually in tabular/array environments
- Check for missing
or&\\ - Verify column specifications match content
! Paragraph ended before ... was complete:
- Missing closing brace
} - Command argument spans multiple paragraphs (add
)\long - Check for balanced delimiters
Best Practices
Document Organization
- Always compile twice after adding labels/references
- Use meaningful labels:
not\label{sec:intro}\label{s1} - Keep figures in subfolder:
figures/image.pdf - Use vector graphics (PDF, EPS) when possible
- Separate bibliography into
file.bib - Split large documents: Use
for chapters\include{chapter1}
Code Quality
- Version control your
files (Git recommended).tex - Comment your code:
% This explains the code - Use packages sparingly: Only include what you need
- Consistent formatting: Choose one citation style
- Test compilation early and often
- UTF-8 encoding: Always use
\usepackage[utf8]{inputenc}
Modern LaTeX Recommendations
- Use
for smart references:cleveref
→ "Figure 3"\cref{fig:plot} - Use
for professional tables (no vertical lines)booktabs - Use
instead ofbiblatex
for new projectsnatbib - Use
for subtle typography improvementsmicrotype - Use
or\autoref
instead of manual "Figure~\ref{}"\cref - Load
near the end of preamble (excepthyperref
,cleveref
)bookmark
Performance and Efficiency
- Use
for automated compilationlatexmk - Enable draft mode during editing:
\documentclass[draft]{article} - Use
to compile only changed chapters\includeonly{} - Clean auxiliary files regularly to prevent stale references
Resources
Online Documentation
- LaTeX Wikibook: https://en.wikibooks.org/wiki/LaTeX
- Overleaf Learn: https://www.overleaf.com/learn
- CTAN (packages): https://ctan.org
- TeX Stack Exchange: https://tex.stackexchange.com
Reference Files
See
references/ directory for detailed guides on:
- Quick start and basics
- Mathematical typesetting
- Text formatting and fonts
- Tables and graphics
- Bibliography management
- Troubleshooting common errors
Templates
See
assets/ directory for ready-to-use templates:
- Academic papers
- Technical reports
- Presentations
- Letters
- Conference papers
Version History
-
1.1.0 (2026-01-01): Enhanced with advanced LaTeX patterns
- Added TikZ diagram examples
- Added PGFPlots for data visualization
- Added algorithm formatting examples
- Added Beamer presentation patterns
- Added siunitx for SI units
- Added subfigure examples
- Enhanced troubleshooting (10 new error scenarios)
- Added performance tips for large documents
- Added package load order guidelines
- Expanded best practices (22 items, organized by category)
- Added advanced packages section (graphics, algorithms, math)
-
1.0.0 (2025-12-31): Initial manual creation
- Comprehensive command reference
- 5 document templates
- Troubleshooting guide
- Compilation scripts
Contributing
To enhance this skill:
- Add new templates to
assets/ - Expand reference guides in
references/ - Update SKILL.md quick reference
- Add helper scripts to
scripts/ - Document common patterns and solutions
Created: Manually curated LaTeX skill Status: Production Ready Version: 1.1.0 Last Updated: 2026-01-01 Enhancement: Manual enhancement with advanced patterns and examples