dongzhigang13305312738-art/paper-skills / complete-example
complete-example
Verified当用户明确要求"填充示例内容""生成示例""补充 LaTeX 示例"时使用。AI 增强版 LaTeX 示例智能生成器,实现 AI 与硬编码的有机融合:AI 做"语义理解"(分析章节主题、推理资源相关性、生成连贯叙述),硬编码做"结构保护"(格式验证、哈希校验、访问控制)。
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.1 KB |
| config.yaml | config | 16.6 KB |
| references/README.md | markdown | 962 B |
| scripts/__init__.py | script | 503 B |
| scripts/advanced_usage.py | script | 5.4 KB |
| scripts/ai_content_generator.py | script | 19.6 KB |
| scripts/basic_usage.py | script | 1.3 KB |
| scripts/bibtex_parser.py | script | 5.6 KB |
| scripts/file_utils.py | script | 4.8 KB |
| scripts/format_guard.py | script | 15.5 KB |
| scripts/formula_generator.py | script | 2.1 KB |
| scripts/latex_parser.py | script | 6.2 KB |
| scripts/llm_client.py | script | 6.3 KB |
| scripts/placeholder_parser.py | script | 3.1 KB |
| scripts/resource_allocator.py | script | 10.3 KB |
| scripts/resource_scanner.py | script | 6.5 KB |
| scripts/security_manager.py | script | 17.4 KB |
| scripts/semantic_analyzer.py | script | 8.3 KB |
| scripts/skill_controller.py | script | 22.5 KB |
| scripts/table_generator.py | script | 5.8 KB |
| scripts/template_renderer.py | script | 994 B |
scripts/formula_generator.py
View on GitHub"""
FormulaGenerator - render LaTeX math blocks from formula placeholders.
We intentionally keep this deterministic: the placeholder already contains the
formula (or formulas). The generator only wraps it with the configured LaTeX
templates and performs basic label sanitization.
"""
from __future__ import annotations
from typing import Dict, Any
import re
def _sanitize_label(label: str) -> str:
label = (label or "").strip()
if not label:
return "eq:formula"
# Keep common LaTeX label characters.
label = re.sub(r"[^a-zA-Z0-9:_-]+", "-", label)
return label[:64]
class FormulaGenerator:
def __init__(self, templates: Dict[str, str]):
self.templates = templates
def inline(self, formula: str) -> str:
from .template_renderer import render_template
tmpl = self.templates.get("inline_math", "${{formula}}$")
return render_template(tmpl, {"formula": formula.strip()})
def display(self, formula: str) -> str:
from .template_renderer import render_template
tmpl = self.templates.get("display_math")
if not tmpl:
return f"\\[\n{formula.strip()}\n\\]"
return render_template(tmpl, {"formula": formula.strip()})
def equation(self, formula: str, label: str) -> str:
from .template_renderer import render_template
tmpl = self.templates.get("equation")
safe_label = _sanitize_label(label)
if not tmpl:
return f"\\begin{{equation}}\n {formula.strip()}\n \\label{{{safe_label}}}\n\\end{{equation}}"
return render_template(tmpl, {"formula": formula.strip(), "label": safe_label})
def align(self, formulas_raw: str) -> str:
from .template_renderer import render_template
tmpl = self.templates.get("align")
# Placeholder suggests using literal '\\\\' to separate lines.
parts = [p.strip() for p in re.split(r"\\\\+", formulas_raw) if p.strip()]
joined = " \\\\\n ".join(parts) if parts else formulas_raw.strip()
if not tmpl:
return f"\\begin{{align}}\n {joined}\n\\end{{align}}"
return render_template(tmpl, {"formulas": joined})
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |