agent coding skill risk: low
LaTeX Academic Paper Format Converter
This prompt defines a skill that automates conversion of a LaTeX paper from one publisher template to another by extracting content via regex, generating an injection script, apply…
SKILL 1 file
SKILL.md
---
name: latex-paper-conversion
description: "This skill should be used when the user asks to convert an academic paper in LaTeX from one format (e.g., Springer, IPOL) to another format (e.g., MDPI, IEEE, Nature). It automates extraction, injection, fixing formatting, and compiling."
---
# LaTeX Paper Conversion
## Overview
This skill automates the tedious and recurring process of converting an academic paper written in LaTeX from one publisher's template to another. Different journals (e.g., Springer, MDPI, IEEE) have vastly different structural requirements, document classes, margin settings, and bibliography styles. This skill streamlines these conversions by executing a structured multi-stage workflow, extracting content, mapping it to a new template, and resolving common compilation errors.
## When to Use This Skill
- Use when the user requests to port an existing LaTeX paper to a new journal's format.
- Use when the user provides an existing `.tex` file and a new template directory.
- Use when the user mentions converting from format A (e.g., IPOL/Neural Processing) to format B (e.g., MDPI).
## How It Works
### Step 1: Pre-requisites & Assessment
Identify the **Source LaTeX file** and asking the user for the **Target Template Directory**. Understand the core layout mapping (single-column vs. double-column, bibliography style).
### Step 2: Extraction & Injection Script Generation
Create a Python script (e.g., `convert_format.py`) to parse the source LaTeX file. Use Regular Expressions to extract core text blocks. Merge the new template's `preamble`, the extracted `body`, and the `backmatter`. Write this to a new file in an output directory.
### Step 3: Systematic Fixing
Perform generic fixes on the extracted body text before writing the final file, or in subsequent calls:
- Convert math environment cases (e.g., `\begin{theorem}` to `\begin{Theorem}`).
- Adjust aggressive float placements (e.g., `[!t]` or `[h!]`) to template-supported options. Avoid forcing `[H]` unless the `float` package is explicitly loaded.
- Ensure `\includegraphics` paths are relative to the new `.tex` file location.
- Convert `\begin{tabular}` to `\begin{tabularx}{\textwidth}` or use `\resizebox` if moving to a double-column layout.
### Step 4: Compilation & Debugging
Run a build cycle (`pdflatex` -> `bibtex` -> `pdflatex`). Check the `.log` file using `grep` or `rg` to systematically fix any packages conflicts, undefined commands, or compilation halts.
## Examples
### Example 1: Converting IPOL to MDPI
\```
USER: "I need to convert my paper 'SAHQR_Paper.tex' to the MDPI format located in the 'MDPI_template_ACS' folder."
AGENT: *Triggers latex-paper-conversion skill*
1. Analyzes source `.tex` and target `template.tex`.
2. Creates Python script to extract Introduction through Conclusion.
3. Injects content into MDPI template.
4. Updates image paths and table float parameters `[h!]` to `[H]`.
5. Compiles via pdflatex and bibtex to confirm zero errors.
\```
## Best Practices
- ✅ Always write a Python extraction script; DO NOT manually copy-paste thousands of lines of LaTeX.
- ✅ Always run `pdflatex` and verify the `.log` to ensure the final output compiles.
- ✅ Explicitly ask the user for the structural mapping if the source and target differ drastically (e.g., merging abstract and keywords).
- ❌ Don't assume all math packages automatically exist in the new template (e.g., add `\usepackage{amsmath}` if missing).
## Common Pitfalls
- **Problem:** Overfull hboxes in tables when moving from single to double column.
**Solution:** Detect `\begin{tabular}` and automatically wrap in `\resizebox{\columnwidth}{!}{...}` or suggest a format change.
- **Problem:** Undefined control sequence errors during compilation.
**Solution:** Search the `Paper.log` and include the missing `\usepackage{}` in the converted template.
## Additional Resources
- [Overleaf LaTeX Documentation](https://www.overleaf.com/learn)
## Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
REQUIRED CONTEXT
- source latex file
- target template directory
OPTIONAL CONTEXT
- structural mapping between formats
TOOLS REQUIRED
- code_execution
ROLES & RULES
- Always write a Python extraction script; DO NOT manually copy-paste thousands of lines of LaTeX.
- Always run `pdflatex` and verify the `.log` to ensure the final output compiles.
- Explicitly ask the user for the structural mapping if the source and target differ drastically.
- Don't assume all math packages automatically exist in the new template.
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
EXPECTED OUTPUT
- Format
- code
- Constraints
-
- always generate a Python extraction script instead of manual copy-paste
- run pdflatex/bibtex and inspect .log for errors
- apply generic fixes for math environments, floats, includes, and tables
SUCCESS CRITERIA
- Identify source LaTeX file and target template directory.
- Create Python script to extract and inject content.
- Perform systematic fixes for math, floats, images and tables.
- Run build cycle and verify zero errors in log file.
FAILURE MODES
- Overfull hboxes in tables when moving from single to double column.
- Undefined control sequence errors during compilation.
EXAMPLES
Includes one example of converting IPOL to MDPI showing a user query and the triggered agent steps.
CAVEATS
- Dependencies
-
- Source LaTeX file
- Target Template Directory
- Ambiguities
-
- Step 1 phrasing mixes identification with 'asking the user' without clear sequencing or decision points.
QUALITY
- OVERALL
- 0.78
- CLARITY
- 0.85
- SPECIFICITY
- 0.75
- REUSABILITY
- 0.70
- COMPLETENESS
- 0.80
IMPROVEMENT SUGGESTIONS
- Add explicit input/output variable names or placeholders (e.g., SOURCE_TEX, TARGET_DIR) to improve reusability as a template.
- Make the Python script generation step more prescriptive by listing required regex patterns or extraction functions.
USAGE
Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.
MORE FOR AGENT
- Rapid App MVP Prototyper agent coding
- AI-First Design Handoff Specs Generator agent coding
- Test-Driven Development Workflow Rules agent coding
- Structured Autonomy Implementation Agent agent coding
- PROGRESS.md Manager for Agentic Coding agent coding
- Hard Bug Diagnosis Discipline agent coding
- Git Development Branch Finisher agent coding
- Code Review Feedback Reception Protocol agent coding
- Systematic Debugging Process Guide agent coding
- Matplotlib Python Plotting Guide agent coding
- LaTeX Paper PDF Compiler agent coding
- Full Output Enforcement for Code Generation agent coding
- PyTorch Geometric GNN Implementation Guide agent coding
- Premium React UI Design Architect agent coding
- Astropy Python Astronomy Library Guide agent coding
- Book SFT Style Transfer Pipeline agent coding
- Event Sourcing and CQRS Architect agent coding
- FluidSim Python CFD Simulation Guide agent coding
- NetworkX Python Graph Analysis Toolkit agent coding
- Phase-Gated Debugging Protocol Enforcer agent coding
- SimPy Discrete-Event Simulation Guide agent coding
- Phase-Gated Code Debugging Protocol agent coding
- Biopython Molecular Biology Toolkit Guide agent coding
- Haskell Advanced Type Systems Expert agent coding
- Anime.js Complex Animation Workflow agent coding