以下没有产生方形箭头线。连接两个下部块的线是弯曲的。有人知道如何解决这个问题吗?
谢谢,戴夫
\usepackage{tikz}
\usepackage[all,cmtip]{xy}
\xymatrix {
{\scriptsize\begin{array}{ll}z\\~\\~\end{array}}
&
& *+++++[F]{G} \ar@<-9pt>[ll]
\ar@{->}`l/0pt[ld]`[d]_{y}[d]
\ar@{<-}`r/0pt[rd]`[d]^{v}[d]
&
& {\scriptsize\begin{array}{ll}w\\~\\~\end{array}}
\ar@<-9pt>[ll]
\\
&
& *+++++[F]{K} \ar@<+9pt>@{->}`l/0pt[ld]`[d]_{x}[d]
\ar@<-9pt>@{<-}`r/0pt[rd]`[d]^{u}[d]
&
\\
&
& *++[F]{Q}
&
}
答案1
文本以矩阵方式排列并通过线条连接?
TikZ-CD看起来足够方便了。
代码
\documentclass[tikz]{standalone}
\usepackage{tikz-cd}
\usetikzlibrary{ext.paths.ortho}% https://ctan.org/pkg/tikz-ext
\tikzset{
r-lr/.style={to path={r-lr(\tikztotarget)\tikztonodes}},
r-rl/.style={to path={r-rl(\tikztotarget)\tikztonodes}}}
\tikzcdset{
% shift left/right won't work with the r-lr/r-rl paths
@squeeze/.style 2 args={
start anchor={[#1shift=(#2)*(
\pgfkeysvalueof{/tikz/commutative diagrams/shift left/.@def})]},
end anchor={[#1shift=-(#2)*(
\pgfkeysvalueof{/tikz/commutative diagrams/shift left/.@def})]}},
squeeze up/.style={@squeeze={y}{#1}}, squeeze up/.default=1,
squeeze down/.style={@squeeze={y}{-(#1)}}, squeeze down/.default=1,
/tikz/tiny nodes/.style={nodes={
inner sep=+0pt, outer sep=+0pt, minimum size=+0pt}}}
\begin{document}
\begin{tikzcd}[
/tikz/column 2/.append style={minimum size=1cm, nodes=draw},
% we could do these arrows without node in column 1 and 3
% but this gives us a convenient target
% (coordinates don't work nicely with shift left/right
/tikz/column 1/.append style=tiny nodes,
/tikz/column 3/.append style=tiny nodes,
swap % all the labels are on the wrong side
]
{}
& G \arrow[l, "z" {at end, left}, shift right=2]
\arrow[r, <-, "w" {at end, right}, shift left=2]
\arrow[d, r-lr, "y", squeeze down]
& {}
\\
& K \arrow[d, r-lr, "y", squeeze down]
\arrow[u, r-rl, "v", squeeze up]
\\
& Q \arrow[u, r-rl, "u", squeeze up]
\end{tikzcd}
\end{document}