Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with parentheses in \draw plot environment #80

Open
photon-schiesser opened this issue Jun 29, 2018 · 1 comment
Open

Problems with parentheses in \draw plot environment #80

photon-schiesser opened this issue Jun 29, 2018 · 1 comment

Comments

@photon-schiesser
Copy link

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?

@SimGas
Copy link

SimGas commented Nov 9, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants