如何确保交换图中的箭头和文本不重叠?

如何确保交换图中的箭头和文本不重叠?

考虑下图

\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}

我尝试使用微调选项,但仍然面临两个(不同的)问题:

  1. 如何使图表更加优雅,使箭头规则并与文本整齐排列。(也许使用 stackengine 包的 rlap 和 llap 宏?)

  2. 另外,如何确保图形水平位于页面中心?[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}

在此处输入图片描述

相关内容