Increasing parameter stack size
Consider the following simple diagram:
\usepackage{tikz}
\usetikzlibrary{calc,angles,quotes,fit,intersections}
\begin{document}
\begin{tikzpicture}[thick/.style={line width=1pt},use as bounding box]
\coordinate (A) at (0,0);
\coordinate (D) at (4.5,0);
\coordinate (B) at (1.35,0);
\coordinate (P) at (2,0);
\coordinate (Q) at (3,0);
\coordinate (C) at (4,0);
\draw[thick] (A)--(D);
\draw[thick, name path=arc1] (A)--(A) arc[start angle=180, end angle=0, radius=2];
\draw[thick, name path=arc2] (B)--(B) arc[start angle=180, end angle=0, radius=1.575];
\path[name intersections={of=arc1 and arc2, by={R}}];
\draw[] (A)--(R);
\draw[] (P)--(R);
\draw[] (Q)--(R);
\draw[] (D)--(R);
% Add a margin of 0.2 units around each edge of the drawing
\node[fit=(current bounding box), inner sep=0.2cm] {};
\end{tikzpicture}
\end{document}
On a regular default TikZ installation, this works fine and produces:
But on node-tikzjax (and upstream tikzjax and obsidian-tikzjax, for that matter), it fails to compile with the following output:
TikZJax: Rendering input:
\usepackage{pgfplots}\usepackage[intlimits]{amsmath}\usetikzlibrary{arrows.meta,calc}% comment
\usepackage{tikz}
\usetikzlibrary{calc,angles,quotes,fit,intersections}
\begin{document}
\begin{tikzpicture}[thick/.style={line width=1pt},use as bounding box]
\coordinate (A) at (0,0);
\coordinate (D) at (4.5,0);
\coordinate (B) at (1.35,0);
\coordinate (P) at (2,0);
\coordinate (Q) at (3,0);
\coordinate (C) at (4,0);
\draw[thick] (A)--(D);
\draw[thick, name path=arc1] (A)--(A) arc[start angle=180, end angle=0, radius=2];
\draw[thick, name path=arc2] (B)--(B) arc[start angle=180, end angle=0, radius=1.575];
\path[name intersections={of=arc1 and arc2, by={R}}];
\draw[] (A)--(R);
\draw[] (P)--(R);
\draw[] (Q)--(R);
\draw[] (D)--(R);
% Add a margin of 0.2 units around each edge of the drawing
\node[fit=(current bounding box), inner sep=0.2cm] {};
\end{tikzpicture}
\end{document}
This is e-TeX, Version 3.14159265-2.6 (preloaded format=latex 2022.5.1)
**entering extended mode
(input.tex
LaTeX2e <2020-02-02> patch level 2
("pgfplots.sty" (pgfplots.revision.tex) (pgfplots.code.tex
(pgfplotscore.code.tex (pgfplotssysgeneric.code.tex)) (pgfplotslibrary.code.tex
) (pgfplotsoldpgfsupp_loader.code.tex (pgflibraryfpu.code.tex))
(pgfplotsutil.code.tex (pgfplotsliststructure.code.tex)
(pgfplotsliststructureext.code.tex) (pgfplotsarray.code.tex)
(pgfplotsmatrix.code.tex) (pgfplotstableshared.code.tex)
(pgfplotsdeque.code.tex) (pgfplotsbinary.code.tex (pgfplotsbinary.data.code.tex
)) (pgfplotsutil.verb.code.tex) (pgflibrarypgfplots.surfshading.code.tex))
(pgfplotscolormap.code.tex (pgfplotscolor.code.tex))
(pgfplotsstackedplots.code.tex) (pgfplotsplothandlers.code.tex
(pgfplotsmeshplothandler.code.tex (pgfplotsmeshplotimage.code.tex)))
(pgfplots.scaling.code.tex) (pgfplotscoordprocessing.code.tex)
(pgfplots.errorbars.code.tex) (pgfplots.markers.code.tex)
(pgfplotsticks.code.tex) (pgfplots.paths.code.tex)
(tikzlibrarydecorations.code.tex (pgfmoduledecorations.code.tex))
(tikzlibrarydecorations.pathmorphing.code.tex
(pgflibrarydecorations.pathmorphing.code.tex))
(tikzlibrarydecorations.pathreplacing.code.tex
(pgflibrarydecorations.pathreplacing.code.tex))) (tikzlibraryplotmarks.code.tex
(pgflibraryplotmarks.code.tex))) ("amsmath.sty"
For additional information on amsmath, use the `?' option.
("amstext.sty" ("amsgen.sty")) ("amsbsy.sty") ("amsopn.sty"))
(pgflibraryarrows.meta.code.tex) (tikzlibrarycalc.code.tex)
(tikzlibraryangles.code.tex) (tikzlibraryquotes.code.tex)
(tikzlibraryfit.code.tex) (tikzlibraryintersections.code.tex
(pgflibraryintersections.code.tex))
No file input.aux.
ABD: EveryShipout initializing macros
Package pgfplots Warning: running in backwards compatibility mode (unsuitable t
ick labels; missing features). Consider writing \pgfplotsset{compat=1.16} into
your preamble.
on input line 4.
! TeX capacity exceeded, sorry [parameter stack size=300].
\pgf@sys@tonumber #1->
\expandafter \Pgf@geT \the #1
l.17 ...tions={of=arc1 and arc2, by={R}}];
Based on my extremely non-specialist understanding, it looks like the WASM tex binary was compiled with a very small stack of only 300, and that the intersections library, when computing intersections of arcs, uses up quite a lot of this stack space and so it runs out.
(For what it's worth, I've been able to reproduce this kind of error in a few different ways, but always when computing the intersection of non-linear paths. Again, these work fine in regular TikZ, and in kisonecat's base version of Tikzjax, but fail in multiple different other versions of TikZjax that I've tested out, including this one and drgrice1's fork that obsidian-tikzjax is based on).
If this evaluation is correct, I'm hoping a possible solution is to simply rebuild the WASM binary with a different compile-time configuration for this stack size. But I have no idea how to do this, having become aware of the very weird TeX build toolchain only recently.
Is there an easy place to get started figuring this out?
(By the way, I'm also tracking this issue in artisticat/obsidian-tikzjax#82).