以下代码不起作用:
\begin{tikzpicture}[->]
\node at (1.85,-1.2) (bF) {$F$};
\node at (1.27,-1.2) (bd) {$d$};
\node at (3.6,-1.2) (bW) {$W$};
\node at (1.9,-1.1) (GW) {};
\node at (1.29,-1.1) (EGxbW) {};
\node at (2.28,-0.9) (ExbW) {};
\path[every node/.style={font=\sffamily\small}, thick]
(GW) edge[bend right] node [left] {} (EGxbW);
(bW) edge[bend right] node [left] {} (ExbW);
\end{tikzpicture}
它生成以下图像:
如果我们改变最后两行代码(或者如果我们独立考虑相关代码行),我们会得到:
\begin{tikzpicture}[->]
\node at (1.85,-1.2) (bF) {$F$};
\node at (1.27,-1.2) (bd) {$d$};
\node at (3.6,-1.2) (bW) {$W$};
\node at (1.9,-1.1) (GW) {};
\node at (1.29,-1.1) (EGxbW) {};
\node at (2.28,-0.9) (ExbW) {};
\path[every node/.style={font=\sffamily\small}, thick]
(GW) edge[bend right] node [left] {} (EGxbW);
(bW) edge[bend right] node [left] {} (ExbW);
\end{tikzpicture}
我们得到:
由于我已经使用以下代码做了类似的事情,所以应该可以使两个箭头都可见:
\begin{tikzpicture}[->]
\draw[black, very thick] (0,0) rectangle (1.5,1);
\node at (1.8,0) (aL) {$\overline{L}$};
\draw[black, very thick] (0.8,-1.7) rectangle (2.3,-0.7);
\node at (2.55,-1.75) (bL) {$L$};
\node at (1.05,0.5) (aF) {$\overline{F}$};
\node at (0.47,0.5) (ad) {$\tilde{d}$};
\node at (1.85,-1.2) (bF) {$F$};
\node at (1.27,-1.2) (bd) {$d$};
\node at (2.8,0.5) (aW) {$\overline{W}$};
\node at (3.6,-1.2) (bW) {$W$};
\node at (1.48,0.8) (ExaW) {};
\node at (2.28,-0.9) (ExbW) {};
\path[every node/.style={font=\sffamily\small}, thick]
(ad) edge [out=230, in=173] (bd)
(aW) edge[bend right] node [left] {} (ExaW)
(bW) edge[bend right] node [left] {} (ExbW);
\end{tikzpicture}
这将生成以下图像:
我做错了什么?或者这只是 TikZ 中的一个错误?
答案1
在您的前两个代码片段中,最后一个代码行中存在孤立代码。命令
\path[every node/.style={font=\sffamily\small}, thick]
(GW) edge[bend right] node [left] {} (EGxbW); % is terminated here, so
(bW) edge[bend right] node [left] {} (ExbW); % this line orphan: not drown
在第一行代码之后就已终止(由;
),因此第二行成为孤儿,没有指示该做什么。因此,其中确定的箭头不会被淹没。
因此,如果你将第一个代码片段扩展为以下 WME:
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[->,
every node/.style = {inner xsep=0pt} ]
\node at (1.85,-1.2) (bF) {$F$};
\node at (1.27,-1.2) (bd) {$d$};
\node at (3.6,-1.2) (bW) {$W$};
\path (bF.north) edge[bend right] (bd.north east) % <--- not terminated
(bW.north) edge[bend right] (bF.north east);
\end{tikzpicture}
\end{document}
你将会得到看似期望的结果。
与上面的代码片段相比,代码更加简化和缩短。