我想要倾斜的标签长表达式为了两个都我的 tikz 图片对角线上的箭头与箭头方向平行。通过对傅里叶变换使用更长的斜率参数,我得到了这个意想不到的输出,见图。1。文本与箭头交叉的方式很糟糕。此外,我希望两个箭头在我的 tikz 图片中可以区分且间隔开来,如图所示。2并且不要重叠。这可能是错误输出的根源。
这是我的 MWE:
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[xscale=6.5,yscale=4.5]
\def\is{2.0} % inner seperation of nodes
% NODES
\node[inner sep=\is] (hh) at (0,1) {$h(t,\tau)$};
\node[inner sep=\is] (SS) at (0,0) {$S(\nu,\tau)$};
\node[inner sep=\is] (HH) at (1,1) {$H(t,f)$};
\node[inner sep=\is] (BB) at (1,0) {$B(\nu,f)$};
% ARROWS
\draw[-latex] (hh) -- (HH) node[fill=white,inner sep=3pt,midway, scale=0.9] {$\mathcal{F}$};
\draw[-latex] (HH) -- (BB) node[fill=white,inner sep=3pt,midway, scale=0.9] {$\mathcal{F}$};
\draw[-latex] (hh) -- (SS) node[fill=white,inner sep=3pt,midway, scale=0.9] {$\mathcal{F}$};
\draw[-latex] (SS) -- (BB) node[fill=white,inner sep=3pt,midway, scale=0.9] {$\mathcal{F}$}; % Bad output starts below
\draw[-latex] (SS) -- (HH) node[midway, sloped, above, scale=0.9] {$\mathcal{F}\{long-expression\}$};
\draw[-latex] (HH) -- (SS) node[midway, sloped, below, scale=0.9] {$\mathcal{F}^{-1}\{long-expression\}$};
\end{tikzpicture}
\end{document}
答案1
编辑:
在第一个版本的答案中,我忽略了图表的对角线应该有两个反向平行向量(如@Sebastian 在其评论中所述)。现在这个问题已经得到纠正,两个向量都可见(分离)。
和tikz
:
\documentclass[tikz, margin=2mm]{standalone}
\usetikzlibrary{arrows.meta,
positioning,
quotes}
\begin{document}
\begin{tikzpicture}[%xscale=6.5,yscale=4.5
node distance = 45mm and 65mm,
every edge/.style = {draw, -Stealth},
every edge quotes/.style = {fill=white, inner sep=3pt,
font=\footnotesize, sloped, anchor=center},
N/.style = {inner sep=\is pt}
]
\def\is{2.0} % inner seperation of nodes
% NODES
\node (la) [N] {$h(t,\tau)$};
\node (lb) [N, below=of la] {$S(\nu,\tau)$};
\node (ra) [N, right=of la] {$H(t,f)$};
\node (rb) [N, below=of ra] {$B(\nu,f)$};
% ARROWS
\draw (la) edge["$\mathcal{F}$"] (ra)
(lb) edge["$\mathcal{F}$"] (rb)
(la) edge["$\mathcal{F}$" rotate=90] (lb)
(ra) edge["$\mathcal{F}$" rotate=90] (rb)
([shift={(-1pt,1pt)}] lb.north east) edge["$\mathcal{F}\{long-expression\}$" above] ([shift={(-1pt,1pt)}] ra.south west)
([shift={(1pt,-1pt)}] ra.south west) edge["$\mathcal{F}\{long-expression\}$" below] ([shift={(1pt,-1pt)}] lb.north east)
;
\end{tikzpicture}
\end{document}
(我更改了节点名称,使其变得更加一致:la 代表左上方,等等。)
答案2
我没用过tikz
画交换图,但tikz-cd
用过封装。结果非常好。
\documentclass[a4paper,12pt]{article}
\usepackage{tikz-cd}
\usepackage{amsmath,amssymb}
\begin{document}
\begin{tikzcd}[column sep=5cm,row sep=4cm]
h(t,\tau) \arrow[r,"\mathcal{F}" description] \arrow[d,"\mathcal{F}" description]& \arrow[dl,shift left=.35ex,"\mathcal{F}\{long-expression\}"{sloped, yshift = 5pt, xshift=1pt}] H(t,f) \arrow[d,"\mathcal{F}" description]\\
S(\nu,\tau) \arrow[r,"\mathcal{F}" description] \arrow[ru,shift left=.35ex,"\mathcal{F}^{-1}\{long-expression\}"{sloped, yshift = -20pt, xshift=1pt}] & B(\nu,f)
\end{tikzcd}
\end{document}