如何从一个字符到另一个字符画一条带箭头的弯线?

如何从一个字符到另一个字符画一条带箭头的弯线?

有人知道如何在 Tikz 中以简单的方式更改此图像吗?

在此处输入图片描述

答案1

Torbjørn T. 答案的稍微简化版本:

\documentclass[border=4mm,
               tikz]{standalone}
\usetikzlibrary{chains,arrows.meta}

\begin{document}
    \begin{tikzpicture}[
        start chain,
        node distance = 4mm,
    every node/.style = {join=by {Bar[]}->,on chain}
                    ]
\node (first)   {$x_1$};
\node           {$x_2$};
\node           {$x_3$};
\node           {$\dots$};
\node           {$x_{k-1}$};
\node (last)    {$x_k$};
%
\draw [->] (last) -- +(0,-0.8) -| (first);
    \end{tikzpicture}
\end{document}

它给出了相同的结果:

在此处输入图片描述

答案2

嗯,它可能是重复的,但无论如何这里有一个简单的例子,使用chains

在此处输入图片描述

\documentclass[border=4mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{chains,arrows.meta}
\begin{document}
\begin{tikzpicture}
\begin{scope}[start chain,node distance=4mm,every node/.append style={on chain}]
\node (x1) {$x_1$};
\node (x2) {$x_2$};
\node (x3) {$x_3$};
\node (dots) {$\dots$};
\node (xk-1) {$x_{k-1}$};
\node (xk) {$x_k$};
\end{scope}
\foreach \n [remember=\n as \lastn (initially x1)] in {x2,x3,dots,xk-1,xk}
  \draw [{Bar[]}->] (\lastn) -- (\n);

\draw [->] (xk) -- ++(0,-0.7cm) -| (x1);
\end{tikzpicture}
\end{document}

答案3

tikz-cd

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}
\[
\begin{tikzcd}[column sep= small,arrows={mapsto},every matrix/.append style={name=m},
  execute at end picture={
        \draw [->] (m-1-6.south) -- ++(0,-0.7cm) -| (m-1-1.south);
  }]
   x_1 \arrow[r] & x_2 \arrow[r] & x_3 \arrow[r] & \cdots \arrow[r] & x_{k-1} \arrow[r] & x_k
\end{tikzcd}
\]
\end{document}

在此处输入图片描述

答案4

没有psmatrix但仍使​​用 PSTricks。

\documentclass[preview,margin={3pt 12pt 3pt 5pt}]{standalone}
\usepackage{pstricks-add,amsmath}
\begin{document}
$
\displaystyle
    \rnode{B}{x_1}
    \mapsto x_2
    \mapsto x_3
    \mapsto \cdots
    \mapsto x_{k-1}
    \mapsto \rnode{E}{x_k }
    \ncbar[nodesep=3pt,angle=-90,arm=5pt,arrows=-v,arrowscale=.3,linewidth=.4pt]{E}{B}
$
\end{document} 

在此处输入图片描述

相关内容