Tian2

AI/Skills/latex-qbank

latex-qbank Built by Tian2 AI for Learning

A book becomes a question bank.

This is the skill behind Tian2's online training banks. It takes a finished LaTeX solution book — the same source the printed Physics-Challenge volumes are set from — and turns it into an interactive, reveal-on-click question bank a student can drill in the browser, offline, with every equation intact.

What it does

A LaTeX solution book stores each problem as a question / answer / solution block. latex-qbank reads those blocks and emits three things from one pipeline: a filterable single-page app (search + section / difficulty / topic pills, answers hidden behind a click), a clean one-page-per-category browse site, and a Markdown bank that renders in Obsidian or on GitHub. Everything — the app, the CSS, a bundled copy of MathJax — ships in the output so it opens straight from file:// with no server and no network.

The hard part, and the reason the skill exists, is the math. Converting LaTeX to HTML normally strips braces and rewrites line breaks — transforms that quietly destroy \frac{a}{b} and every align environment. The extractor placeholder-protects every math form before any text substitution runs, restores it at the end, and prints a corrupted-math warning if a single fragment slips through.

Inputs & outputs

In

  • A categorised LaTeX solution book (.tex files using \begin{question} / answer / solution)
  • Referenced figures and images
  • One qbank.config.json — file map, ID pattern, section breaks, branding strings

Out

  • A filterable question-bank web app (search + topic / difficulty pills)
  • A multi-page browse site, one page per category
  • A Markdown bank with <details> reveals
  • Bundled MathJax so it renders offline from file://
A worked example

From source to a drillable card

Here is one problem as it lives in the book's LaTeX source, and the same problem as the skill renders it into the online bank — question shown, solution held behind a reveal so a student attempts it first.

Sample input · spc-by-topic/kinematics.tex
\begin{question}[id=SPC-K-04, topic=Kinematics, level=2]
A ball is thrown vertically upward with speed $u$. Ignoring air
resistance, show that the time to reach maximum height is $t = u/g$,
and that the maximum height reached is
\[ H = \frac{u^{2}}{2g}. \]
\end{question}
\begin{solution}
At the top the velocity is zero, so $0 = u - g t \Rightarrow t = u/g$.
Substituting into $H = u t - \tfrac{1}{2} g t^{2}$ gives
\[ H = \frac{u^{2}}{g} - \frac{1}{2}\frac{u^{2}}{g} = \frac{u^{2}}{2g}. \]
\end{solution}
Rendered output · the question-bank card (static mock)
SPC-K-04 Kinematics Level 2

A ball is thrown vertically upward with speed u. Ignoring air resistance, show that the time to reach maximum height is t = u/g, and that the maximum height reached is H = u²/2g.

Reveal worked solution
At the top the velocity is zero, so 0 = u − gt, giving t = u/g. Substituting into H = ut − ½gt² gives H = u²/g − ½·u²/g = u²/2g.

In the real bank the equations are typeset by bundled MathJax — fractions stacked, exponents raised — and the reveal, the topic pills, and the search all work offline. The card above is a static illustration of the layout.

The books this powers

From these solution books to online training

The same pipeline drives the interactive training banks built from Tian2's Physics-Challenge solution books. Each printed volume has a matching online bank a student can drill by topic or by year: