AGENT SKILL

latex-scientific-paper

Compile-ready LaTeX papers: equations, tables, bibliography.

License 许可
MIT
最近更新
2026-08-16
Stars
★ 0
Forks
0

01 前言 Front Matter

name
latex-scientific-paper
title
LaTeX Scientific Paper Authoring
author
Hermes
license
MIT
version
1.0.0
metadata
{ "hermes": { "tags": [ "LaTeX", "Scientific Papers", "Academic Writing", "PDF", "Compilation", "Bibliography" ], "category": "software-development", "related_skills": [ "research-paper-writing" ], "requires_toolsets": [ "terminal", "files" ] } }
platforms
[ "linux", "macos" ]
description
Compile-ready LaTeX papers: equations, tables, bibliography.
dependencies
[ "texlive-latex-base" ]

02 资源文件 3

03 SKILL.md 正文

LaTeX Scientific Paper Authoring

End-to-end workflow for writing compile-ready LaTeX scientific papers. Covers document structure, package selection, equation formatting, table construction, bibliography management, and multi-pass compilation.

When to Use

  • User requests a LaTeX paper, manuscript, or thesis chapter
  • User needs help with LaTeX compilation errors or package issues
  • User wants to convert project data/results into a formatted academic paper
  • Any task involving .tex files, scientific formatting, or PDF generation from LaTeX

Package Selection (Minimal TeX Live)

On systems with texlive-latex-base only (no texlive-latex-extra), these packages are available:

Available (safe to use): amsmath, amssymb, graphicx, hyperref, natbib, url, xcolor, caption, subcaption, float, enumitem, listings, booktabs, geometry, inputenc, fontenc

NOT available (omit or find alternatives):

  • amscls — only needed for amsart/amsbook classes, not article
  • siunitx — not in base; avoid \si{} commands, write units inline
  • microtype — causes font expansion errors without scalable fonts installed; comment out
  • tikz, pgfplots — not in base; use figure placeholders instead
  • biblatex — use natbib + thebibliography environment instead

If unsure what's installed, run:

find /usr/share/texlive -name "packagename.sty" 2>/dev/null

Compilation Workflow

LaTeX requires multiple passes to resolve cross-references:

# Pass 1: Initial compilation, generates .aux with references
pdflatex -interaction=nonstopmode paper.tex

# Pass 2: Resolve cross-references and citations
pdflatex -interaction=nonstopmode paper.tex

# Pass 3 (optional): Ensure all references stable
pdflatex -interaction=nonstopmode paper.tex

Common Errors and Fixes

Error Cause Fix
File 'X.sty' not found Package not installed Remove \usepackage{X} if not critical; install with apt-get install texlive-latex-extra
font expansion microtype without scalable fonts Remove \usepackage{microtype}
undefined citation Missing \bibitem Add matching entry to thebibliography
Label(s) may have changed Cross-refs not settled Run pdflatex again (2-3 passes total)
hyperref Unicode warning Special chars in bookmark strings Harmless; can suppress with \texorpdfstring

Verification

After final pass, check for:

  • Output written on X.pdf (N pages, ...) — success
  • No undefined warnings for citations or labels
  • hyperref Unicode warnings are harmless (bookmark string issue only)

Key Patterns

Equation Numbering

\begin{equation}
  E = mc^2 \label{eq:energy}
\end{equation}
Reference: Eq.~\ref{eq:energy}

Professional Tables

\begin{table}[H]
  \centering
  \caption{Results summary.}
  \label{tab:results}
  \begin{tabular}{@{}lrr@{}}
    \toprule
    \textbf{Item} & \textbf{Value A} & \textbf{Value B} \\
    \midrule
    Row 1 & 1.23 & 4.56 \\
    \bottomrule
  \end{tabular}
\end{table}

Figure Placeholders (when no images available)

\begin{figure}[H]
  \centering
  \fbox{\parbox{0.85\textwidth}{\centering\vspace{3cm}
    \textit{Figure placeholder:} Description here.\vspace{3cm}}}
  \caption{Figure caption.}
  \label{fig:example}
\end{figure}

Bibliography (portable, no external tools needed)

\begin{thebibliography}{99}
\bibitem[Author(Year)]{key} Author, A. Title. Journal, vol, pages, year.
\end{thebibliography}

Pitfalls

  1. Do not use amscls with article class — it's for amsart/amsbook only
  2. Always compile twice — single pass leaves ?? for references
  3. Use thebibliography over biblatex on minimal installs — no bibtex/biber needed
  4. [H] float placement requires the float package — otherwise use [htbp]
  5. nonstopmode prevents interactive prompts — essential for automated compilation
  6. Figure \\includegraphics needs actual image files — use \\fbox{\\parbox} placeholders when images don't exist yet
  7. No LaTeX compiler available — When pdflatex isn't installed and sudo apt-get install fails (no password, CI environment, WSL), use Python's reportlab library to generate PDFs directly from the paper content. pip install reportlab works without system-level access. The reportlab approach uses SimpleDocTemplate, Paragraph with HTML-like styling, and Table for data tables. It won't produce identical output to pdflatex (no native math rendering, no BibTeX), but it produces professional 10-15 page papers with proper headers, tables, and formatted text. Write the .tex file first (for future compilation when a compiler is available), then generate the PDF via reportlab as a fallback.

04 同仓库更多 Skills