¿Cómo puedo ajustar la ruta \path (a) edge [edge, loop left] node {$1_a$} (a)
para que tanto el principio como el final de la ruta estén cerca del nodo, pero no tan cerca como para que haya una superposición entre el texto del nodo y el contenido del nodo? Intenté usarlo shorten
en el estilo de borde, pero parece que solo funciona en un extremo del borde.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary {calc}
\usetikzlibrary {automata}
\usetikzlibrary {positioning}
\usetikzlibrary {fit}
\begin{document}
\tikzset{edge/.style={
thin,
black,
->,
shorten >=8pt,
shorten <=8pt }
}
\tikzset{node-element/.style={
inner sep=1.5mm,
minimum size=1cm,
}
}
\begin{tikzpicture}[scale=1.5]
\coordinate (a) at (0,0);
\coordinate (b) at (2,0);
\coordinate (c) at (1,2);
\node [node-element] at (a) {a};
\node [node-element] at (b) {b};
\node [node-element] at (c) {c};
\draw[edge, bend left] (a) to node[above, pos=0.5] {$f$} (b);
\draw[edge, bend left] (b) to node[below, pos=0.5] {$f^{-1}$} (a);
\draw[edge] (c) to node[left, pos=0.5] {$h$} (a);
\draw[edge] (c) to node[right, pos=0.5] {$h^{-1}$} (b);
\path (a) edge [edge, loop left] node {$1_a$} (a)
(b) edge [edge, loop right] node {$1_b$} (b);
\end{tikzpicture}
\end{document}
Respuesta1
Resuelto definiendo a
, b
, c
como nombres de nodos, no como coordenadas de tamaño cero.
\documentclass[tikz]{standalone}
\begin{document}
\tikzset{
edge/.style={
thin,
black,
% ->,
% shorten >=8pt,
% shorten <=8pt
},
node-element/.style={
% inner sep=1.5mm,
% minimum size=1cm,
}
}
\begin{tikzpicture}[scale=1.5]
\node [node-element] (a) at (0,0) {a};
\node [node-element] (b) at (2,0) {b};
\node [node-element] (c) at (1,2) {c};
\draw[edge, bend left] (a) to node[above, pos=0.5] {$f$} (b);
\draw[edge, bend left] (b) to node[below, pos=0.5] {$f^{-1}$} (a);
\draw[edge] (c) to node[left, pos=0.5] {$h$} (a);
\draw[edge] (c) to node[right, pos=0.5] {$h^{-1}$} (b);
\path (a) edge [edge, loop left] node {$1_a$} ()
(b) edge [edge, loop right] node {$1_b$} ();
\end{tikzpicture}
\end{document}