4

My intention is to create equation which looks similar to one of examples below (I prefer the second one).

enter image description here

There should be an arrow from JKL to DEF and GHI and from GHI to DEF.

Neither alignment nor equation environment have to be used. Anything that will do is appreciated. Cheers.

2

2 Answers 2

6

Nodes

Based on code blatantly stolen from JLDiaz's answer:

\documentclass{article}
\usepackage{amsmath, amssymb}
\usepackage{tikz}
\usetikzlibrary{arrows,matrix,positioning}% For nice arrow tips
\begin{document}

\tikzset{
    mymatrix/.style = {
        matrix of math nodes,
        nodes={minimum width=6ex},
    }
}

\begin{tikzpicture}
    \matrix[mymatrix, name=M1]{
                \mathrm{ABC}    &   =   &   \mathrm{DEF}    &   +   &   \mathrm{GHI}    &   +   &   \mathrm{JKL} \\
    };
   \draw [red, >=stealth, ->, shorten <= 3pt, shorten >=3 pt]
     (M1-1-7.south) to[bend left=45] (M1-1-5.south);
   \draw [red, >=stealth, ->, shorten <= 3pt, shorten >=3 pt]
     (M1-1-5.south) to[bend left=45] (M1-1-3.south);
   \draw [red, >=stealth, ->, shorten <= 3pt, shorten >=3 pt]
     (M1-1-7.south) to[bend left=60] (M1-1-3.south);
\end{tikzpicture}

\end{document}
8

Another attempt where tikzmark is defined so that each term is a node and simply connect the node with \draw (A) to[bend left=angle] (B);

enter image description here

\newcommand\tikzmark[1]{%
\tikz[remember picture,baseline=(#1.base)]  
\node[inner sep=0,outer sep=3pt] (#1) {#1};
 }

Code

\documentclass[border=2cm]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
%\usepackage[margin=1cm]{geometry}

\newcommand\tikzmark[1]{%
\tikz[remember picture,baseline=(#1.base)]  
\node[inner sep=0,outer sep=3pt] (#1) {#1};%
}

\begin{document}

\tikzmark{ABC} = \tikzmark{DEF} + \tikzmark{GHI} + \tikzmark{JKL}

\begin{tikzpicture}[remember picture,overlay,>=stealth]
\draw[->,red] (GHI) to[bend left =60]  (DEF);
\draw[->,red] (JKL) to[bend left =60]  (GHI);
\draw[->,red] (JKL) to[bend left =60]  (DEF);

\draw[->,blue] (GHI.north) -- ++(0,12pt)  -| (DEF.north);
\draw[->,blue] (JKL.north) -- ++(0,12pt)  -| (GHI.north);
\end{tikzpicture}%

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .