Skip to content

FlashTeX never reads a .cls or .sty — 60% of real documents open with a class it cannot parse #905

Description

@d-q222

A 163-document corpus of what students and researchers actually write was assembled and cross-referenced against our support. The result is a single structural finding that reframes the backlog.

The root cause, verified in source

FlashTeX never reads a .cls or .sty file at all.

  • \input/\include resolve .tex onlycrates/compiler/src/parser.rs:4261
  • \documentclass has built-in knowledge for article, report, book, letter onlyparser.rs:4330-4380
  • The primitives a class file needs do not exist: \def, \let, \newif, \expandafter, \csname, \makeatletter, \RequirePackage, \LoadClass, \DeclareOption, \ProcessOptions

So package and class support is not "partially implemented" — it is a hardcoded allow-list of 24 packages and 4 classes, and anything outside it is invisible regardless of whether the file is sitting right there on disk.

What that costs, measured on 163 real documents

  • \documentclass distribution: article 55, beamer 14, scrartcl 9, report 6, amsart/book/exam 4 each, then 46 one-off thesis/CV/poster/homework classes. Kernel classes are 65/163 — 40%. Sixty percent of real documents open with a class we cannot read.
  • Only 10 of 163 documents (6%) load nothing outside the allow-list. The median document loads 12 unsupported packages.

Ranked by documents affected: graphicx 81 · babel 61 · tikz 58 · fancyhdr 52 · listings 45 · microtype 41 · fontspec 37 · etoolbox 36 · url 35 · calc 34 · textcomp 33 · tabularx 29 · mathtools 26 · lmodern 26.

Day one, for a student — concrete

what they download what happens
Metropolis beamer theme (6.9k★) \usetheme, \setbeamercolor, \frametitle, columns, block, \pause all unknown — and frame is implemented as "draw a box around the body", so the deck renders as boxed paragraphs instead of failing loudly. Silent-wrong, the worst outcome.
Cambridge PhDThesisPSnPDF (433 forks) dies at line 1
Awesome-CV (28.5k★) loads zero packages of its own; everything is class + fontspec. Nothing renders.
jdavis homework template (463 forks) starts (it is article) but fancyhdr/extramarks/tikz/algorithm/algpseudocode are all unsupported → body text only
Jake's Resume (705 forks) the nearest miss. article, 218 lines. Needs titlesec + fancyhdr + tabularx + a system-file fallback for \input{glyphtounicode}. Highest student-impact-per-unit-work item in the whole corpus.

Separately: \chapter, \part, \appendix, \frontmatter are unimplemented even though report/book set up the counters — so every thesis and every book fails there regardless of any class-loading fix.

Our own coverage data under-reports support

supported-latex.json is not a complete support oracle. \hline, \cline, \multicolumn, booktabs rules, multirow, longtable and colortbl are implemented in crates/compiler/src/parser/tabular.rs but absent from that inventory, and vocabulary.rs's KNOWN_UNIMPLEMENTED_* lists are stale and overlap implemented names (#715 covers part of this). Any analysis driven off that file alone — including our own coverage.md — will be wrong in both directions.

Suggested direction

This is a Tier-1 architectural question, not a lane task, and I am flagging it rather than dispatching it:

  1. Read .sty/.cls from the filesystem and interpret enough of the kernel to run them. That means the \def/\let/\newif/\csname/\@ifpackageloaded layer. Largest effort, removes the whole class of problem, and makes every future package work without a code change.
  2. Or keep the allow-list and grow it by measured demand, accepting that 60% of documents will keep failing on their class.

Option 1 is the only one where "a student opens their existing document and it works" is reachable. Worth an explicit decision before more per-package lanes are spent.

Cheapest concrete win meanwhile

titlesec + tabularx + \input fallback to system files makes Jake's Resume — 705 forks — render. That is a self-contained lane.

Found by real-user corpus testing (163 documents: 100 student-facing templates, guides, package manuals and lecture notes; 63 papers and theses).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions