artisticat1 / obsidian-tikzjax

Render LaTeX and TikZ diagrams in your notes
MIT License
395 stars 23 forks source link

Crash on simple intersections diagram, works fine in TikZ #82

Open apetresc opened 4 days ago

apetresc commented 4 days ago

The following diagram code reliably crashes the plugin (in the sense of a real crash; the diagram spins forever to render, and then any subsequent changes to the diagram are ignored and it just hangs until I restart Obsidian):

\usepackage{tikz}
\usetikzlibrary{calc,angles,quotes,fit,intersections}
\begin{document}
\begin{tikzpicture}[thick/.style={line width=1pt},use as bounding box]
  \def\l{0.9};

  \draw[name path=circle] (0,0) coordinate(O) circle(1) {};
  \draw[name path=line] (-\l,-\l) coordinate(A)
  --(\l,-\l) coordinate(B)
  --(\l,\l)--(-\l,\l)--cycle;

  \path[name intersections={of=line and circle, by={P,Q}}];
  \fill[red] (P) circle (2pt) node[above right] {$P$};
  \fill[red] (Q) circle (2pt) node[below right] {$Q''$};

  % 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}

The exact same document in a regular TikZ compiler works fine, it's quite a simple diagram. Other uses of the intersections library seem to work fine in TikZ-Mathjax and the Obsidian plugin, but there's something special about this particular one that I can't figure out, but it crashes the whole plugin 100% of the time. Hopefully this is helpful for diagnosis.

apetresc commented 4 days ago

(I'm not sure if there's an easy way to get debug output from the plugin; I'd be happy to provide that if you point me to how)