Here is the code, which is working fine:

    \draw (1,2)-- (1,4) -- (8,4) -- (8,2) -- cycle;
    \draw (6,4) -- (8,4) -- (8,11) -- (6,11) -- cycle;
    \draw (6,11) -- (6,13) -- (13,13) -- (13,11) -- cycle;
    \node at (1,2) {\textbullet};
    \node at (13,13) {\textbullet};
    \node[below] at (1,2) {$(1,2)$};
    \node[above] at (13,13) {$(13,13)$};

I am sure there must be a way to draw up the three rectangles in an effective way.

Also, how could I label the points (\textbullet) as well as the coordinates in a more compact way?


I assume, you want to optimize the code of the question. All these operations can be put in one \draw command. Then the command form \tikz instead of the environment can be used. The path construction can be simplified via rectangle.

    (1, 2)
    node {\textbullet}
    node[below] {$(1, 2)$}
    rectangle (8, 4)
    rectangle (6, 11)
    rectangle (13, 13)
    node {\textbullet}
    node[above] {$(13, 13)$}


  • Nice! Another option not shorter but more compact: ... node [label=below:{$(1,2)$}] {\textbullet} ... – Ignasi Jun 12 '15 at 6:10
  • @Ignasi I have tried, but the distance is much larger. – Heiko Oberdiek Jun 12 '15 at 6:15
  • Ups. You're right, with label, textbullet node size places label far away, while with a second node the reference is a coordinate a not a node. – Ignasi Jun 12 '15 at 6:30

Just a possible solution. Instead of lines, use a rectangular node which fits desired coordinates. After that, place label and points using anchors.



\begin{tikzpicture}[scale=0.3, box/.style={draw, inner sep=0pt, outer sep=0pt}]
    \node[fit={(1,2) (8,4)}, box] (a){};
    \node[fit={(6,4) (8,11)}, box] (b){};
    \node[fit={(6,11) (13,13)}, box] (c){};
    \draw[fill] (a.south west) circle (5pt) node[below] {$(1,2)$};
    \draw[fill] (c.north east) circle (5pt) node[above] {$(13,13)$};


enter image description here

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.