Aller au contenu

TikZJax package and library runtime tests

This page tests the current supported TikZJax package set:

[
    "tkz-tab",
    "physics",
    "circuitikz",
    "chemfig",
    "yquant",
    "braids",
    "tikz-feynhand",
    "pgf-spectra",
    "kinematikz"
]

It also tests selected built-in TikZ libraries.

This page intentionally does not load:

  • mathtools
  • mhchem
  • cancel
  • bm
  • amssymb

Those packages should normally be handled by MathJax when used in ordinary Markdown mathematics, unless they are explicitly required inside a TikZJax rendering.

All diagrams use:

data-disable-cache="true"

so that changes are visible immediately.

New or potentially problematic package tests also use:

data-show-console="true"

If a test fails with a broken image, open the browser console and look for missing files such as:

GET /tex_files/some-file.sty.gz 404
GET /tex_files/some-file.tex.gz 404
GET /tex_files/some-file.code.tex.gz 404

Part A — External TeX/TikZ packages

1. tkz-tab

Expected result:

  • a sign and variation table is rendered.


2. physics

Expected result:

  • vector notation works with \vb;
  • derivatives work with \dv;
  • automatic delimiters work with \qty;
  • TikZ positioning and Stealth arrows work.


3. chemfig

Expected result:

  • molecules are drawn with visible chemical bonds;
  • not only the atom letters should appear.

Important:

Use \chemfig directly. Do not wrap it inside another TikZ node.

3.1 Methanol-like structure

3.2 Branched molecule

3.3 Benzene ring


4. circuitikz

Expected result:

  • a circuit is rendered with a battery, resistor, and capacitor;
  • component labels are visible;
  • no /tikz/l error appears.

Important:

Do not globally activate these built-in TikZ libraries when testing circuitikz:

circuits
circuits.ee
circuits.ee.IEC

They must only be loaded locally in the dedicated built-in TikZ circuit test.

4.1 Easy package syntax

4.2 JSON package syntax


5. yquant

Expected result:

  • two quantum wires are rendered;
  • a Hadamard gate is placed on the first wire;
  • a controlled-NOT operation connects the two wires;
  • measurement symbols appear at the end.


6. braids

Expected result:

  • a three-strand braid is rendered;
  • the three strands use different colors;
  • over-crossings and under-crossings are visible.


7. tikz-feynhand

Expected result:

  • three propagator lines meet at a central interaction vertex;
  • two fermionic lines and one photon line are rendered;
  • the central interaction point is visible.


8. pgf-spectra

Expected result:

  • the visible hydrogen emission spectrum is rendered;
  • colored spectral lines are visible;
  • an axis and an element label are displayed.

This package may require several spectrum data files. Check the console carefully for missing .tex.gz, .def.gz, or data files.


9. kinematikz

Expected result:

  • a fixed triangular frame is rendered;
  • several mechanical links and revolute joints form a kinematic chain.


Part B — Built-in TikZ libraries

10. Built-in TikZ electrical circuits

Expected result:

  • a circuit is rendered using only built-in PGF/TikZ circuit libraries;
  • this test does not use the external circuitikz package.

The circuit libraries are intentionally loaded only for this diagram.


11. Basic TikZ

Expected result:

  • a Cartesian coordinate system is rendered;
  • axis graduations and labels are visible;
  • a blue straight-line graph is displayed.


12. TikZ library shapes.geometric

Expected result:

  • a five-point star shape is rendered.


13. TikZ library calc

Expected result:

  • a red dot appears exactly between points A and B;
  • the midpoint is calculated with TikZ coordinate arithmetic.


14. TikZ library positioning

Expected result:

  • three boxes are placed using right=of and below=of;
  • arrows connect the boxes.


15. TikZ library patterns

Expected result:

  • one rectangle is filled with diagonal hatching;
  • another rectangle is filled with dots.


16. TikZ library arrows.meta

Expected result:

  • a modern Stealth arrow tip is rendered.


17. Combined TikZ libraries

This test loads:

  • arrows.meta
  • calc
  • positioning
  • decorations.pathreplacing

Expected result:

  • two positioned boxes are rendered;
  • a modern arrow connects them;
  • a brace is drawn below them;
  • a midpoint label is positioned using calc.


Part C — Runtime sanity tests

18. Cache bypass sanity check

Expected result:

  • a simple circle is rendered normally;
  • repeated reloads should trigger a new rendering instead of using the TikZJax IndexedDB SVG cache.


Debugging notes

Clear the TikZJax IndexedDB cache

Run this in the browser console:

indexedDB.deleteDatabase("TikzJax");
location.reload();

Inspect all configured global packages

Run:

window.TikzJaxOptions?.tex?.texPackages

Inspect all configured global TikZ libraries

Run:

window.TikzJaxOptions?.tex?.tikzLibraries

Important circuitikz conflict

Do not place these libraries in the global TikZJax configuration:

circuits
circuits.ee
circuits.ee.IEC

Load them locally only in the built-in TikZ circuits test.

Otherwise, they can conflict with the external circuitikz package.

Missing runtime files

A missing file commonly appears as:

GET /tex_files/package-name.sty.gz 404
GET /tex_files/package-data.tex.gz 404
GET /tex_files/tikzlibrary-name.code.tex.gz 404

When this happens:

  1. inspect the corresponding generated package JSON in web2js/tex_packages/;
  2. verify that the filename appears in web2js/tex_files.generated.json;
  3. verify that it appears in tikzjax/tex_files.json;
  4. regenerate the compressed files with yarn gen-tex-files;
  5. rebuild TikZJax;
  6. deploy the updated dist/tex_files/ directory.