我如何确保Text 3
(以及)与和Text 1'
具有相同的方向?Text 1
Text 2
我希望只要转动一下头就足以阅读文本。
最小示例:
\documentclass[a4paper]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[->, node distance=3cm, every node/.style={sloped},]
\node (a) {a};
\node (c) [below right of=a] {c};
\node (b) [below left of=c] {b};
\path (a) [bend right] edge node [above] {Text 1} (b)
(b) [bend right] edge node [above] {Text 1'} (a)
(b) [bend right] edge node [above] {Text 2} (c)
(a) [bend left] edge node [above] {Text 3} (c);
\end{tikzpicture}
\end{document}
答案1
文本标签可以旋转:
\documentclass[a4paper]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[->, node distance=3cm, every node/.style={sloped},]
\node (a) {a};
\node (c) [below right of=a] {c};
\node (b) [below left of=c] {b};
\path (a) [bend right] edge node [above] {Text 1} (b)
(b) [bend right] edge node [above, rotate=180] {Text 1'} (a)
(b) [bend right] edge node [above] {Text 2} (c)
(a) [bend left] edge node [above, rotate=180] {Text 3} (c);
\end{tikzpicture}
\end{document}
这解决了 的问题Text 1'
。另一个案例Text 3
现在是颠倒的,在我看来,可读性差了很多,请参阅我的评论对这个问题。
斜率较小的变体,其中标签稍微移动到箭头起点:
\documentclass[a4paper]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[->, node distance=3cm, every node/.style={sloped},]
\node (a) {a};
\node (c) [below right of=a] {c};
\node (b) [below left of=c] {b};
\path (a) [bend right] edge node [above, pos=.35] {Text 1} (b)
(b) [bend right] edge node [above, pos=.35] {Text 1'} (a)
(b) [bend right] edge node [above, pos=.4] {Text 2} (c)
(a) [bend left] edge node [above, pos=.35] {Text 3} (c);
\end{tikzpicture}
\end{document}
恕我直言,标签角度应在 -90° 到 +90° 范围内,这是避免标签颠倒的默认行为:
\documentclass[a4paper]{article}
\usepackage{textcomp}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[->, node distance=3cm, every node/.style={sloped},]
\path
\foreach \a in {0, 15, ..., 345} {
(0, 0) edge node[above, pos=.8]{\color{blue}\a\textdegree} (\a:4cm)
}
;
\end{tikzpicture}
\end{document}
改变斜率Text 3
是手动的干预。自动化解决方案需要一般规则如果这些规则要求标签方向相互依赖,这也会增加严重的复杂性,结果很不明显,根本无法算作改进。