6

I was expecting a much tighter triangle around the text in this example, similar to the inner spacing around the text in the rectangle nodes. How would I tighten up the inner spacing?

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{shapes}
\begin{document}
\begin{tikzpicture}
    [trusty/.style={regular polygon,regular polygon sides=3, 
    ultra thick,draw=black},
    corp/.style={rectangle,ultra thick,
inner sep=4pt,minimum size=1.3cm, rounded corners=4mm,draw=black}
]

\node (opco) at (0,0) [corp] {entity};
\node (holdco)  [corp][below=of opco] {another entity};
\node (trust)  [trusty][ right=of holdco] {trust entity};
\end{tikzpicture}
\end{document}

output from above latex

1 Answer 1

9

According to the doc for regular polygon (pgfmanual v3.1.9a, sec. 71.3 "Geometric Shapes" or this online version), border of this shape is always constructed using the incircle, hence may result in a larger visual inner sep.

tikz has a isosceles triangle shape, which when set with isosceles triangle apex angle=60 (and maybe shape border rotate=90 as well) will have an equilateral triangle border. But this time node text is not at the center of node.

You may use regular polygon with a small negative inner sep as a workaround.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}

\tikzset{
  equilateral triangle/.style={
    shape=isosceles triangle,
    isosceles triangle apex angle=60,
    shape border rotate=90,
  },
}

\begin{document}

\begin{tikzpicture}
  \node[draw, equilateral triangle, label=isosceles triangle] {text};
  \node[draw, regular polygon,regular polygon sides=3, label=regular polygon]
    at (3,0) {text};
  \node[draw, regular polygon,regular polygon sides=3, label={[align=center]regular polygon\\negative inner sep}, inner sep=-.1em]
    at (6,0) {text};
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

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