Skip to content

About

Beamer template for CIty University of Hong Kong (Unofficial)

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CityU_SlidesGen

Paper in. CityU Slides out.

Turn a searchable PDF, Markdown, notes or an agent-authored outline into a CityU academic presentation: editable LaTeX, compiled PDF, slide previews and an auditable quality report. Run the demo without an API key. Use TRAE to create a semantic plan for a real paper.

Let AI decide what to present. Let LaTeX decide where to place it.

For template-constrained academic presentations, semantic LaTeX generation may provide more consistent layouts and lower post-generation repair cost than unconstrained object-level slide generation. This is a hypothesis, not a measured comparison.

Paper / Notes → Content analysis → Slide IR → CityU LaTeX
                    ↑                           ↓
             TRAE / LLM / heuristic       XeLaTeX → QA → bounded repair → PDF

Quick start and live demo

Python 3.10+ and a TeX distribution containing XeLaTeX are required. On macOS use MacTeX; on Linux use TeX Live with Beamer, fontspec, TeX Gyre, booktabs and, for Chinese, ctex/Fandol. Check xelatex --version. PDF extraction and PNG rendering use PyMuPDF; Poppler and OCR are not required.

python3 -m venv .venv
source .venv/bin/activate
pip install '.[dev]'
cityu-slidesgen demo

The self-contained example describes a fictional research prototype without invented experimental results. The demo prints the outline and timing before compilation. On a repeated run use a new output path, or cityu-slidesgen demo --overwrite to regenerate the demo files.

If a macOS/Python 3.14 editable install reports ModuleNotFoundError while python -m cityu_slidesgen works, the .pth installer file may have inherited the macOS hidden flag. Use a regular pip install '.[dev]' instead, or remove that flag from the package's specific .pth file with chflags nohidden. No global Python configuration change is needed.

cityu-slidesgen generate examples/sample-markdown/research.md \
  --duration 10 --audience "computer science researchers"
cityu-slidesgen generate paper.pdf --duration 15 --output output/paper-talk
cityu-slidesgen generate notes.md --language English --output output/notes-talk

Offline mode is source extraction with deterministic role selection and duration budgeting. It does not perform translation, infer authors or invent results. Chinese source text is rendered with CJK fonts automatically; use TRAE or an LLM for translation and substantive storytelling. Timing estimates require rehearsal, and sparse input is reported as a duration mismatch.

TRAE Skill

The Skill defaults to English slides, including when the user chats in Chinese or supplies Chinese material. TRAE translates and plans the content before rendering an English Slide IR; CLI language flags alone do not translate source text. See the Chinese TRAE Skill usage guide for setup, copyable prompts and troubleshooting.

Open this repository in TRAE with its project-local .trae/skills/cityu-slidesgen/SKILL.md. If your TRAE setup requires manual skill registration, register that folder. Automatic discovery in a live TRAE session has not been verified here.

Ask:

Use CityU_SlidesGen to turn this paper into a 10-minute English CityU research presentation for systems security researchers.

Or: 帮我把这篇论文做成10分钟的英文CityU学术汇报,请用中文与我沟通。

TRAE should inspect the paper, present a concise plan, generate validated Slide IR, invoke the CLI, then inspect the report and PNGs. It should revise claims against the source before accepting automatic truncation. The deterministic CLI is reusable from any agent.

cityu-slidesgen schema
cityu-slidesgen generate deck.json --output output/agent-talk

For JSON input, metadata, language and duration come from the IR; document-planning flags do not override it. Images are resolved relative to the JSON/input directory and must stay within it. No URL downloads are performed. The output directory must not contain the source file.

Slide IR and layouts

Pydantic models reject missing metadata, invalid IDs, unknown fields, malformed tables and missing layout-specific fields. IDs must be consecutive; title first, closing last. cityu-slidesgen schema prints the current JSON Schema.

Supported semantic layouts: title, section, bullet, text_image, image_text, full_image, comparison, three_points, architecture, equation, table, takeaway, closing. Comparison has two panels; three-points has three; architecture has two to four ordered stages. Only equation accepts a limited mathematical LaTeX command set. All plain text is escaped. XeLaTeX runs with shell escape disabled.

Optional LLM provider

Default --provider heuristic works offline. For a real OpenAI-compatible chat-completions endpoint:

