I'm on overleaf doing some homework with latex and part of it includes adding a picture of this triangle on the right side of the paper. I know I have to use tikz but when I try and research it myself, I get bombarded with different answers that are not exactly what I'm looking for. Please help!
[Tex/LaTex] How to create a triangle with labeled sides, angles, and corners
tikz-pgf
Related Solutions
Something like this is made with the libraries decorations.text
and arrows.meta
together with the correspondent options
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text,calc,arrows.meta}
\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0,0);
\draw (O) circle (2.5);
\draw (O) circle (1.5);
\draw (O) circle (0.5);
\draw[decoration={text along path,reverse path,text align={align=center},text={Wee}},decorate] (0.6,0) arc (0:180:0.6);
\draw[decoration={text along path,reverse path,text align={align=center},text={There is a way?}},decorate] (1.6,0) arc (0:180:1.6);
\draw[decoration={text along path,reverse path,text align={align=center},text={Should be here any!}},decorate] (2.6,0) arc (0:180:2.6);
\begin{scope}[xshift=6cm]
\coordinate (O) at (0,0);
\draw[fill=red!30] (O) circle (2.8);
\draw[fill=green!40] (O) circle (2);
\draw[fill=yellow!70] (O) circle (1.2);
\draw[fill=blue!45] (O) circle (0.4);
\draw[decoration={text along path,reverse path,text align={align=center},text={xxx}},decorate] (0.5,0) arc (0:180:0.5);
\draw[decoration={text along path,reverse path,text align={align=center},text={yyy}},decorate] (1.3,0) arc (0:180:1.3);
%\draw[decoration={text along path,reverse path,text align={align=center},text={Should be here any!}},decorate] (2.1,0) arc (0:180:2.1);
\draw[decoration={text along path,reverse path,text align={align=center},text={Hello, how are you?}},decorate] (2.9,0) arc (0:180:2.9);
\end{scope}
\draw[line width=2mm,>={Triangle[length=3mm,width=5mm]},->] (2.6,0) -- (3.8,0);
\end{tikzpicture}
\end{document}
Result
EDIT
Or you can simplify the code a bit by using loops (\foreach
)
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text,calc,arrows.meta}
\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0,0);
\foreach \j in {1,...,3} \draw (O) circle (3.5-\j);
\foreach \k/\text in {0/Should be here any!,1/There is a way?,2/Wee} \draw[decoration={text along path,reverse path,text align={align=center},text={\text}},decorate] (2.6-\k,0) arc (0:180:2.6-\k);
\begin{scope}[xshift=6cm]
\coordinate (O) at (0,0);
\foreach \k in {1,...,4}\pgfmathparse{12*\k} \draw[fill=red!\pgfmathresult] (O) circle (3.6-0.8*\k);
\foreach \k/\text in {0/{Hello, how are you?},1/,2/yyy,3/xxx} \draw[decoration={text along path,reverse path,text align={align=center},text={\text}},decorate] (2.9-0.8*\k,0) arc (0:180:2.9-0.8*\k);
\end{scope}
\draw[line width=2mm,>={Triangle[length=3mm,width=5mm]},->] (2.6,0) -- (3.8,0);
\end{tikzpicture}
\end{document}
A fragile
frames helps:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{positioning}
\usetikzlibrary{matrix}
\begin{document}
\begin{frame}[fragile]
\begin{center}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes,row sep=3em,column sep=4em,minimum width=2em]
{
E & E \\
P & P \\};
\path[-stealth]
(m-1-1) edge node [left] {$\pi$} (m-2-1)
edge node [above] {$\psi$} (m-1-2)
(m-2-1.east|-m-2-2) edge node [below] {}
node [above] {$\bar{\psi}$} (m-2-2)
(m-1-2) edge node [right] {$\pi$} (m-2-2);
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
Best Answer
For fun, here is a short code with
pst-eucl
, which works well withxelatex
: