2

How do I let circle borders only grow to the outside? If I write

\node[circle, draw, minimum size=2cm, line width=4mm] {};

Then the inside of the circle has a diameter of 16mm, since 2mm of the 4mm grow inside the 2cm and 2mm of the 4mm grow outside of the 2cm. How do I get the circle to only grow to the outside? The trivial answer would be

\node[circle, draw, minimum size=2cm+4mm, line width=4mm] {};

Is there a better way of doing it? (Meaning a command that is intended for this?)

1 Answer 1

5

You can define a simple style to do the job:

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

\tikzset{
  inner size/.style={minimum size=#1+\pgflinewidth,inner sep=0sp},
  outer size/.style={minimum size=#1-\pgflinewidth,inner sep=0sp},
}

\begin{document}

\begin{tikzpicture}

\node[circle, draw,   outer size=1cm, line width=2mm, red] {};
\node[circle, draw,   inner size=1cm, line width=2mm, blue] {};
\node[circle, draw, minimum size=1cm, line width=.2mm, dashed] {};

\end{tikzpicture}

\end{document}

boink

Setting inner sep to nil isn't necessary unless you put content into nodes.

1
  • I do put content into the nodes, so thanks. Though it isn't as canon as if there was a tikz command, but its definitely better than my hack.
    – Make42
    Dec 8, 2015 at 12:22

You must log in to answer this question.

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