brycewang-stanford/Auto-Empirical-Research-Skills / skills/35-bahayonghang-academic-writing-skills/skills/latex-paper-en
latex-paper-en
VerifiedEnglish LaTeX academic paper assistant for existing `.tex` projects. Use this skill whenever the user wants to compile, lint, audit, or improve an English LaTeX conference or journal paper such as IEEE, ACM, Springer, NeurIPS, or ICML submissions. Trigger even when the user only mentions one paper issue, such as bibliography errors, grammar cleanup, sentence splitting, logic review, expression polishing, translation, title optimization, figure checks, pseudocode review, algorithm block cleanup, de-AI editing, experiment-section review, table structure validation, three-line table generation, abstract structure diagnosis, or journal adaptation. Also trigger for "proofread my paper", "fix my LaTeX", "prepare for submission", "check my manuscript", "improve my writing", "three-line table", "booktabs", "check abstract", "reformat for another journal", "换投", `algorithm2e`, `algorithmicx`, `algpseudocodex`, `Require/Ensure`, or "Algorithm 1" when the user has a .tex file.
scripts/extract_prose.py
View on GitHub#!/usr/bin/env python3
"""
Prose Extractor - Extract plain text from LaTeX/Typst for analysis
Usage:
uv run python -B extract_prose.py main.tex
uv run python -B extract_prose.py main.tex --keep-structure
uv run python -B extract_prose.py main.tex --output prose.txt
uv run python -B extract_prose.py main.tex --keep-structure
"""
import argparse
import sys
from pathlib import Path
# Import local parsers
try:
from parsers import get_parser
except ImportError:
# Handle running from root directory
sys.path.append(str(Path(__file__).parent))
from parsers import get_parser
class ProseExtractor:
"""Wrapper for document parsing."""
def __init__(self, file_path: str):
self.file_path = Path(file_path).resolve()
self.parser = get_parser(self.file_path)
def extract(self, keep_structure: bool = False) -> str:
"""Extract prose from file."""
try:
content = self.file_path.read_text(encoding="utf-8", errors="ignore")
except Exception as e:
raise RuntimeError(f"Cannot read file: {e}") from e
return self.parser.clean_text(content, keep_structure)
def extract_sentences(self) -> list[str]:
"""Extract individual sentences."""
text = self.extract(keep_structure=False)
# Simple split, consistent with original implementation
import re
sentences = re.split(r"(?<=[.!?])\s+", text)
return [s.strip() for s in sentences if s.strip()]
def main():
parser = argparse.ArgumentParser(description="Prose Extractor (LaTeX/Typst)")
parser.add_argument("file", help="File to extract from (.tex or .typ)")
parser.add_argument("--output", "-o", help="Output file (default: stdout)")
parser.add_argument(
"--keep-structure",
"-k",
action="store_true",
help="Preserve paragraph and section structure",
)
parser.add_argument(
"--sentences", "-s", action="store_true", help="Output as list of sentences"
)
args = parser.parse_args()
if not Path(args.file).exists():
print(f"[ERROR] File not found: {args.file}", file=sys.stderr)
sys.exit(1)
extractor = ProseExtractor(args.file)
try:
if args.sentences:
sentences = extractor.extract_sentences()
output = "\n".join(f"{i + 1}. {s}" for i, s in enumerate(sentences))
else:
output = extractor.extract(keep_structure=args.keep_structure)
except Exception as e:
print(f"[ERROR] {e}", file=sys.stderr)
sys.exit(1)
if args.output:
Path(args.output).write_text(output, encoding="utf-8")
print(f"[SUCCESS] Extracted prose written to {args.output}")
else:
print(output)
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |