[Tex/LaTex] Tikz package. How to build a rectangle centered in one point

tikz-pgf

For istance, with Tikz, I can draw a circle centered in the point (0,0) with radius 2. How can I draw a rectangle centerd in (0,0) giving height and basis?

Best Answer

Last but not least, you could use a node, whose shape is rectangle and apply its anchor to its center:

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    % I want to center the rectangle here
    \filldraw (0,0) node [below] {center here} circle (1pt);
    % drawing the node with shape=rectangle and anchor=center
    \node [draw, thick, shape=rectangle, minimum width=3cm, minimum height=2cm, anchor=center] at (0,0) {};
\end{tikzpicture}
\end{document}

enter image description here