I know it has been asked and answered before, and I need to put { and } around it, but for some reason this doesn't work:
\draw (0,0) -- ({atan(1)}:{sqrt(2)});
Any idea why?
|
I know it has been asked and answered before, and I need to put
Any idea why? |
|||
| show 1 more comment |
Important!This issue has been fixed in the upcoming version of TikZ ( > v.2.10). If you are looking for an immediate fix, then you need to install the CVS version of TikZ manually. This means that it's not your common TeXLive 2013 or MikTeX 2.9 distribution code but you have to download and install the package with some additional labor. Please do not try to install CVS version by overwriting the current one!! Instead copy it to a local folder and introduce it to LaTeX slowly. Here is a starting point: How to install a current version of TikZ? The answer continues after these messages.... Community Promotion Ads - 2013 It needs more cowbell!! The reason is quite mystical for me and probably our wizards will explain it. You need an extra space in the end :
or, remarkably, you don't put any braces in the last computation and skip the closing parenthesis:
This is simply black magic (or an extra parenthesis is carried from the math computation). So I welcome anyone to edit this answer and enlighten us. I don't know if it is related or not but here is another one with more hilarity(!?)
In this example you can't get away with an extra space. You need to omit the last paranthesis. Also one can remove the last two characters
|
|||||||||||||
|
|
Another option is to calculate the length beforehand:
|
|||
|
|
|
Update The workaround below is now part of the As I said in comment, this behavior is related to the fact that
Output:
|
||||
|
|
\draw (0,0) -- ({atan(1)}:sqrt(2);:D Note the missing paranthesis. I'll try to find the relevant question. – percusse Jan 21 '12 at 16:50\draw (0,0) -- ({atan(1)},{sqrt(2)});,\draw (0,0) -- ({atan(1)}:1.4);, but this one does not:\draw (0,0) -- (45:{sqrt(2)});. – Jan Hlavacek Jan 21 '12 at 16:52sqrt(5+2*sqrt(3)). – Jon Jan 21 '12 at 16:55{atan(1)}and{sqrt(1)}are removed and send to a macro with a parameter text sort of like(#1), that is(sqrt(1)), so the argument given to the macro is actuallysqrt(1. Sounds like a bug... – cjorssen Jan 22 '12 at 14:31tikz/pgfcvs repository at sourceforge. – cjorssen Jan 24 '12 at 13:38