export CITYU_LLM_BASE_URL=https://your-provider.example/v1
export CITYU_LLM_MODEL=your-model
export CITYU_LLM_API_KEY=your-key
cityu-slidesgen generate paper.pdf --provider openai-compatible

The provider must support /chat/completions with JSON-object output. Source text is sent to that configured endpoint. .env files are not loaded automatically. Secrets are not written to output. The adapter is isolated behind LLMProvider; no live external-model request is needed for the demo. A failed model request reports an error rather than silently claiming a heuristic result was AI-generated.

QA and repair

--max-repair-rounds defaults to 3 (0 disables repairs). --qa-config rules.json overrides thresholds such as max_title_chars, max_bullets, max_bullet_chars, and table dimensions. --no-qa skips optional structural checks, repair and PNG export, but still checks PDF page count and aspect ratio.

The build runs XeLaTeX twice and records return codes, stdout/stderr, missing glyphs, LaTeX errors and overfull boxes. Structural checks cover dense/empty slides, repeated titles/content, missing images, tables and timing. Local PDF checks detect page-boundary text and verify page count/16:9 geometry. VisionInspector is a future multimodal extension, not a simulated vision assessment.

Repairs shorten long titles/bullets, cap bullet counts and table dimensions, fall back to text for missing images or unsupported equations, and reduce text size once for overflow. Full before/after values and the original plan are retained. Repairs can remove qualifications or table entries: review them against the source. A broken environment or unrepairable compile error ends with a failure report and a nonzero exit code. No infinite retries.

Successful compilation does not certify factual accuracy, readable figures or timing. The offline demo is intentionally marked REVIEW REQUIRED for source/semantic review even when layout checks pass.

Outputs

output/demo/
├── presentation.pdf
├── presentation.tex
├── original_plan.json
├── deck_plan.json
├── quality_report.json
├── quality_report.md
├── build.log
├── beamerthemeCityU.sty
├── assets/
└── slides/slide-01.png ...

Generated outputs and the virtual environment are Git-ignored. The deck folder includes theme/assets and can be compiled from that folder using xelatex presentation.tex. Existing nonempty output folders require --overwrite.

Architecture and verification

cityu_slidesgen/
├── cli.py / pipeline.py
├── parser/            # Markdown/text and PDF extraction
├── planner/           # Analysis, providers, Pydantic Slide IR
├── renderer/          # Escaping and deterministic layouts
├── compiler/          # XeLaTeX execution and log parsing
├── qa/                # Structural/PDF checks and repairs
└── resources/         # Unmodified CityU theme and original assets
.trae/skills/cityu-slidesgen/
examples/sample-markdown/research.md
benchmark/             # Measured report metrics, no fabricated scores
tests/                 # Original template tests plus pipeline tests

Packaged resources make the installed CLI work outside the repository. Original root theme, examples, tools and artwork are preserved. They are copied unchanged into package resources; tests verify consistency.

pytest -q
python benchmark/evaluate.py output/demo/quality_report.json

Tests cover schemas, escaping, unsafe math, PDF/Markdown parsing, timing, QA, repairs, renderer resources, compiler diagnostics, output handling, all 13 layouts and Chinese compilation. Actual TeX tests skip when xelatex is unavailable. Install TeX dependencies to run those integration checks.

Limitations and next work

PDF text extraction can misread two-column order; scanned documents require external OCR. PDF figures, tables and authors are not reconstructed automatically. The heuristic planner deliberately uses basic extractive summaries; it does not replace a researcher's judgment. Long tables and complex equations may still require IR edits. Local geometry checks cannot judge visual balance, overlap within the page, or research correctness. No web UI, PPTX export, database or authentication layer is included. Live provider compatibility and live TRAE invocation require configuration-specific validation.

Next: actual multimodal QA, richer paper/figure extraction, and measured comparisons with other generators. See benchmark/README.md.

Attribution and license

Based on inscripoem/cityu-beamer, theme v1.0.1. This is an unofficial community adaptation. Code uses MIT. CityU artwork is governed separately; see NOTICE.md. The CLI preserves that artwork and includes these notices with packaged resources. Original template guidance remains in docs/USAGE.md and docs/USAGE.zh.md.

About

Beamer template for CIty University of Hong Kong (Unofficial)

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages