关于 TikZ 的问题

关于 TikZ 的问题

我尝试使用 TikZ 创建一个图形(参见下面的代码):

\begin{center} 
\begin{tikzpicture}[SIR/.style={rectangle, draw=black!60, fill=black!5, very thick, minimum size=8mm},  
]

%Nodes
\node[SIR]    (reverse)                              {$\Delta(C(X))$};
\node[SIR]    (topo-space)       [below=of reverse] {$X$};
\node[SIR]    (algebra)       [left=of topo-space] {$C(X)$};
\node[SIR]    (reverse2)       [right=of reverse] {$C(\Delta(\mathcal{A}))$};
\node[SIR]    (algebra2)       [below=of reverse2] {$\mathcal{A}$};
\node[SIR]    (structure-space)       [right=of algebra2] {$\Delta(\mathcal{A})$};

%Lines
\draw[->, dashed] (reverse.south)  to node[right]{$\ref{GNT-lemma}$} (topo-space.north);
\draw[->, very thick] (topo-space.west)  to node[below] {...} (algebra.east);
\draw[->, very thick] (algebra.north)  ..  controls  +(left:2mm) and +(left:7mm)   ..  (reverse.west);

\draw[->, very thick] (algebra2.east)  to node[below] {\ref{structure-lemma}} (structure-space.west);
\draw[->, dashed] (reverse2.south)  to node[right] {$b$} (algebra2.north);
\draw[->, very thick] (structure-space.north) .. controls  +(right:2mm) and +(right:7mm)   ..  (reverse2.east);
\end{tikzpicture}
\end{center}

在此处输入图片描述

我想在弯曲的箭头上写语句,但使用“to node[below] {...}”不起作用。此外,我想用“等距”符号(类似 $\cong$)替换虚线箭头。我该怎么做?

感谢您的帮助

答案1

这是实现此目的的一种方法。

结果

所做的更改:

我为绘制的箭头引入了另外两种样式,以稍微简化代码。

当然,引用不起作用。

对于标签,我引入了额外的节点,一个在极坐标中移位,一个在笛卡尔坐标中移位并带有倾斜文本,一个简单地带有[左];颜色是为了更好地指示。

极地:145 度,1 厘米半径,即西北方向

    \draw[arv,blue] (algebra.north)  to[out=90, in=180] % adopting Jaspers approach
                 node[shift=(145:1cm)] {something}      % putting a label, polar coordinates
                 (reverse.west);

笛卡尔:

    \draw[arv,red] (structure-space.north) to [out=90,in=0] % Jaspers idea again
                    node[sloped,xshift=3mm,yshift=3mm] {hi} % sloped, cartesian shifts
                    (reverse2.east);

左:不确定,这是否接近你想要的

    \draw[ard] (reverse.south)  to node[right]{$\ref{GNT-lemma}$}
    % >>> varied:
                                node[left,blue] {$\cong$} % did you mean that?
                                (topo-space.north);

代码

\documentclass[10pt,border=3mm,tikz]{standalone}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}[
    SIR/.style={rectangle, draw=black!60, fill=black!5, very thick, minimum size=8mm},
    % ~~~ some style-refactoring: ~~~~~~~~~~~~~
    ard/.style={->, dashed},
    arv/.style={->, very thick},
    ]
    % ~~~ Nodes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    \node[SIR] (reverse)                            {$\Delta(C(X))$};
    \node[SIR] (topo-space) [below=of reverse]      {$X$};
    \node[SIR] (algebra)    [left=of topo-space]    {$C(X)$};
    \node[SIR] (reverse2)   [right=of reverse]      {$C(\Delta(\mathcal{A}))$};
    \node[SIR] (algebra2)   [below=of reverse2]     {$\mathcal{A}$};
    \node[SIR] (structure-space) [right=of algebra2] {$\Delta(\mathcal{A})$};
    
    % ~~~ Lines // references don't work, of course ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    \draw[ard] (reverse.south)  to node[right]{$\ref{GNT-lemma}$}
    % >>> varied:
                                node[left,blue] {$\cong$} % did you mean that?
                                (topo-space.north);
    \draw[arv] (topo-space.west)  to node[below] {...} (algebra.east);
    % >>> varied: ~~~~~~~~~~~~~~~~~~~~~~~~~
    \draw[arv,blue] (algebra.north)  to[out=90, in=180] % adopting Jaspers approach
                 node[shift=(145:1cm)] {something}      % putting a label, polar coordinates
                 (reverse.west);
    
    \draw[arv] (algebra2.east)  to node[below] {\ref{structure-lemma}} (structure-space.west);
    \draw[ard] (reverse2.south)  to node[right] {$b$} (algebra2.north);
    % >>> varied: ~~~~~~~~~~~~~~~~~~~~~~~~~
    \draw[arv,red] (structure-space.north) to [out=90,in=0] % Jaspers idea again
                    node[sloped,xshift=3mm,yshift=3mm] {hi} % sloped, cartesian shifts
                    (reverse2.east);
\end{tikzpicture}

\end{document}

相关内容