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.

Vochmelka
  • 965
  • Please post a Minimal Working Example showing your efforts so far or at least the basics of the document you want to create. It is not really reasonable to rely on others to start from scratch and your chances of success are reduced when you depend wholly upon the fickle tastes of the local team of procrastinators. Meanwhile, see http://tex.stackexchange.com/questions/124127/highlight-and-use-arrows-in-an-equation-in-a-robust-manner?rq=1. – cfr Apr 11 '14 at 03:06
  • Related: http://tex.stackexchange.com/questions/35717/how-to-draw-arrows-between-parts-of-an-equation-to-show-the-math-distributive-pr?lq=1 and http://tex.stackexchange.com/questions/168972/draw-arrows-to-show-multiplication-pattern-distributive-property/169278?noredirect=1#169278 – Holene Apr 11 '14 at 05:19

2 Answers2

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}%
Jesse
  • 29,686
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}
cfr
  • 198,882