![如何确保交换图中的箭头和文本不重叠?](https://linux22.com/image/296176/%E5%A6%82%E4%BD%95%E7%A1%AE%E4%BF%9D%E4%BA%A4%E6%8D%A2%E5%9B%BE%E4%B8%AD%E7%9A%84%E7%AE%AD%E5%A4%B4%E5%92%8C%E6%96%87%E6%9C%AC%E4%B8%8D%E9%87%8D%E5%8F%A0%EF%BC%9F.png)
考虑下图
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri,calc,shapes.misc,decorations.markings}
\tikzset{degil/.style={
decoration={markings,
mark= at position 0.5 with {
\node[transform shape] (tempnode) {$\backslash$};
%\draw[thick] (tempnode.north east) -- (tempnode.south west);
}
},
postaction={decorate}
}
}
\begin{document}
%\tikzcdset{row sep/normal=1cm}
\begin{tikzcd}[arrows=Rightarrow,column sep=large, row sep=large]
& \text{$Y$ is mean indt. of $X$} \arrow[shift right=0ex]{dr}{} \arrow[degil,shift right=1.5ex]{dl}{} & \\
\text{Stochastic Independence} \arrow[shift right=0ex]{ur} \arrow[shift left=1.5ex]{dr}{} & & C(X,Y)=0 \arrow [degil,shift right=1.5ex]{ul} \arrow [degil,shift left=1.5ex]{dl} \\
& \text{$X$ is mean indt. of $Y$} \arrow[shift left=0ex]{ur} \arrow[degil,shift left=0ex]{ul}{} &
\end{tikzcd}
\end{document}
我尝试使用微调选项,但仍然面临两个(不同的)问题:
如何使图表更加优雅,使箭头规则并与文本整齐排列。(也许使用 stackengine 包的 rlap 和 llap 宏?)
另外,如何确保图形水平位于页面中心?[egreg 在评论中回答]
顺便说一句,感谢 Enrico 的解决方案这里我做了一些修改,但上面的关键问题(1)仍然存在
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri,calc,shapes.misc,decorations.markings}
\tikzset{degil/.style={
decoration={markings,
mark= at position 0.5 with {
\node[transform shape] (tempnode) {$\backslash$};
%\draw[thick] (tempnode.north east) -- (tempnode.south west);
}
},
postaction={decorate}
}
}
\begin{document}
%\tikzcdset{row sep/normal=1cm}
\[\begin{tikzcd}[arrows=Rightarrow,column sep=large, row sep=large]
& \begin{tabular}{@{}c@{}} $Y$ is mean \\ indt. of $X$ \end{tabular} \arrow[shift right=0ex]{dr}{} \arrow[degil,shift right=1.5ex]{dl}{} & \\
\begin{tabular}{@{}c@{}} Stochastic \\ Independence \end{tabular}\arrow[shift right=0ex]{ur} \arrow[shift left=1.5ex]{dr}{} & & C(X,Y)=0 \arrow [degil,shift right=1.5ex]{ul} \arrow [degil,shift left=1.5ex]{dl} \\
& \begin{tabular}{@{}c@{}} $X$ is mean \\ indt. of $Y$ \end{tabular} \arrow[shift left=0ex]{ur} \arrow[degil,shift left=0ex]{ul}{} &
\end{tikzcd}\]
\end{document}
答案1
这里有可以开始的内容吗?我现在不知道如何正确地将右侧单元格居中。我现在只是把它放在两行上。
% arara: pdflatex
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri,calc,shapes.misc,decorations.markings}
\tikzset{degil/.style={
decoration={markings,
mark= at position 0.5 with {
\node[transform shape] (tempnode) {$\backslash$};
}
},
postaction={decorate}
}
}
\begin{document}
\tikzset{foo/.style={align=center, minimum height=1cm, minimum width=2cm}}
\[\begin{tikzcd}[arrows=Rightarrow]
& \tikz\node[foo]{ $Y$ is mean\\indt.\ of $X$}; \arrow[degil, shift right=1ex, start anchor=south west, end anchor=north east]{dl} \arrow[shift right=1ex, start anchor=south east, end anchor = north west]{dr} &\\
\tikz\node[foo]{Stochastic\\Independence}; \arrow[shift right=1ex, start anchor=north east, end anchor=south west]{ur} \arrow[shift left=1ex, start anchor=south east, end anchor = north west]{dr}&&\tikz\node[foo]{$ C(X,Y)$\\$\quad=0$}; \arrow[shift right=1ex, degil, start anchor= north west, end anchor = south east]{ul} \arrow[shift left=1ex, degil, start anchor=south west, end anchor = north east]{dl}\\
&\tikz\node[foo]{ $X$ is mean\\indt.\ of $Y$}; \arrow[degil, shift left=1ex, start anchor=north west, end anchor = south east]{ul} \arrow[shift left=1ex, start anchor=north east, end anchor = south west]{ur}&
\end{tikzcd}\]
\end{document}