2

Task:

I am trying to arrange four triangles via TikZ.

Below, you see the output: enter image description here

As you can see, I face two problems with my solution:

A) It seems hand-made since the borders do not fit perfectly to each other.

B) It is not scaleable because nodes are (manually) fixed to a certain triangle-node.

MWE and my attempt:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning,shapes}

\begin{document}

\begin{tikzpicture}
[border rotated/.style = {shape border rotate=180}],
\tikzstyle{triangle}=[draw, shape=regular polygon, regular polygon sides=3,draw,thick,inner sep=0pt,minimum
size=8cm], 
\node [triangle][fill=gray!15](1) at (0,0) {Content};
\node [triangle][fill=gray!15] (2) [below left=2.5cm and 0cm of 1] {Content A};
\node [triangle] [fill=blue!15] (3) [below right=2.5cm and 0cm of 1] {Content B};
\node [triangle] [fill=gray!15] [border rotated, below=0cm of 1, align=center] {Content C};
\node (11) [above=0.3cm of 1] {Content D};
\node  (21) [below left=0.3cm and 0.3cm of 2] {Content E};
\node (31) [below right=0.3cm and 0.3cm of 3] {Content F};
\end{tikzpicture}

\end{document}

Please show me how to improve those two issues! Thanks in advance.

3

For such "precision positioning" it is sometimes advantageous to make use of the anchors.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning,shapes}

\begin{document}

\begin{tikzpicture}[border rotated/.style = {shape border rotate=180},
triangle/.style={draw, shape=regular polygon, regular polygon sides=3,draw,thick,inner sep=0pt,minimum
size=8cm,inner sep=0pt,outer sep=0pt}] 
\node [triangle,fill=gray!15](1) {Content};
\node [triangle,fill=gray!15,anchor=north] (2) at (1.210) {Content A};
\node [triangle,fill=blue!15,anchor=north] (3) at (1.-30) {Content B};
\node [triangle,fill=gray!15,border rotated,below=0pt of 1] (4)  {Content C};
\node (11) [above=0.3cm of 1] {Content D};
\node  (21) [below left=0.3cm and 0.3cm of 2] {Content E};
\node (31) [below right=0.3cm and 0.3cm of 3] {Content F};
\end{tikzpicture}
\end{document}

enter image description here

Note that your figure is a bit wide (I did not change anything) and \tikzstyle is deprecated (so I used the same syntax as you already had for border rotated).

You may decrease minimum width until you go below a certain scale at which you see the impacts of Content having a smaller width than Content A, i.e. at which the minimum width is no longer attained for all triangles. So minimum size=5cm works

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning,shapes}

\begin{document}

\begin{tikzpicture}[border rotated/.style = {shape border rotate=180},
triangle/.style={draw, shape=regular polygon, regular polygon sides=3,draw,thick,inner sep=0pt,minimum
size=5cm,inner sep=0pt,outer sep=0pt}] 
\node [triangle,fill=gray!15](1) {Content};
\node [triangle,fill=gray!15,anchor=north] (2) at (1.210) {Content A};
\node [triangle,fill=blue!15,anchor=north] (3) at (1.-30) {Content B};
\node [triangle,fill=gray!15,border rotated,below=0pt of 1] (4)  {Content C};
\node (11) [above=0.3cm of 1] {Content D};
\node  (21) [below left=0.3cm and 0.3cm of 2] {Content E};
\node (31) [below right=0.3cm and 0.3cm of 3] {Content F};
\end{tikzpicture}
\end{document}

enter image description here

but minimum size=4cm does not

enter image description here

because the minimum size is not the actual size.

You may go lower by using negative distances for inner sep,

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning,shapes}

\begin{document}

\begin{tikzpicture}[border rotated/.style = {shape border rotate=180},
triangle/.style={draw, shape=regular polygon, regular polygon sides=3,draw,thick,inner sep=0pt,minimum
size=3.5cm,inner sep=-1.2cm,outer sep=0pt}] 
\node [triangle,fill=gray!15](1) {Content};
\node [triangle,fill=gray!15,anchor=north] (2) at (1.210) {Content A};
\node [triangle,fill=blue!15,anchor=north] (3) at (1.-30) {Content B};
\node [triangle,fill=gray!15,border rotated,below=0pt of 1] (4)  {Content C};
\node (11) [above=0.3cm of 1] {Content D};
\node  (21) [below left=0.3cm and 0.3cm of 2] {Content E};
\node (31) [below right=0.3cm and 0.3cm of 3] {Content F};
\end{tikzpicture}
\end{document}

enter image description here

but if you go to 2.5cm instead of 3.5cm, the texts won't fit any more

enter image description here

You can then still scale everything in order to arrive at 2.5cm.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning,shapes}

\begin{document}

\begin{tikzpicture}[border rotated/.style = {shape border rotate=180},
triangle/.style={draw, shape=regular polygon, regular polygon sides=3,draw,thick,inner sep=0pt,minimum
size=3.5cm,inner sep=-1.2cm,outer sep=0pt},scale=5/7,transform shape] 
\node [triangle,fill=gray!15](1) {Content};
\node [triangle,fill=gray!15,anchor=north] (2) at (1.210) {Content A};
\node [triangle,fill=blue!15,anchor=north] (3) at (1.-30) {Content B};
\node [triangle,fill=gray!15,border rotated,below=0pt of 1] (4)  {Content C};
\node (11) [above=0.3cm of 1] {Content D};
\node  (21) [below left=0.3cm and 0.3cm of 2] {Content E};
\node (31) [below right=0.3cm and 0.3cm of 3] {Content F};
\end{tikzpicture}
\end{document}

enter image description here

  • 2
    Thanks for your input. Please feel free to improve the graphic as you want. Excited for your suggestions! :-) I also want to make it smaller (like 2.5 cm per triangle) – Jens Jan 2 at 11:18
  • 2
    @Jens I added a few options that allow you to scale the thing down without messing it up, and commented on potential caveats. – user121799 Jan 2 at 11:38

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.