1

I know that a triangle can be drawn like this:

\documentclass[12pt, border=5mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) node[anchor=north]{$A$}
  -- (4,0) node[anchor=north]{$C$}
  -- (4,4) node[anchor=south]{$B$}
  -- cycle;
\end{tikzpicture}
\end{document}

But I do not know how to draw these different orientations of a triangle:

enter image description here

Could anyone help me in this please?

Roland
  • 6,655
Brain
  • 163

1 Answers1

1

If this is an option for you you can work around it with an arrow as a node:

Since this answer contains a mistake (nesting tikz enviroment) and there was a follow up question you can find an improved version here.

\documentclass[border=0.5cm]{standalone}

\usepackage{tikz}

\newcommand{\arrowL}{ \tikz \draw[latex-] (0,0) -- (0.1,0); } \newcommand{\arrowR}{ \tikz \draw[-latex] (0,0) -- (0.1,0); }

\begin{document} \begin{tikzpicture} % Triangle 1 \node at (2,-1) {triangle 1}; \draw (0,0)--(4,0) node[sloped,pos=0.5]{}; \draw (4,0)--(4,4) node[sloped,pos=0.5]{\arrowR}; \draw (0,0)--(4,4) node[sloped,pos=0.5]{\arrowL}; \end{tikzpicture} \begin{tikzpicture} %Triangle 2 \node at (2,-1) {triangle 2}; \draw (0,0)--(4,0) node[sloped,pos=0.5]{}; \draw (4,0)--(4,4) node[sloped,pos=0.5]{\arrowR}; \draw (0,0)--(4,4) node[sloped,pos=0.5]{\arrowR}; \end{tikzpicture} \begin{tikzpicture} %Triangle 3 \node at (2,-1) {triangle 2}; \draw (0,0)--(0,4) node[sloped,pos=0.5]{\arrowR}; \draw (0,4)--(4,0) node[sloped,pos=0.5]{\arrowL}; \draw (0,0)--(4,0) node[sloped,pos=0.5]{}; \end{tikzpicture} \begin{tikzpicture} %arrows 1 \node at (2,-1) {horizontal}; \draw (0,0)--(4,0) node[sloped,pos=0.5]{\arrowL}; % makes an arrow pointing from the first coordinate to the last one to the left \draw (0,1)--(4,1) node[sloped,pos=0.5]{\arrowR}; % makes an arrow pointing from the first coordinate to the last one to the right.

\end{tikzpicture} \begin{tikzpicture} %arrows 2 \node at (2,-1) {vertical}; \draw (1,0)--(1,4) node[sloped,pos=0.5]{\arrowL}; % makes an arrow pointing from the first coordinate to the last one down \draw (2,0)--(2,4) node[sloped,pos=0.5]{\arrowR}; % makes an arrow pointing from the first coordinate to the last one up \end{tikzpicture} \end{document}

enter image description here

Roland
  • 6,655