Say I have the following triangle, which is a pretty standard figure:
\documentclass[border=3pt]{standalone}
\usepackage[ngerman]{babel}
\usepackage{tikz}
\usetikzlibrary{angles,quotes,babel}
\begin{document}
\begin{tikzpicture}%
\draw[thick,xshift=6cm] (0,0) coordinate(A) node[below left] {$\mathrm{A^{\prime}}$}
-- (0:5cm) coordinate(B) node[pos=0.5, below] {$\mathrm{c^{\prime}}$} node[below right] {$\mathrm{B^{\prime}}$}
-- (40:5cm) coordinate(C) node[pos=0.5, right] {$\mathrm{a^{\prime}}$} node[above] {$\mathrm{C^{\prime}}$}
-- cycle node[pos=0.5,above left] {$\mathrm{b^{\prime}}$}
pic["$\beta^\prime$",draw,thin,angle radius=0.5cm,angle eccentricity=1.3] {angle=C--B--A}
pic["$\gamma^\prime$",draw,thin,angle radius=0.5cm,angle eccentricity=1.45] {angle=A--C--B}
pic["$\alpha^\prime$",draw,thin,angle radius=0.5cm,angle eccentricity=1.5] {angle=B--A--C}
;
\end{tikzpicture}
\end{document}
I placed the nodes manually and I have the problem that they have to be manually adjusted, if I rotate the figure. An example of how horrible it can get is if I add [rotate=180]
after \begin{tikzpicture}
.
I read the whole section on nodes in the manual, but didn't find an answer to this:
For sides labels, is there a way to tell
TikZ
to place the nodes always half way (pos=0.5
, but more "really 0.5") and especially to tell it to place it x pt (or mm) from the middle of the line in the direction of the perpendicular to the segment?For vertex labels, is there a way to tell
TikZ
to place the node x pt (or mm) from the vertex, on the bisector of the angle at that vertex?
If there were such a way, there would possibly remain to manually "swap" the position (for when the figure is upside/down), but this kind of geometric figures would always look nice.
calc
library. Placing labels on angles might be trickier, but I thinktkz-euclide
package could help doing it.angles,quotes
but on the other arc). See my answer below.