\path (a) edge [edge, loop left] node {$1_a$} (a)
パスの始点と終点の両方がノードに近く、ノード テキストとノードのコンテンツが重なり合わないようにパスを調整するにはどうすればよいでしょうか。shorten
エッジ スタイルで使用しようとしましたが、エッジの一方の端でしか機能しないようです。
\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}
答え1
a
、をゼロサイズの座標ではなくノード名としてb
定義することで解決しました。c
\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}