shower_containment_depth_90/95 title crashes LaTeX rendering (unescaped %) #81

Closed
opened 2026-08-24 13:25:57 +02:00 by lars · 0 comments
Owner

giant analyze render fails on shower_containment_depth_90/shower_containment_depth_95 because their
figure title contains a literal % character, which LaTeX treats as a comment marker:

giant/analysis/catalog.py:637 (_containment_finalize):

title=f"Shower containment depth ({quantile:.0%} of deposited energy)",

quantile:.0% formats to e.g. 90%, so the title text becomes literally ...(90% of...). render.py
passes this straight to ps.new_figure(..., title=...) (giant/analysis/render.py), which does not escape
it before handing it to matplotlib's usetex pipeline, so LaTeX chokes:

Runaway argument?
{Shower containment depth (90\end {document}
! File ended while scanning use of \textbf .

This aborts render_all's loop entirely — since reduced_dir.glob("*.json") is processed in sorted
filename order and these two ids sort in the middle of the alphabet, every plot whose id sorts after them
(e.g. species_edep_share, type_embedding_l1_distance) silently never gets rendered in the same run.

Found while doing the gitea #77 end-to-end verification (multi-rollout analyze render), but this is
pre-existing on master — the title text is unchanged by that work, and the existing test_render.py
smoke tests never exercise it because they use synthetic titles instead of the real catalog ones.

Repro: run the full giant analyze pipeline (prepcompute-one for every catalog id → render)
against any rollout/reference pair and watch render_all die partway through the shower family.

Likely fix: escape % (and any other LaTeX-special character) in Reduced.title/xlabel before handing
it to ps.new_figure, e.g. replacing a raw % with an escaped \%. Worth checking whether plotstyle's
new_figure/_set_figure_title should be escaping title/subtitle text itself, since any future catalog
title with a literal %, &, #, etc. will hit the same failure mode (the LaTeX log shows "First Aid for
underscore.sty" was already needed, so _ is handled — % apparently isn't).

`giant analyze render` fails on `shower_containment_depth_90`/`shower_containment_depth_95` because their figure title contains a literal `%` character, which LaTeX treats as a comment marker: `giant/analysis/catalog.py:637` (`_containment_finalize`): ```python title=f"Shower containment depth ({quantile:.0%} of deposited energy)", ``` `quantile:.0%` formats to e.g. `90%`, so the title text becomes literally `...(90% of...)`. `render.py` passes this straight to `ps.new_figure(..., title=...)` (`giant/analysis/render.py`), which does not escape it before handing it to matplotlib's `usetex` pipeline, so LaTeX chokes: ``` Runaway argument? {Shower containment depth (90\end {document} ! File ended while scanning use of \textbf . ``` This aborts `render_all`'s loop entirely — since `reduced_dir.glob("*.json")` is processed in sorted filename order and these two ids sort in the middle of the alphabet, every plot whose id sorts after them (e.g. `species_edep_share`, `type_embedding_l1_distance`) silently never gets rendered in the same run. Found while doing the gitea #77 end-to-end verification (multi-rollout `analyze` render), but this is pre-existing on `master` — the title text is unchanged by that work, and the existing `test_render.py` smoke tests never exercise it because they use synthetic titles instead of the real catalog ones. Repro: run the full `giant analyze` pipeline (`prep` → `compute-one` for every catalog id → `render`) against any rollout/reference pair and watch `render_all` die partway through the `shower` family. Likely fix: escape `%` (and any other LaTeX-special character) in `Reduced.title`/`xlabel` before handing it to `ps.new_figure`, e.g. replacing a raw `%` with an escaped `\%`. Worth checking whether `plotstyle`'s `new_figure`/`_set_figure_title` should be escaping title/subtitle text itself, since any future catalog title with a literal `%`, `&`, `#`, etc. will hit the same failure mode (the LaTeX log shows "First Aid for underscore.sty" was already needed, so `_` is handled — `%` apparently isn't).
lars added the bug label 2026-08-24 13:25:57 +02:00
lars closed this issue 2026-08-24 14:35:40 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lars/giant#81