我正在使用定位 TikZ 库制作交换图。我无法让底部箭头处于水平状态。
这是我的问题的输出:定位库在左边,我认为应该得到的输出(用矩阵库完成)在右边。问题是上面的箭头$\psi^{-1}$
:它在图表的左侧版本上不是完全水平的。
我做错了什么?为什么我不应该在左侧和右侧获得相同的图片?
这是我的代码:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix,positioning}
\begin{document}
\[
\begin{tikzpicture}[ baseline=(current bounding box.center)]
% Tell it where the nodes are
\node (F) {$M^P \cap \pi_W^{-1}( U) $};
\node (E) [right=of F] {$V$};
\draw[->] (F)-- node [above] {\footnotesize $\pi_V$} (E);
\node (C) [below=of F] {$U \subset W$};
\draw[->] (F)-- node [left] {\footnotesize $\pi_W$} (C);
\node (B) [below=of E] {$I \times V$};
\draw[->] (C)-- node [below] {\footnotesize $\psi^{-1}$} (B);
\draw[<-] (E)-- (B);
\end{tikzpicture}
=
\begin{tikzpicture}[every node/.style={midway}, baseline=(current bounding box.center)]
\matrix[column sep={6em,between origins},
row sep={3em}] at (0,0)
{
\node (F) {$M^P \cap \pi_W^{-1}( U) $}; &
\node (E) {$V$};\\
\node (C) {$U \subset W$};&
\node (B) {$I \times V$};\\};
\draw[->] (F)-- node [above] {\footnotesize $\pi_V$} (E);
\draw[->] (F)-- node [left] {\footnotesize $\pi_W$} (C);
\draw[->] (C)-- node [below] {\footnotesize $\psi^{-1}$} (B);
\draw[<-] (E)-- (B);
\end{tikzpicture}
\]
\end{document}
答案1
这是正常的。第一行的节点高度不同。您需要使用选项on grid
every node/.style={midway}
你可以在第二张图片中删除
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix,positioning}
\begin{document}
\begin{tikzpicture}[every node/.style={on grid}, baseline=(current bounding box.center),node distance=2]
% Tell it where the nodes are
\node (F) {$M^P \cap \pi_W^{-1}( U) $};
\node (E) [right=of F] {$V$};
\draw[->] (F)-- node [above] {\footnotesize $\pi_V$} (E);
\node (C) [below=of F] {$U \subset W$};
\draw[->] (F)-- node [left] {\footnotesize $\pi_W$} (C);
\node (B) [below=of E] {$I \times V$};
\draw[->] (C)-- node [below] {\footnotesize $\psi^{-1}$} (B);
\draw[<-] (E)-- (B);
\end{tikzpicture}
=
\begin{tikzpicture}[ baseline=(current bounding box.center)]
\matrix[column sep={6em,between origins},
row sep={3em}] at (0,0)
{
\node (F) {$M^P \cap \pi_W^{-1}( U) $}; &
\node (E) {$V$};\\
\node (C) {$U \subset W$};&
\node (B) {$I \times V$};\\};
\draw[->] (F)-- node [above] {\footnotesize $\pi_V$} (E);
\draw[->] (F)-- node [left] {\footnotesize $\pi_W$} (C);
\draw[->] (C)-- node [below] {\footnotesize $\psi^{-1}$} (B);
\draw[<-] (E)-- (B);
\end{tikzpicture}
\end{document}