当我用 tikz 绘制交换图时,我通常使用语法
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}
\node (a) at (0,0) {$A$};
\node (b) at (2,0) {$B$};
\node (c) at (4,0) {$C$};
\path[->]
(a) edge (b)
(b) edge (c)
(a) edge [bend left] (c)
(a) edge [bend right] (c);
\end{tikzpicture}
\end{center}
\end{document}
这次,由于节点的大小,我需要使用.. controls (2,2) ..
使箭头避开节点。但是当我输入
\begin{center}
\begin{tikzpicture}
\node (a) at (0,0) {$A$};
\node (b) at (2,0) {$B$};
\node (c) at (4,0) {$C$};
\draw[->]
(a) edge (b)
(b) edge (c)
(a) .. controls (2,2) .. (c)
(a) .. controls (2,-2) .. (c);
\end{tikzpicture}
\end{center}
箭头提示仅出现在使用语法绘制的最后一行controls
(以及两个边缘)。如何指定我想要在每一行都显示箭头提示?
答案1
您可以使用arrows.meta
库和looseness
键来控制从控制点到两个端点的距离,如中所述pgfmanual
。
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usepackage[tightpage,active]{preview}
\PreviewEnvironment{tikzpicture}
\begin{document}
\begin{center}
\begin{tikzpicture}
\node (a) at (0,0) {$A$};
\node (b) at (2,0) {$B$};
\node (c) at (4,0) {$C$};
\path[->]
(a) edge (b)
(b) edge (c)
(a) edge [out=80,in=100,looseness=5] (c)
(a) edge [out=-55,in=-125,looseness=1.5] (c);
\end{tikzpicture}
\end{center}
\end{document}