artisticat1 / obsidian-tikzjax

Render LaTeX and TikZ diagrams in your notes
MIT License
457 stars 27 forks source link

Escaped dollar sign makes the diagram load indefinitely #27

Open jun2040 opened 1 year ago

jun2040 commented 1 year ago

I'm trying to create an economics graph using the pgfplots package but when I put the escaped dollar sign in the axis label the diagram loads indefinitely and I have to restart Obsidian to make the plugin render other diagrams again.

This is the latex that I wrote

\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}

\pgfplotsset{width=8cm,compat=1.9}
\tikzstyle{every node}=[font=\large]

\begin{axis}[
    axis lines=left,
    ticks=none,
    ymin=0,
    ymax=10,
    ylabel={Price (\$)},
    y label style={at={(axis description cs:-0.05,1)}, anchor=south east},
    xmin=0,
    xmax=10,
    xlabel={Quantity},
    x label style={at={(axis description cs:1,-0.05)}, anchor=north east},
    axis equal image,
    clip=false
]

\addplot[
    domain=0:9,
    style=very thick
]{5} node[right,pos=1] {D=AR=MR} node[left,pos=0] {P};

\end{axis}
\end{tikzpicture}
\end{document}

and this part seems to be the problem because when I delete \$ and restart Obsidian, the diagram renders normally

ylabel={Price (\$)},

This is the expected output from Overleaf image