5
\documentclass[border=2mm,tikz]{standalone}

\usepackage{textcomp}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[scale=0.3]
    \draw
        (1, 2)
        node {\textopenbullet}
        node[below] {$(1, 2)$}
        rectangle (8, 4)
        rectangle (6, 11)
        rectangle (13, 13)
        node {\textopenbullet}
        node[above] {$(13, 13)$};
\end{tikzpicture}


\end{document}

How do I make sure the node (1,2) is just an empty white circle?

Thanks!

enter image description here

3

3 Answers 3

4

I like to avoid fill=white. While the rectangle path operator does not “care” for nodes, the orthogonal path operators -| and -| do. With a to path, a rectangle path consisting of two -| can be easily re-created. (As the rectangle path operator does not work quite good with nodes along a path either, I left out \tikztonodes in the definition of the to path but it can get added easily, if needed.)

If you add outer sep=0pt to the definition of the circ style, the lines get drawn to the middle of the circular line and you can avoid easily the (hardly noticeable) connection problems as highlighted in Better fitting line to node in TiKZ. Another solution would be to use line cap=round or line cap=rect (line cap=butt is the default).

Code

\documentclass[border=2mm,tikz]{standalone}
\usepackage{tikz}
\tikzset{rect/.style={to path={-| (\tikztotarget) -| (\tikztostart) (\tikztotarget)}}}
\begin{document}
\begin{tikzpicture}[scale=0.3,
  circ/.style={shape=circle, inner sep=1pt, draw, node contents=}]
    \draw node (c1) at (1, 2) [circ, label=below:{$(1,2)$}]
          node (c2) at (13,13)[circ, label=above:{$(13,13)$}]
     (c1) to[rect] (8,4) to[rect] (6,11) to[rect] (c2);
\end{tikzpicture}
\end{document}
6

I'd use a style for the nodes instead of \textopenbullet as the node text.

enter image description here

The code:

\documentclass[border=2mm,tikz]{standalone}

\usepackage{textcomp}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[
  scale=0.3,
  mydot/.style={
    circle,
    fill=white,
    draw,
    outer sep=0pt,
    inner sep=1.5pt
  }
]
    \draw
        (1, 2)
        node[mydot] {}
        node[below] {$(1, 2)$}
        rectangle (8, 4)
        rectangle (6, 11)
        rectangle (13, 13)
        node[mydot] {}
        node[above] {$(13, 13)$};
\end{tikzpicture}

\end{document}
5

You can set a coordinate then subsequently draw and fill over it:

\documentclass[border=2mm,tikz]{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[scale=0.3]
    \draw
        (1, 2)
        node (here) [coordinate] {}
        node[below] {$(1, 2)$}
        rectangle (8, 4)
        rectangle (6, 11)
        rectangle (13, 13)
        node (alsohere) [coordinate] {}
        node[above] {$(13, 13)$};

    \draw [fill=white] (here) circle[radius= 0.5 em]; 
    \draw [fill=white] (alsohere) circle [radius= 0.5 em]; 
\end{tikzpicture}

\end{document}

Which give:

enter image description here

You must log in to answer this question.

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