1

I am trying to filldraw a square with sides 7sqrt(7). I am not getting the desired output.

\begin{tikzpicture}
\filldraw(0,0) rectangle (7*\sqrt{7},7*\sqrt{7}); 
\end{tikzpicture}
1
  • 1
    \sqrt{x} is for typesetting the symbol for the square root of x. To perform a calculation, you have to use the pgf function sqrt(x). And to not confuse the coordinate parser (which looks for a ) as the end of the coordinate), any calculations that include parentheses have to be wrapped in {}, to hide them from the coordinate parse. Hence you get the expression ({7*sqrt(7)},{7*sqrt(7)}) shown in hpekristiansen's answer. Jul 11 '21 at 15:51
2
\documentclass[tikz, border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}
  \filldraw(0,0) rectangle ({7*sqrt(7)},{7*sqrt(7)});
\end{tikzpicture}
\end{document}

square

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.