1

I want to draw a triangle with text on the edges (corners) as shown in the image.

The MWE [modified from 1] is:

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}

\tikzset{ buffer/.style={ draw, shape border rotate=90, isosceles triangle, isosceles triangle apex angle=60, node distance=2cm, minimum height=2em } } \begin{document} \begin{tikzpicture} \node[buffer]{Text}; \draw node[above]{Text}; \end{tikzpicture}

\end{document}

image

CarLaTeX
  • 62,716
  • What have you tried so far? Please add that code to your question. Thank you – MS-SPO Jun 19 '23 at 19:03
  • 1
    I have added MWE. I have tried to merge the above with this solution [https://tex.stackexchange.com/questions/13539/label-sides-of-rectangles-and-triangles]. – user3582228 Jun 19 '23 at 19:38
  • You have several options to continue. Look e.g. for anchor in the manual, and polar coordinates. – MS-SPO Jun 19 '23 at 20:04
  • 1
    You can just draw that triangle without a shape and place nodes at the corners: \draw[align=center] (0,0) node[left]{x} --+(right:4) node[right]{y} --+(60:4) node[above]{z} --cycle; You just need to fill the node with content. – Qrrbrbirlbel Jun 19 '23 at 20:06
  • Alternatively, name the triangle node and use it's anchors for placing the three text nodes. Possibly, you can even use the label key but it makes the input a bit weird. – Qrrbrbirlbel Jun 19 '23 at 20:08

1 Answers1

1

Here you have two solutions. One places text nodes after the triangle and second uses three labels to place the text.

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, positioning}

\tikzset{ buffer/.style={ draw, shape border rotate=90, isosceles triangle, isosceles triangle apex angle=60, node distance=2cm, minimum height=2em }, textblock/.style={text width=2cm, inner sep=0pt, align=#1}, } \begin{document}

\begin{tikzpicture} \node[buffer] (a) {Text.in}; \node[textblock=center, above= 1mm of a]{Some text text text text text text}; \node[textblock=left, above right= 0mm and 0mm of a.right corner]{Right text text text text text text text}; \node[textblock=right, above left= 0mm and 0mm of a.left corner]{Left text text text text text text text}; \end{tikzpicture}

\begin{tikzpicture} \node[buffer, label={[textblock=center]above:Above text text}, label={[textblock=left, anchor=south west]right corner:Right text text}, label={[textblock=right, anchor=south east]left corner:Left text text}, ] (a) {Text.in}; \end{tikzpicture}

\end{document}

enter image description here

Ignasi
  • 136,588