agentsclimarketplace

Extract tikz

Skill brycewang-stanford/Auto-Empirical-Research-Skills/skills/12-pedrohcgs-claude-code-my-workflow/dot-claude/skills/extract-tikz

Extract TikZ diagrams from Beamer source, compile to PDF, convert to SVG with 0-based indexing. Use when updating TikZ diagrams for Quarto slides.From its SKILL.md

Install
npx -y skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill extract-tikz

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

1.9 KB, 505 tokens by cl100k_base, as published. Nobody here has run it

Extract TikZ Diagrams to SVG

Extract TikZ diagrams from the Beamer source, compile to multi-page PDF, and convert each page to SVG for use in Quarto slides.

Steps

Step 0: Freshness Check (MANDATORY)

Before compiling, verify that extract_tikz.tex matches the current Beamer source.

  1. Find the Beamer source: ls Slides/$ARGUMENTS*.tex
  2. Extract all \begin{tikzpicture} blocks from Beamer
  3. Compare with Figures/$ARGUMENTS/extract_tikz.tex
  4. If ANY difference exists: update extract_tikz.tex from the Beamer source
  5. If extract_tikz.tex doesn't exist: create it from scratch

Step 1: Navigate to the lecture's Figures directory

cd Figures/$ARGUMENTS

Step 2: Compile the extract_tikz.tex file

TEXINPUTS=../../Preambles:$TEXINPUTS xelatex -interaction=nonstopmode extract_tikz.tex

Step 3: Count the number of pages

pdfinfo extract_tikz.pdf | grep "Pages:"

Step 4: Convert each page to SVG using 0-BASED INDEXING

CRITICAL: PDF pages are 1-indexed, but output SVG files are 0-indexed!

PAGES=$(pdfinfo extract_tikz.pdf | grep "Pages:" | awk '{print $2}')
for i in $(seq 1 $PAGES); do
  idx=$(printf "%02d" $((i-1)))
  pdf2svg extract_tikz.pdf tikz_exact_$idx.svg $i
done

Step 5: Sync to docs/ for deployment

cd ../..
./scripts/sync_to_docs.sh $ARGUMENTS

Step 6: Verify SVG files

  • Read 2-3 SVG files to confirm they contain valid SVG markup
  • Confirm file sizes are reasonable (not 0 bytes)

Step 7: Report results

Source of Truth Reminder

TikZ diagrams MUST be edited in the Beamer .tex file first, then copied verbatim to extract_tikz.tex. See .claude/rules/single-source-of-truth.md.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,144. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.