2

I am wondering what the code is for a simple arrow that points from one part of an equation to another, like so. I have spent a few hours looking for ways to do this and unfortunately have not made very much progress.

enter image description here

enter image description here

The code for the math equation

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
M:\Sigma^{*}\to\delta(q,s)\to\mu(\delta)\to T_\text{N}\to\Lambda_\mu(\Gamma_0)
\end{equation*}
\end{document}
Black Mild
  • 17,569
tele
  • 33
  • 2
    Welcome to Tex.SE!!! Take a look at this post: https://tex.stackexchange.com/questions/34452/arrow-between-parts-of-equation-in-latex – Juan Castaño Feb 23 '23 at 06:43
  • What is your minimal complete code? – Sebastiano Feb 23 '23 at 08:01
  • At the moment it is `\usepackage{tikz}

    \usepackage{amsmath}

    \usetikzlibrary{calc} \newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}

    \begin{document}

    \begin{equation} M:\Sigma^{*}\to \tikzmark{a}\delta(q,s)\to\mu(\delta)\to T_\text{N}\to \Lambda_\mu\tikzmark{b}(\Gamma_0)

    \begin{tikzpicture}[overlay,remember picture,out=315,in=225,distance=0.4cm]

    \draw[->,] (a.center) to (b.center);

    \end{tikzpicture} \end{equation}`

    – tele Feb 23 '23 at 18:11

3 Answers3

2

An option with tikz-cd

enter image description here

\documentclass{article}

\usepackage{tikz-cd}

\begin{document}

[ \begin{tikzcd}[column sep=5mm] M\colon\Sigma^*\arrow[r] & \delta(q,s)\arrow[r] & \mu(\delta)\arrow[r] & T_N\arrow[r] & \Lambda_{\mu}(\Gamma_0)\arrow[lll, to path={-- ([yshift=2ex]\tikztostart.north)-|(\tikztotarget)}] \end{tikzcd} ]

\end{document}

Sandy G
  • 42,558
1

Based on your drawing I made this answer:

\documentclass[11pt]{article}

\usepackage[a4paper,margin=2cm]{geometry}

\usepackage{amsmath}

\usepackage{tikz} \usetikzlibrary{,arrows.meta,matrix,positioning,calc,fit}

\begin{document}

\begin{tikzpicture}[]
    \matrix[matrix of math nodes] (P) at (0,0) {M:\Sigma^{*} \to    &   \delta(q,s)\to  &   \mu(\delta)\to  &   T_\text{N}\to   &   \Lambda_\mu(\Gamma_0)   \\};
    \draw[thick, red, -{Stealth}, shorten <=2mm] (P-1-5) |- (2,1) -| ([xshift=-5mm] P.north -|P-1-2);
\end{tikzpicture}

\end{document}

Using the matrix library of TikZ you can target every cell as a node. Those can be used to draw an arrow in between two nodes of that matrix. The positioning defaults to the middle of those nodes, but can be altered.

matrix_arrow

alchemist
  • 1,761
1

An easy way is using the tikzmark library, for which you can draw anything on math formulae. The code is from this answer.

enter image description here

% https://tex.stackexchange.com/a/628856/140722
\documentclass{article}
\usepackage{tikz,amsmath}
\usetikzlibrary{tikzmark}
\usepackage{lipsum} %>>> for dummy text only
\begin{document}
\lipsum[1]
\vspace*{2mm}  % a gap for tikzmark later. Change as you wish

[M:\Sigma^{*}\to \tikzmarknode{stop}{\delta} (q,s)\to\mu(\delta)\to T_\text{N}\to \tikzmarknode{start}{\Lambda_\mu(\Gamma_0)} ] \begin{tikzpicture}[overlay,remember picture] \draw[-stealth,magenta,shorten <=2pt,shorten >=2pt] (start)--+(90:.6)-|(stop); \end{tikzpicture}
\lipsum[2] \end{document}

Black Mild
  • 17,569