tikzedt
tikzedt copied to clipboard
Problems with parentheses in \draw plot environment
Using the function plot example, I get a parser error (though the preview renders just fine).
\begin{tikzpicture}[domain=0:4]
\draw[very thin,color=gray] (-0.1,-1.1) grid (3.9,3.9);
\draw[->] (-0.2,0) -- (4.2,0) node[right] {$x$};
\draw[->] (0,-1.2) -- (0,4.2) node[above] {$f(x)$};
\draw[color=red] plot (\x,\x) node[right] {$f(x) =x$};
\draw[color=blue] plot (\x,{sin(\x r)}) node[right] {$f(x) = \sin x$};
\draw[color=orange] plot (\x,{0.05*exp(\x)}) node[right] {$f(x) = \frac{1}{20} \mathrm e^x$};
\end{tikzpicture}
Error:
Couldn't parse code. MismatchedTokenException: Expected token '}'. Instead found "0.05" which is of type FLOAT_WO_EXP in line 8 at position 36.
However, the following code works just fine with the lines using parentheses commented out:
\begin{tikzpicture}[domain=0:4]
\draw[very thin,color=gray] (-0.1,-1.1) grid (3.9,3.9);
\draw[->] (-0.2,0) -- (4.2,0) node[right] {$x$};
\draw[->] (0,-1.2) -- (0,4.2) node[above] {$f(x)$};
\draw[color=red] plot (\x,\x) node[right] {$f(x) =x$};
% \draw[color=blue] plot (\x,{sin(\x r)}) node[right] {$f(x) = \sin x$};
% \draw[color=orange] plot (\x,{0.05*exp(\x)}) node[right] {$f(x) = \frac{1}{20} \mathrm e^x$};
\end{tikzpicture}
If I only comment out the last line I get a different error:
\begin{tikzpicture}[domain=0:4]
\draw[very thin,color=gray] (-0.1,-1.1) grid (3.9,3.9);
\draw[->] (-0.2,0) -- (4.2,0) node[right] {$x$};
\draw[->] (0,-1.2) -- (0,4.2) node[above] {$f(x)$};
\draw[color=red] plot (\x,\x) node[right] {$f(x) =x$};
\draw[color=blue] plot (\x,{sin(\x r)}) node[right] {$f(x) = \sin x$};
% \draw[color=orange] plot (\x,{0.05*exp(\x)}) node[right] {$f(x) = \frac{1}{20} \mathrm e^x$};
\end{tikzpicture}
Error:
Couldn't parse code. System.Exception: childt.Type not handled! 52 ("(")
I am using the latest portable on Windows 7 from the Google code website (found here)
Anyone have any tips? Has anyone found a similar issue?
I don't have a permanent fix for this, but you can use the parser ignore command as a workaround:
%/* This line is ignored by the TE parser. %*/
I can't really format it right here on github. just type in the two "percentage-slash-star" and "percentage-star-slash"s and put the line which causes the error in between. Tikzedt also has a shortcut for the parser ignore command