0

Can someone explain why this doesn't work.

\documentclass[12pt]{article}  
\usepackage{amsmath}   
\usepackage{tikz}   
\begin{document}    
\begin{tikzpicture}
\draw (0,0)--(-1,sqrt(3));
\end{tikzpicture}
\end{document}

Thanks,

David

2
  • 7
    ... because you need to add braces: \draw (0,0)--(-1,{sqrt(3)});... otherwise the parser does not disentangle the brackets belonging to the mathematical expression and the coordinates, respectively.
    – user121799
    Commented Jul 29, 2019 at 4:11
  • @marmot Perfect! That really helps. Thanks.
    – David
    Commented Jul 29, 2019 at 5:23

1 Answer 1

3

The reason your code does not works is you must write sqrt(3) inside braces.

\documentclass[12pt]{article}  
\usepackage{amsmath}   
\usepackage{tikz}   
\begin{document}    
\begin{tikzpicture}
\draw (0,0)--(-1,{sqrt(3)});
\end{tikzpicture}
\end{document}

And the result is

enter image description here

1
  • Thanks. That works.
    – David
    Commented Aug 1, 2019 at 17:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .