0

I've been working on a TikZ drawing, specifically a circle, inside a square, inside a circle, and so on (I think it's called inscribed and circumscribed circles and squares). This is my code so far (this is also a MWE):

\documentclass[tikz, 11pt, border=1cm]{standalone}
\usetikzlibrary{calc}
\begin{document}
    \begin{tikzpicture}
        %First Iteration
        \draw (-5,-5) rectangle (5,5);
        \draw (0,0) circle (5);
        %Second Iteration
        \draw ($cos(45)*(-5,-5)$) rectangle ($cos(45)*(5,5)$);
        \draw (0,0) circle (5*cos(45));
    \end{tikzpicture}
\end{document}

I did the first iteration with no problems whatsoever, however, while doing the second iteration, while trying to do the second circle (after the second square), my editor pointed an error stating that there's a missing semicolon in such line (\draw (0,0) circle (5*cos(45));), despite, there is a semicolon at the end of the line, and I don't know what's wrong about it.

What can I do?

1 Answers1

0

You could protect the (...) with {...} like this"

\draw (0,0) circle ({5*cos(45)});

or use the recommended notation:

\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
%First Iteration
\draw (-5,-5) rectangle (5,5);
\draw (0,0) circle (5);
%Second Iteration
\draw ($cos(45)*(-5,-5)$) rectangle ($cos(45)*(5,5)$);
\draw (0,0) circle[radius=5*cos(45)];
\end{tikzpicture}
\end{document}

Circle in a square in a circle in a...