以下程式碼不起作用:
\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}
你會得到似乎想要的結果。
與您的程式碼片段相比,上面的程式碼被簡化和縮短。