K-Dense-AI/scientific-agent-skills / skills/venue-templates
venue-templates
VerifiedPrepares journal manuscripts, conference papers, research posters, and grant documents using venue-specific formatting guidance and bundled LaTeX scaffolds. Supports selecting an official template, checking current page or anonymity rules, adapting academic writing to a venue, or inspecting a submission PDF.
scripts/customize_template.py
View on GitHub#!/usr/bin/env python3
"""
Customize Template Script
Customize LaTeX templates with author information and project details.
Usage:
python customize_template.py --template nature_article.tex --output my_paper.tex
python customize_template.py --template nature_article.tex --title "My Research" --output my_paper.tex
python customize_template.py --interactive
"""
import argparse
import re
from pathlib import Path
def get_skill_path():
"""Get the path to the venue-templates skill directory."""
script_dir = Path(__file__).parent
skill_dir = script_dir.parent
return skill_dir
def find_template(template_name):
"""Find template file in assets directory."""
if Path(template_name).name != template_name or not template_name.endswith('.tex'):
return None
skill_path = get_skill_path()
assets_path = skill_path / "assets"
# Search in all subdirectories
for subdir in ["journals", "posters", "grants"]:
template_path = assets_path / subdir / template_name
if template_path.is_file():
return template_path
return None
def customize_template(template_path, output_path, **kwargs):
"""Customize a template with provided information."""
# Read template
with open(template_path, 'r', encoding='utf-8') as f:
content = f.read()
# Replace placeholders
replacements = {
'title': (
[r'Insert Your Title Here[^}]*', r'Your [^}]*Title[^}]*Here[^}]*',
r'Your Paper Title: Concise and Descriptive \\\\ \(Maximum Two Lines\)'],
kwargs.get('title', '')
),
'authors': (
[re.escape(r'First Author\textsuperscript{1}, Second Author\textsuperscript{1,2}, Third Author\textsuperscript{2,*}'),
re.escape(r'First Author\inst{1}, Second Author\inst{1,2}, Third Author\inst{2}')],
kwargs.get('authors', '')
),
'affiliations': (
[r'Department Name, Institution Name, City, State[^\\}\n]*',
r'Department of [^,}\n]*, University Name[^\\}\n]*'],
kwargs.get('affiliations', '')
),
'email': (
[r'first\.author@university\.edu',
r'\[email protected\]'],
kwargs.get('email', '')
)
}
# Apply replacements
modified = False
for key, (patterns, replacement) in replacements.items():
if replacement:
for pattern in patterns:
if re.search(pattern, content):
# A function replacement preserves literal LaTeX backslashes;
# a replacement string would interpret \1, \t, or \n.
content = re.sub(pattern, lambda _match: replacement, content, count=1)
modified = True
print(f"[OK] Replaced {key}")
break
# Write output
with open(output_path, 'w', encoding='utf-8') as f:
f.write(content)
if modified:
print(f"\n[OK] Customized template saved to: {output_path}")
else:
print(f"\n[WARN] Template copied to: {output_path}")
print(" No customizations applied (no matching placeholders found or no values provided)")
print(f"\nNext steps:")
print(f"1. Open {output_path} in your LaTeX editor")
print(f"2. Replace remaining placeholders")
print(f"3. Add your content")
print(f"4. Compile with pdflatex or your preferred LaTeX compiler")
def interactive_mode():
"""Run in interactive mode."""
print("\n=== Template Customization (Interactive Mode) ===\n")
# List available templates
skill_path = get_skill_path()
assets_path = skill_path / "assets"
print("Available templates:\n")
templates = []
for i, subdir in enumerate(["journals", "posters", "grants"], 1):
subdir_path = assets_path / subdir
if subdir_path.exists():
print(f"{subdir.upper()}:")
for j, template_file in enumerate(sorted(subdir_path.glob("*.tex")), 1):
templates.append(template_file)
print(f" {len(templates)}. {template_file.name}")
print()
# Select template
while True:
try:
choice = int(input(f"Select template (1-{len(templates)}): "))
if 1 <= choice <= len(templates):
template_path = templates[choice - 1]
break
else:
print(f"Please enter a number between 1 and {len(templates)}")
except ValueError:
print("Please enter a valid number")
print(f"\nSelected: {template_path.name}\n")
# Get customization info
title = input("Paper title (press Enter to skip): ").strip()
authors = input("Authors (e.g., 'John Doe, Jane Smith') (press Enter to skip): ").strip()
affiliations = input("Affiliations (press Enter to skip): ").strip()
email = input("Corresponding email (press Enter to skip): ").strip()
# Output file
default_output = f"my_{template_path.stem}.tex"
output = input(f"Output filename [{default_output}]: ").strip()
if not output:
output = default_output
output_path = Path(output)
# Customize
print()
customize_template(
template_path,
output_path,
title=title,
authors=authors,
affiliations=affiliations,
email=email
)
def main():
parser = argparse.ArgumentParser(
description="Customize LaTeX templates with author and project information",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Examples:
%(prog)s --interactive
%(prog)s --template nature_article.tex --output my_paper.tex
%(prog)s --template neurips_article.tex --title "My ML Research" --output my_neurips.tex
"""
)
parser.add_argument('--template', type=str, help='Template filename')
parser.add_argument('--output', type=str, help='Output filename')
parser.add_argument('--title', type=str, help='Paper title')
parser.add_argument('--authors', type=str, help='Author names')
parser.add_argument('--affiliations', type=str, help='Institutions/affiliations')
parser.add_argument('--email', type=str, help='Corresponding author email')
parser.add_argument('--interactive', action='store_true', help='Run in interactive mode')
args = parser.parse_args()
# Interactive mode
if args.interactive:
interactive_mode()
return 0
# Command-line mode
if not args.template or not args.output:
print("Error: --template and --output are required (or use --interactive)")
parser.print_help()
return 2
# Find template
template_path = find_template(args.template)
if not template_path:
print(f"Error: Template '{args.template}' not found")
print("\nSearched in:")
skill_path = get_skill_path()
for subdir in ["journals", "posters", "grants"]:
print(f" - {skill_path}/assets/{subdir}/")
return 2
# Customize
output_path = Path(args.output)
customize_template(
template_path,
output_path,
title=args.title,
authors=args.authors,
affiliations=args.affiliations,
email=args.email
)
return 0
if __name__ == "__main__":
raise SystemExit(main())
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |