%  $Id: linknodes-us.tex  2009-02-22 12h22 alain matthes $  
%  encoding : utf8 
%  linknodesdoc.tex
%  Created by Alain Matthes  on 2008-01-19.
%  Copyright (C) 2009 Alain Matthes  
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License , either version 1.3
% of this license or (at your option) any later version and/or
% 2. under the GNU Public License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.%
% See http://www.latex-project.org/lppl.txt for details.
%
%
% ``linknodes-us'' is the english doc of tkz-linknodes
%
%
\documentclass[DIV=14,
               fontsize=10,
               headinclude=false,
               index=totoc,
               footinclude=false,
               headings=small]{tkz-doc} 
\usepackage{tkz-linknodes} 
\usepackage{listings,tkzexample}
\usepackage[pdftex,unicode,
                colorlinks=true,
                pdfpagelabels, 
                urlcolor=blue,
                filecolor=pdffilecolor,
                linkcolor=blue,
                breaklinks =false,
                hyperfootnotes=false,
                bookmarks=false,
                bookmarksopen=false, 
                linktocpage=true,
                pdfsubject={2d Drawings},
                pdfauthor={Alain Matthes},
                pdftitle={tkz-base},
                pdfkeywords={base},
                pdfcreator={LaTeX}
                ]{hyperref}  
\usepackage{url}
\def\UrlFont{\small\ttfamily}
\usepackage[protrusion = true,
            expansion,
            final,
            verbose = false,
            babel   = true]{microtype}  

\DisableLigatures{encoding = T1, family = tt*}   
\usepackage[parfill]{parskip}    

\gdef\nameofpack{tkz-linknodes}
\gdef\versionofpack{1.1 c}  
\gdef\dateofpack{2011/06/02}   
\gdef\nameofdoc{doc-linknodes v1.1 c}
\gdef\dateofdoc{2011/06/02} 
\gdef\authorofpack{Alain Matthes}
\gdef\adressofauthor{}
\gdef\namecollection{AlterMundus}    
\gdef\urlauthor{http://altermundus.fr}
\gdef\urlauthorcom{http://altermundus.com} 

\title{The package : tkz-linknodes.sty}
\author{Philippe Ivaldi, Alain Matthes}

\usepackage{shortvrb,fancyvrb} 
\usepackage[english]{babel}
\usepackage[autolanguage]{numprint}   

\parindent=0pt
\begin{document}
\title{\nameofpack}
\date{\today}
\clearpage
\thispagestyle{empty}
\maketitle

\clearpage
\pagecolor{fondpaille}
\color{Maroon} 
\colorlet{graphicbackground}{fondpaille}
\colorlet{codebackground}{Peach!30}
\colorlet{codeonlybackground}{Peach!30}      

  \nameoffile{\nameofpack} 


\defoffile{\tkzname{Tkz-linknodes.sty} arose from a question of \textbf{Philippe Ivaldi}, about \TIKZ. It was a question of knowing if we could easily create links between the lines of an environment as \tkzname{aligned}  or still \tkzname{align} by indicating the operation made between the two lines. With the Philippe's acute remarks and his active collaboration, I hope I can bring you a useful tool.}

\presentation  

\vspace*{1cm}  
\lefthand\ Firstly, I would like to thank \tkzimp{Till Tantau} for the  beautiful LATEX package, namely \TIKZ.

\vspace*{12pt}    
\lefthand\ I am grateful to  \tkzimp{Michel Bovani} for providing the \tkzname{fourier} font.

\vspace*{12pt}
\lefthand\ Finally, I would like to thank \tkzimp{Herbert Vo\ss} for providing
 a very good document  \tkzname{MathMode.pdf}, I used some examples from it. You can find \tkzname{MathMode.pdf} here:\newline
\url{http://dante.ctan.org/indexes/info/math/voss/mathmode/}

\vspace*{12pt}
\lefthand\ Vous trouverez de nombreux exemples sur mes sites~: 
\href{http://altermundus.com/pages/download.html}{altermundus.fr} ou 
\href{http://altermundus.fr/pages/download.html}{altermundus.com}   

\vspace*{12pt}  
Please report typos or any other comments to this documentation to \href{mailto:al.ma@mac.com}{\textcolor{blue}{Alain Matthes}}
This file can be redistributed and/or modified under the terms of the LATEX 
Project Public License Distributed from CTAN archives in directory \url{CTAN:// 
macros/latex/base/lppl.txt}. 

\clearpage
\tableofcontents
\newpage 

\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}

\section{Introduction}

Here is an example of what Philippe wanted when he used the environment \tkzname{aligned} \footnote{The \tkzname{aligned}  environment is similar to the array environment, there exists no  starred version and it has only one equation number and has to be part of another math environment, which should be equation environment.}.

\bigskip

\begin{center}
  \fbox{%
  \begin{minipage}{12cm}
        \begin{NodesList}[margin=3 cm]
       \begin{align}
     3\left(x^2-\frac{2}{3}\right) &= 4                             \AddNode\\
       3x^2-2  &= 4                                                 \AddNode\\
       3x^2    &= 6                                                 \AddNode\\
       \intertext{\hfil isolate the term with the variable \hfil}
        x^2    &= 2                                                 \AddNode\\
 \sqrt{x^2}    &= \sqrt{2}                                          \AddNode\\
      |x|      &= \sqrt{2}                                          \AddNode\\
       x       &= \pm\sqrt{2}                                       \AddNode
         \end{align}
 \LinkNodes{expand}%
 \LinkNodes{$+2$}%
 \LinkNodes{$\div 3$}
 \LinkNodes{$\sqrt{\ldots}$}
 \LinkNodes{$\sqrt{x}=|x|$}
 \LinkNodes{so that}
   \end{NodesList} 
  \end{minipage}}
\end{center}


\bigskip
\tkzname{tkz-linknodes.sty} is based  on
 \tikzname{}, constituted by an  environment   \tkzname{NodesList} and two macros  \tkzcname{AddNode} and  \tkzcname{LinkNodes}.

Philippe and I wanted a maximum of simplicity in the syntax and wish that it so stays even if developments occur. Without another word, it's the simplicity itself.

\vfill\newpage 
\section{Installation}\label{ins}
\subsection{How to install the package \texttt{\textcolor{red}{linknodes.sty}}}

\newcommand{\drawpage}[4]{%
  \begin{scope}[xshift=#1, yshift=#2,font=\footnotesize]
    \filldraw[fill=white!75!#4,draw=#4, very thin]%
   (0,0) -- (4.2,0) -- (4.2,4.85) --(3.21,5.84)-- (0,5.84) -- cycle;
   \fill[fill=#4,shade,top color=#4,bottom color=#4!40]%
       (3.21,5.84) -- ++(0,-0.99) -- ++(0.99,0) -- cycle;
    \path (2.1,2.97) node{#3};
  \end{scope}
}   


It is possible that when you will read this document, \tkzname{tkz-tab} is present on the \tkzname{CTAN}\footnote{\tkzname{tkz-tab} is not still a part of \tkzname{TeXLive} but it will  be soon possible to install it with \tkzname{tlmgr}} server.  If \tkzname{tkz-tab} is not still a part of your distribution, this chapter  shows you how to install it. 
\subsection{With TeXLive under OS X and Linux}\NameDist{TeXLive}

You could simply  create a folder  \tikz[remember picture,baseline=(n1.base)]\node [fill=green!50,draw] (n1) {prof};  which path is : \colorbox{red!50}{ texmf/tex/latex/prof}. \colorbox{green!50}{texmf} is generally the personnal folder. For example the paths of this folder on my two computers are

\medskip
\begin{itemize}\setlength{\itemsep}{10pt}
\item   with OS X\NameSys{OS X} \colorbox{blue!30}{\textbf{/Users/ego/Library/texmf}}; 
\item   with Ubuntu\NameSys{Linux Ubuntu} \colorbox{blue!30}{\textbf{/home/ego/texmf}}.
\end{itemize}

If you choose a custom location for  your files, I suppose that you know why!
The installation that I propose, is valid only for one user.

\medskip
\begin{enumerate}
\item Store the file \tikz[remember picture,baseline=(n2.base)]\node [fill=green!50,draw] (n2) {tkz-linknodes.sty}; in the folder  \colorbox{green!50}{prof}.
\item Open a terminal, then type \texttt{\colorbox{red!50}{sudo texhash}}
\item Check that \textcolor{red}{xkeyval(>=2.5) and tikz 2.0} are installed.
\end{enumerate}

My folder texmf is structured as in the diagram below because I use the \tkzname{CVS}\footnote{You can find the cvs version here : \url{http://www.texample.net/tikz/builds/} without CVS\\ or here with CVS \url{http://sourceforge.net/projects/pgf/}} version of \TIKZ. You don't need all the \tkzname{pgf} folders.

\medskip
\begin{tikzpicture} [remember picture,rotate=90] 

\node (texmf)   at (4,2)    [draw,fill=blue!30 ] {texmf};
\node (tex)     at (6,0)    [draw ]            {tex}; 
\node (doc)     at (0,0)    [draw ]            {doc};
\node (generic) at (7,-4)   [draw ]            {generic};
\node (docgen)  at (0,-4)   [draw ]            {generic};
\node (latex)   at (4,-4)   [draw ]            {latex}; 
\node (pgf)     at (7,-7)   [draw,fill=orange] {pgf};
\node (pre)     at (6,-7)   [draw,fill=orange] {pgf};
\node (xkey)    at (5,-7)   [draw ]            {xkeyval};
\node (four)    at (4,-7)   [draw ]            {fourier};
\node (prof)    at (3,-7)   [draw,fill=green ] {{prof}};
\node (etc)     at (2,-7)   [draw ]            {etc...}; 
\node (dpgf)    at (0,-7)   [draw,fill=orange] {pgf};
\node (qcm)     at (7,-11)  [draw,fill=green ] {alterqcm.sty};
\node (fonc)    at (6,-11)  [draw,fill=orange] {tkz-base.sty};
\node (esp)     at (5,-11)  [draw,fill=orange] {tkz-fct.sty};
\node (tuk)     at (4,-11)  [draw,fill=orange] {tkz-arith.sty};
\node (tab)     at (3,-11)  [draw,fill=orange] {tkz-linknodes.sty};
\node (base)    at (2,-11)  [draw,fill=orange] {tkz-2d.sty};
\node (gra)     at (1,-11)  [draw,fill=orange] {tkz-berge.sty};
\draw (doc.west)        |- (4, 1);
\draw (tex.west)        |- (4, 1);
\draw (latex.west)      |- (6,-2);
\draw (generic.west)    |- (6,-2);
\draw (xkey.west)       |- (5,-6);
\draw (prof.west)       |- (3,-6);
\draw (four.west)       |- (4,-6);
\draw (pre.west)        |- (4,-6); 
\draw (etc.west)        |- (4,-6);
\draw (qcm.west)        |- (3,-9);
\draw (fonc.west)       |- (6,-9);
\draw (esp.west)        |- (5,-9);
\draw (tuk.west)        |- (4,-9);
\draw (tab.west)        |- (3,-9);
\draw (base.west)       |- (2,-9);
\draw (gra.west)        |- (3,-9);
\draw[-open triangle 90] (pgf.west)     --  (generic.east);
\draw[-open triangle 90] (4,1)          --  (texmf.east);
\draw[-open triangle 90] (6,-2)         --  (tex.east);
\draw[-open triangle 90] (4,-6)         --  (latex.east);
\draw[-open triangle 90] (3,-9)         --  (prof.east);
\draw[-open triangle 90] (dpgf.west)    --  (docgen.east);
\draw[-open triangle 90] (docgen.west)  --  (doc.east);
\end{tikzpicture}

\begin{tikzpicture}[remember picture,overlay]
        \path[->,thin,red,>=latex] (n1) edge [bend left] (prof);
        \path[->,thin,red,>=latex] (n2) edge [bend left] (prof);
\end{tikzpicture}

\subsection{How to work with the tkz-\LaTeX-package under Windows?}
\NameDist{MikTeX}\NameSys{Windows XP}
Download and install the following files (if not yet done):
\begin{enumerate}

  \item the \LaTeX-system MiKTeX from

      \url{http://www.miktex.org/}.

      What file you need (e.g.
      \texttt{basic-miktex-2.7.2904.exe}) and how to install
      this program is explained there in the "Download"
      section of the respective version (current version is
      2.7). In general and as usual in windows, you run the
      setup process by starting the setup file :\newline (e.g.\texttt{basic-miktex-2.7.2904.exe}).

  \item Till Tantau's \LaTeX-package \texttt{pgf-tikZ} from

      \url{http://sourceforge.net/projects/pgf/}

      "For MiKTeX, use the update wizard [of MiKTeX] to
      install the (latest versions of the) packages called
      \texttt{pgf}, \texttt{xcolor}, and \texttt{xkeyval}."
      (cited from the pgf manual, contained in the files
      downloaded).
       \item the sty-files and the doc-files of Alain's tkz-package
            from

            \url{http://www.altermundus.fr/pages/download.html}.
    
      or
      
      \url{http://altermundus.com/pages/download.html}.
            To add the files to MiKTeX:

            \begin{itemize}
              \item add a directory \texttt{prof} in the
                  directory \texttt{[MiKTeX-dir]/tex/latex'},
                  e.g. in windows explorer,
              \item copy the sty-files in this directory
                  \texttt{prof},
              \item update the MiKTeX system, ether by running
                  in a DOS shell the command\newline\texttt{"mktexlsr
                  -u"}\newline or by clicking\newline
                  "Start/Programs/Miktex/Settings/General", then
                  push the button "Refresh FNDB".
            \end{itemize}
      \end{enumerate}

\vfill\newpage
\section{How to use the package \texttt{\textcolor{red}{linknodes.sty}}}

\bigskip
You can compile with pdflatex but you have to compile your document
twice!
It's possible to compile with   latex but only if the version of pdftex is equal to or greater than  1.40.

\bigskip
\begin{center}
\begin{tikzpicture}[>=triangle 45,scale=.75]
  \drawpage{0cm}{0cm}{\texttt \blue file.tex}{blue}
  \drawpage{16cm}{0cm}{\texttt \red file.pdf}{red}
  \path (8.05,2.9) node(A) 
      [diamond,%
       draw,color=black,fill=red,%,%
      text = black,%
      minimum size = 3 cm,%
      font         = \normalsize] 
     {{\texttt pdflatex}};  
  \path (12.1,2.9) node(B) 
     [diamond,%
      draw,color=black,fill=red,%,%
      text = black,%
      minimum size = 3 cm,%
      font         = \normalsize] 
     {{\texttt pdflatex}};
  \draw[->] (4.2,2.9) -- (A.west);
  \draw[->] (B.east) -- (16,2.9);
\end{tikzpicture}
\end{center}

The package loads,tries to load \tkzname{xkeyval}[2005/11/25], \tkzname{tikz}[2007/06/07] version 2.00, \tkzname{amsmath},  \tkzname{etex} and \tkzname{ifthen}.

\bigskip
\subsection{Minimal example but complete}

{
\definecolor{codebackground}{rgb}{0,0,0}
\blanc
\begin{tkzexample}[code only,vbox,small,num]
\documentclass[]{article}
\usepackage[utf8]{inputenc}
\usepackage[upright]{fourier}
\usepackage{tkz-linknodes}
\begin{document}
 \begin{NodesList}
 \[ % formula no "inline"
   \begin{aligned}
       2x     &= 8                                               \AddNode\\
       x      &= 4                                               \AddNode
   \end{aligned}
 \]
 \LinkNodes{$\div 2$}
 \end{NodesList}
\end{document}\end{tkzexample}}

\bigskip
\subsection{Result}
 \begin{NodesList}
 \[ % formula no "inline"
   \begin{aligned}
       2x     &= 8                                               \AddNode\\
       x      &= 4                                               \AddNode
   \end{aligned}
 \]
 \LinkNodes{$\div 2$}%
 \end{NodesList}

\vfill\newpage                         
              
 \section{Essential environment \texttt{\textcolor{red}{NodesList}} and  macros \textcolor{red}{ \addbs{LinkNodes}} and \textcolor{red}{ \addbs{AddNode}}}

\subsection{The environment \texttt{\textcolor{red}{NodesList}}}

\begin{NewEnvBox}{NodesList} 


\begin{tabular}{>{\color{green!50!black}}lll}
\hline
options & default  & definition                                              \\
\hline
\IoptNameEnv{NodesList}{margin}   & \tkzdft{2cm}    & right margin            \\
\IoptNameEnv{NodesList}{dy}      & \tkzdft{1.5pt}  & $2\times \text{dy}$ is the space between two adjacent arrows on the same node.   \\
\hline
\end{tabular}


\medskip
\noindent\emph{The use of this environment is obligatory. It admits options which we are going to detail in the following examples. These options are not obligatory and the values by default are given in the table above.}
\end{NewEnvBox}   
\subsection{The command \textcolor{red}{ \addbs{AddNode}}} 

\begin{NewMacroBox}{AddNode}{\oarg{options}}

  \begin{tabular}{>{\color{green!50!black}}lll}
  \hline
  options & default  & definition                                     \\
  \hline
  \IoptName{AddNode}{number}   & \tkzdft{1}    & It defines to which group belongs this node          \\
  \hline
  \end{tabular}
  
\medskip
\emph{An optional argument is possible, thus placed between hooks if it is present, and it is an integer superior to 1. It defines to which group belongs this node.}

\medskip
 
\emph{This macro allows to ask that a link can leave or arrive of the node which we have just created. Really, it is not a node, I would say rather an anchor either another a reference point.\\
A group is a set of links (arrows). The origin of the one is the extremity of the precedent. The first group is noted 1 which is the value by default.}
 \end{NewMacroBox}
 \subsection{The command \textcolor{red}{ \addbs{LinkNodes}}} 


\begin{NewMacroBox}{LinkNodes}{\oarg{options}\var{expression}}

\medskip
\begin{tabular}{>{\color{green!50!black}}lllc}
\hline
options   & default   & definition                                          \\
\hline
\IoptName{LinkNodes}{margin}& \tkzdft{2 cm}   & right margin                  \\
\IoptName{LinkNodes}{dy}   & \tkzdft{1.5 pt}  & $2\times \text{dy}$ is the space between two adjacent arrows on the same node.   \\
\hline
\end{tabular}

\medskip
\emph{This macro allows the representation of the link between nodes and the label the contents of which are "expression" placed on this link. These links are created by following the order of their creation. 
}

\end{NewMacroBox} 
The style of these links is determined by the default following styles :
\begin{itemize}
  \item \tkzcname{tikzset\{ArrowStyle/.style=\{>=latex,->,text=black\}\}}
  \item \tkzcname{tikzset\{LabelStyle/.style=\{pos=0.25,right\}\}}
  \item \tkzcname{tikzset\{NodeStyle/.style=\{\}\}}
\end{itemize}

The first style is for the arrows then we have a style for the labels and the last style is for the node, by default it is empty.

\medskip
As you notice it, the macro are simple and the syntax is \LATEX syntax. It will be necessary to you to study a little \tkzname {TikZ} only to modify the styles but some examples should  be sufficient  to realize what you wish.

% Comme vous  le constatez, les macros sont simples et la syntaxe est du type \LATEX. Il vous faudra étudier un peu \tkzname{TikZ} seulement pour modifier les styles mais quelques exemples devraient vous suffir pour réaliser ce que vous souhaitez.


\section{The code of the example in the introduction}

\subsection{The code of the first example}
 \Iopt{LinkNodes}{margin} 
Let us see first of all, the example of the introduction but placed in a more general frame, that of a page A4. Four nodes  are created at the end of every line, then three links, both first ones have a personalized margin.

The environment \tkzname{aligned} is placed in an environment \tkzname {displaymath} that is "in display mathematical mode". It means that the equations are placed in a box having the width of the page and that the sign equals is situated in the center of a line.

\begin{tkzexample}[vbox,small,num]
 \begin{NodesList}
   \begin{align}
      \boxed{ 3(x^2-3) =4 }                                         \AddNode\\
      x^2-3  =\frac{4}{3}                                           \AddNode\\
      \intertext{\hfil isolate the term with the variable \hfil}
      x^2    =\frac{13}{3}                                          \AddNode\\
      \sqrt{x^2}    =\sqrt{\frac{13}{3}}                            \AddNode\\
       |x|   =\sqrt{\frac{13}{3}}                                   \AddNode\\
      x      =\pm\sqrt{\frac{13}{3}}                                \AddNode
   \end{align}
   \LinkNodes[margin=1cm]{$\div 3$}%
   \LinkNodes[margin=1.5cm]{$+3$}%
   \LinkNodes[margin=2.5cm]{$\sqrt{\ldots}$}
   \LinkNodes[margin=3cm]{$\sqrt{x^2}=|x|$}
   \LinkNodes[margin=4.5cm]{we have two answers}
 \end{NodesList}\end{tkzexample}

\medskip

That the environment \tkzname {NodesList} makes exactly. It tracks down the width of the line of the page which goes the receive here this width is the width of the text because we are in a display mathematical mode. The example of the introduction is placed in an environment \tkzname {minipage} of \LaTeX, thus the width will  be the one attributed to minipage.
% Que fait exactement l'environnement \tkzname{NodesList}. Il repère la largeur de la ligne de la page qui va l'accueillir ici cette largeur est la largeur  du texte car nous sommes dans un environnement mathématique hors texte. L'exemple de l'introduction est placé dans un environnement \tkzname{minipage} de \LaTeX{}, la largeur sera donc celle attribuée à celui-ci.

 Then, it prepares a list of counters to attribute automatically names to the nodes that the user will have placed with the macro \tkzcname{AddNode}. The macro \tkzcname{LinkNodes} represents a link between two successive nodes.

\subsection{With the environment \tkzname{minipage}}
\Iopt{LinkNodes}{margin}   \Ienv{minipage} 
Thus we go to see what arrives at our environment in the case of an environment \tkzname {minipage}. In that case the width of the page is given by  \tkzname {minipage}. The result can be seen  below, we need to modify the last margin :

\medskip
\begin{center}\fbox{\begin{minipage}{12cm}
 \begin{NodesList}
  \[
    \begin{aligned}
      3(x^2-3) &=4                                                   \AddNode\\
      x^2-3  &=\frac{4}{3}                                           \AddNode\\
      x^2    &=\frac{13}{3}                                          \AddNode\\
      \sqrt{x^2}    &=\sqrt{\frac{13}{3}}                            \AddNode\\
       |x|   &=\sqrt{\frac{13}{3}}                                   \AddNode\\
      x      &=\pm\sqrt{\frac{13}{3}}                                \AddNode
      \end{aligned}
  \]
   \LinkNodes[margin=1cm]{$\div 3$}%
   \LinkNodes[margin=1.5cm]{$+3$}%
   \LinkNodes[margin=2.5cm]{$\sqrt{\ldots}$}
   \LinkNodes[margin=3cm]{$\sqrt{x^2}=|x|$}
   \LinkNodes[margin=4cm]{we have two answers}
 \end{NodesList}
\end{minipage}}\end{center}

\medskip
\Ienv{minipage} \Ienv{displaymath} 
{
\definecolor{codebackground}{rgb}{0,0,0}
\blanc
\begin{tkzexample}[code only,vbox,small,num]
\documentclass[]{article}
\usepackage[utf8]{inputenc}     % My favorite encoding but not indispensable.
\usepackage[upright]{fourier}   % My favorite font.
\usepackage{LinkNodes}
\begin{document}
\begin{center}\fbox{\begin{minipage}{12cm}
  \begin{NodesList}
  \begin{displaymath}
   \begin{aligned}
      3(x^2-3) &=4                                                   \AddNode\\
      x^2-3  &=\frac{4}{3}                                           \AddNode\\
      x^2    &=\frac{13}{3}                                          \AddNode\\
      \sqrt{x^2}    &=\sqrt{\frac{13}{3}}                            \AddNode\\
       |x|   &=\sqrt{\frac{13}{3}}                                   \AddNode\\
      x      &=\pm\sqrt{\frac{13}{3}}                                \AddNode
      \end{aligned}
   \end{aligned}
  \end{displaymath}
  \LinkNodes[margin=4 cm]{$\div 3$}
  \LinkNodes[margin=3 cm]{$+3$}
  \LinkNodes{$\sqrt{\ldots}$}
  \end{NodesList}
  \end{minipage}}\end{center}
\end{document}\end{tkzexample}}



\section{Options with effects on the structure}

\subsection{One link between the first two lines}
I take the same example and I try to modify it. I want only the first link so I create only two nodes and one link.
\Ienv{displaymath}

\begin{tkzexample}[vbox,small,num]
\begin{NodesList}
  \begin{displaymath}
    \begin{aligned}
      3(x^2-3) &= 4                                                 \AddNode\\
        x^2-3  &= \frac{4}{3}                                       \AddNode\\
        x^2    &= \frac{13}{3}                                              \\
  \sqrt{x^2}  &=\sqrt{\frac{13}{3}}                                         \\
       |x|   &=\sqrt{\frac{13}{3}}                                          \\
      x      &=\pm\sqrt{\frac{13}{3}}                                 
      \end{aligned}
  \end{displaymath}
  \LinkNodes{$\div 3$}%
\end{NodesList}\end{tkzexample}


\subsection{One link between the last two lines}
\begin{tkzexample}[vbox,small,num]
\begin{NodesList}
  \begin{displaymath}
     \begin{aligned}
        3(x^2-3) &= 4                                                       \\
          x^2-3  &= \frac{4}{3}                                             \\
          x^2    &= \frac{13}{3}                                    \AddNode\\
  \sqrt{x^2}  &=\sqrt{\frac{13}{3}}                                 \AddNode\\
       |x|   &=\sqrt{\frac{13}{3}}                                          \\
      x      &=\pm\sqrt{\frac{13}{3}}                               
      \end{aligned}
  \end{displaymath}
  \LinkNodes{$\sqrt{\ldots}$}
\end{NodesList}\end{tkzexample}


\subsection{How to create a new group}
\Iopt{AddNode}{new group} \Iopt{AddNode}{groups}\Ienv{displaymath}
We saw how having a link on the first nodes  , as well as on the last ones, now here is an example to have a link on the first  and the last nodes.

The principle is simple. The argument 2 indicates that we create another chain of links. It was already present but 1 is optional.
The arguments must be created in  increasing   order.

\begin{tkzexample}[vbox,small,num]
\begin{NodesList}
 \begin{displaymath}
  \begin{aligned}
   3(x^2-3) &=4                                                  \AddNode   \\
     x^2-3  &= \frac{4}{3}                                       \AddNode   \\
     x^2    &= \frac{13}{3}                                      \AddNode[2]\\
  \sqrt{x^2}  &=\sqrt{\frac{13}{3}}                              \AddNode[2]\\
       |x|   &=\sqrt{\frac{13}{3}}                                          \\
      x      &=\pm\sqrt{\frac{13}{3}}                 
  \end{aligned}
 \end{displaymath}
 \LinkNodes{$\div 3$}%
 \LinkNodes{$\sqrt{\ldots}$}
\end{NodesList}\end{tkzexample}

\subsection{Two   groups on the same line}
We can also do that. 
\Iopt{AddNode}{two groups on the same line}
\begin{tkzexample}[vbox,small,num]
	\begin{NodesList}[margin=3cm]
	 \begin{displaymath}\displaywidth=.4\linewidth
	   \begin{aligned}
	      x^2-4       & = 0                            \AddNode \AddNode[2]\\
	      (x-2)(x+2)  & = 0                                                \\
	     \left.\begin{aligned}                        
	              x-2 & = 0                                        \AddNode\\
	              x   & = 2                                                \\
	                  &                                                    \\
	              x+2 & = 0                                     \AddNode[2]\\
	              x   & = -2                                               \\
	           \end{aligned}\right\}                                       \\
	     \end{aligned}
	 \end{displaymath}
	  {\tikzset{LabelStyle/.style = {left=5cm,pos=.5,above,text=red}} 
	  \LinkNodes[margin=5cm]{ first factor is null}%
	   \LinkNodes{Or  second factor is null}%
	  }
	\end{NodesList}\end{tkzexample}


\subsection{Empty line}
\index{Empty line}\Iopt{LinkNodes}{margin} \Ienv{aligned}
You can try this example without \tkzcname{hfill} at line 5.
\begin{tkzexample}[vbox,small,num]
 \begin{minipage}{10cm}
	 \begin{NodesList}[margin=-2cm]
	     \[\left\{
	    \begin{aligned}
	      d_n & =  \displaystyle {400-\frac{v_n}{3}}              \AddNode\hfill\\
	          &                                                                 \\
	      v_n & =   0,8v_{n-1}+0,2d_n+9,6                               \AddNode\\
	      \end{aligned}
	     \right.\]
	   \LinkNodes{$v_n$ and $d_n$  are dependent}
	\end{NodesList}
 \end{minipage}\end{tkzexample}

\section{Options with effects on the presentation}
These options are among two, \tkzname{margin} and \tkzname {dy}. They are useful globally at the level of the environment \tkzname{NodesList} either locally at the level of the macro \tkzcname{LinkNodes}.

\subsection{Option \tkzname{margin}}
\Iopt{LinkNodes}{margin} \Ienv{aligned} \Ienv{minipage} 
First of all, let us remind that the default margin  is 2 cm. It is represented by the red arrow on the following figure. The margin is defined from the right edge of the box which begins the environment.   

\medskip
  \begin{center}
    \setlength{\fboxsep}{0pt}
    \fbox{\begin{minipage}{12cm}
 \begin{NodesList}
  \begin{displaymath}
    \begin{aligned}
      3(x^2-3) &=4                                                   \AddNode\\
        x^2-3  &=\frac{4}{3}                                         \AddNode\\
        x^2    &=\frac{13}{3}                                        \AddNode\\
      \sqrt{x^2}    &=\sqrt{\frac{13}{3}}                            \AddNode\\
       |x|   &=\sqrt{\frac{13}{3}}                                   \AddNode\\
      x      &=\pm\sqrt{\frac{13}{3}}                                \AddNode
      \end{aligned}
  \end{displaymath}
  \LinkNodes[margin=4cm]{$\div 3$}%
  \LinkNodes[margin=3cm]{$+3$}%
  \LinkNodes{$\sqrt{\ldots}$}
  \tikz[remember picture,overlay]%
  \draw[>=latex',red,<->](Inter) to node[above]{2 cm}%
        ([shift={(2cm,0)}]Inter);
 \end{NodesList}
\end{minipage}}%
\end{center}

\medskip
It is necessary to notice that the box of the introduction is slightly different from  this one. Indeed, the macro \tkzcname{fbox} adds a space around its equal contents in \tkzcname{fboxsep}. This one was put in zero for the occasion.

\subsection{Equal margins}
\IoptEnv{NodesList}{margin} \Ienv{aligned} \Ienv{displaymath}
I suppose that you understood that the option \tkzname{margin} of the macro \tkzcname{LinkNodes} plays the same role as that of the environment. So having deleted them, I choose a margin of 3 cm as everybody.
This time with regard to the edge of the text field of the page.


\begin{NodesList}[margin=3cm]
 \begin{displaymath}
  \begin{aligned}
   3(x^2-3)   &= 4                                                    \AddNode\\
     x^2-3    &= \frac{4}{3}                                          \AddNode\\
     x^2      &= \frac{13}{3}                                         \AddNode\\
\sqrt{x^2}    &=\sqrt{\frac{13}{3}}                                   \AddNode\\
       |x|    &=\sqrt{\frac{13}{3}}                                   \AddNode\\
      x       &=\pm\sqrt{\frac{13}{3}}                                \AddNode
  \end{aligned}%
 \end{displaymath}%
 \LinkNodes{$\div 3$}%
 \LinkNodes{$+3$}%
 \LinkNodes{$\sqrt{\ldots}$}%
 \tikz[remember picture,overlay]%
 \draw[>=latex',red,<->](Inter) to node[above]{3 cm}%
                       ([shift={(3cm,0)}]Inter);%
\end{NodesList}


\begin{tkzexample}[code only,small,num]
\begin{NodesList}[margin=3cm]% By default, margin = 2cm.
 \begin{displaymath}
  \begin{aligned}
   3(x^2-3)   &= 4                                                    \AddNode\\
     x^2-3    &= \frac{4}{3}                                          \AddNode\\
     x^2      &= \frac{13}{3}                                         \AddNode\\
\sqrt{x^2}    &=\sqrt{\frac{13}{3}}                                   \AddNode\\
       |x|    &=\sqrt{\frac{13}{3}}                                   \AddNode\\
      x       &=\pm\sqrt{\frac{13}{3}}                                \AddNode
  \end{aligned}%
 \end{displaymath}%
 \LinkNodes{$\div 3$}%
 \LinkNodes{$+3$}%
 \LinkNodes{$\sqrt{\ldots}$}%
\end{NodesList}\end{tkzexample}

\subsection{Negative margins}
\IoptEnv{NodesList}{negative margin} \IoptEnv{displaymath}{displaywidth}
Yes we can! The example is from \tkzname{MathMode.pdf}
In this example, I use \tkzcname{displaywidth}

\begin{NodesList}[margin=-1cm]
  \begin{displaymath}\displaywidth=.4\linewidth
	\begin{aligned} 
	y &= 2x^2 -3x +5                          \AddNode\\
  & \hphantom{= \ 2\left(x^2-\frac{3}{2}\,x\right. }% 
      \textcolor{blue}{% 
        \overbrace{\hphantom{+\left(\frac{3}{4}\right)^2- % 
          \left(\frac{3}{4}\right)^2}}^{=0}}   \\       
  &= 2\left(\textcolor{red}{% 
       \underbrace{% 
           x^2-\frac{3}{2}\,x + \left(\frac{3}{4}\right)^2}% 
   }% 
   \underbrace{% 
        - \left(\frac{3}{4}\right)^2 + \frac{5}{2}}% 
   \right)                                      \AddNode\\
   &= 2\left(\qquad\textcolor{red}{\left(x-\frac{3}{4}\right)^2} 
   \qquad + \ \frac{31}{16}\qquad\right)  \AddNode\\           
y  
   &= 2\left(x\textcolor{cyan}{-\frac{3}{4}}\right)^2\textcolor{blue}{+\frac{31}{8}}\AddNode 
\end{aligned} 
 	     \end{displaymath}
{ 	       \tikzset{LabelStyle/.append style = {left,text=red}}
    \LinkNodes{%
    \begin{minipage}{5cm}
      $2x^2 -3x$ is the beginning of an algebraic identity %
       (binomial formula)
      \end{minipage}}
       \LinkNodes{$(a-b)^2=a^2-2ab+b^2$}
       \LinkNodes{after simplication, the result is}}
\end{NodesList}

\begin{tkzexample}[vbox,small,num,code only]	      
\begin{NodesList}[margin=-1cm]
  \begin{displaymath}\displaywidth=.4\linewidth
	\begin{aligned} 
	y &= 2x^2 -3x +5                          \AddNode\\
  & \hphantom{= \ 2\left(x^2-\frac{3}{2}\,x\right. }% 
      \textcolor{blue}{% 
        \overbrace{\hphantom{+\left(\frac{3}{4}\right)^2- % 
          \left(\frac{3}{4}\right)^2}}^{=0}}   \\       
  &= 2\left(\textcolor{red}{% 
       \underbrace{% 
           x^2-\frac{3}{2}\,x + \left(\frac{3}{4}\right)^2}% 
   }% 
   \underbrace{% 
        - \left(\frac{3}{4}\right)^2 + \frac{5}{2}}% 
   \right)                                      \AddNode\\
   &= 2\left(\qquad\textcolor{red}{\left(x-\frac{3}{4}\right)^2} 
   \qquad + \ \frac{31}{16}\qquad\right)  \AddNode\\           
y  
   &= 2\left(x\textcolor{cyan}{-\frac{3}{4}}\right)^2\textcolor{blue}{+\frac{31}{8}}\AddNode 
\end{aligned} 
 	     \end{displaymath}
{ 	       \tikzset{LabelStyle/.append style = {left,text=red}}
    \LinkNodes{%
    \begin{minipage}{5cm}
      $2x^2 -3x$ is the beginning of an algebraic identity %
       (binomial formula)
      \end{minipage}}
       \LinkNodes{$(a-b)^2=a^2-2ab+b^2$}
       \LinkNodes{after simplication, the result is}}
\end{NodesList}	      
\end{tkzexample}

	      
\subsection{The general option \tkzname{dy}}
\IoptEnv{NodesList}{dy} \IoptEnv{NodesList}{margin}
Here, it is a question  of adjusting the distance between two arrows. The distance is equal in 
$2\times \text{dy}$

\begin{tkzexample}[vbox,small,num]
\begin{NodesList}[margin=3cm,dy=3pt]% 
 \begin{displaymath}
  \begin{aligned}
   3(x^2-3)   &= 4                                                    \AddNode\\
     x^2-3    &= \frac{4}{3}                                          \AddNode\\
     x^2      &= \frac{13}{3}                                         \AddNode\\
\sqrt{x^2}    &=\sqrt{\frac{13}{3}}                                   \AddNode\\
       |x|    &=\sqrt{\frac{13}{3}}                                   \AddNode\\
      x       &=\pm\sqrt{\frac{13}{3}}                                \AddNode
  \end{aligned}
 \end{displaymath}
 \LinkNodes{$\div 3$}%
 \LinkNodes{$+3$}%
 \LinkNodes{$\sqrt{\ldots}$}
\end{NodesList}\end{tkzexample}


\section{Modification of the style}
 \IstyleEnv{NodesList}{ArrowStyle}      \IstyleEnv{NodesList}{LabelStyle}   \IstyleEnv{NodesList}{NodeStyle}
It is enough for it to modify either \tkzname {\{ArrowStyle\}}, or \tkzname {\{LabelStyle\}}. By default, the values are the following ones 

\tikzset{ArrowStyle={>=latex',->,black}} 

\tikzset{LabelStyle={pos=0.25,right,text=black}}

\tikzset{NodeStyle={}}

\subsection{Adding some style}


At first, the shape of the arrow is modified as well as its color. For other forms of arrow, see the documention on the  \tkzname{pgfmanual}.

Then the place of the label is modified with \tkzdft{pos=0.75} . \tkzdft{pos=0} corresponds to the superior corner, \tkzdft{pos=0.25 } in the middle of the vertical line. We can then adjust the position of the node, here \tkzname{above}  is used. For other adjustments, see \tkzname{pgfmanual} or the following examples.

\begin{tkzexample}[vbox,small,num]
  \begin{NodesList}
 \[
   \begin{aligned}
       2x     &= 8                                               \AddNode\\
       x      &= 4                                               \AddNode
   \end{aligned}
 \]
  {\tikzset{ArrowStyle/.style={>=stealth',->,cyan}} 
   \tikzset{LabelStyle/.style={pos=0.75,above,text=red}}
   \LinkNodes{$\div 2$}}
\end{NodesList}\end{tkzexample}

\subsection{Modification of the text color}
 \IstyleEnv{NodesList}{Label color}  
 Since styles are just special cases of pgfkeys’s general style facility, you can actually do quite a bit more. 
Let us start with adding options to an already existing style. This is done using /.append style instead of /.style: 

 \tkzname{.append style} allows  to take back the values of the style \tkzname{LabelStyle} by adding the color\footnote{Another possibility is  \tkzcname
{LinkNodes{\BS textcolor\{orange\}\{\$\BS div\ 2\$\}}}} \tkzname{red} in the text which replaces the old color. Note that two colors are set, so the last one will “win.”


\begin{tkzexample}[vbox,small,num]
  \begin{NodesList}
 \[
   \begin{aligned}
       2x     &= 8                                               \AddNode\\
       x      &= 4                                               \AddNode
   \end{aligned}
 \]
  {\tikzset{LabelStyle/.append style = {text=red}}
   \LinkNodes{$\div 2$}}
\end{NodesList}\end{tkzexample}

\subsection{Modification of the text position}
    \IstyleEnv{NodesList}{label position}  \Ienv{aligned}
 You need to read the paragraph of \tkzname{pgfmanual}   "Basic Placement Options". You can use \tkzname{left}, \tkzname{right}, \tkzname{above} and \tkzname{below} but also something like   \tkzname{above right} or \tkzname{left = 2 cm}.
 
\begin{tkzexample}[vbox,small,num]
\begin{NodesList}
 \[
   \begin{aligned}
       2x     &= 8                                               \AddNode\\
       x      &= 4                                               \AddNode
   \end{aligned}
 \]
  {\tikzset{LabelStyle/.append style = {text=red,left}}
   \LinkNodes{$\div 2$}}
\end{NodesList}\end{tkzexample}

\subsection{Boxed text}
   \IstyleEnv{NodesList}{Boxed label }  
A little more sophisticated: \tkzname{draw} allows to frame, \tkzname{right=10pt} allows to move away a little the label, \tkzname{green} defines the color of the line, \tkzname {fill=green!30} defines the color of filling and finally the color of the text is red.

\begin{tkzexample}[vbox,small,num]
\begin{NodesList}
 \[
   \begin{aligned}
       2x     &= 8                                               \AddNode\\
       x      &= 4                                               \AddNode
   \end{aligned}
 \]
{\tikzset{LabelStyle/.style = {draw,right=10pt,red,fill=green!30,text=red}} 
   \LinkNodes{$\div 2$}}
\end{NodesList}\end{tkzexample}


\section{Some more complex examples}
\subsection{Solution of two simultaneous equations.}
\Ienv{matrix}\Ienv{minipage}
Solution of two simultaneous equations. The problem is to find the set of all solutions that satisfies both equations. These are called simultaneous equations.

\begin{tkzexample}[vbox,small,num]
 \begin{minipage}{12cm}
	 \begin{NodesList}[dy=3pt]
	 \[ \left\{\begin{matrix}
	 3x 	&+&	4y  		&=&	10\\
	 2x		&+& 	y		&=&	5  \AddNode\\
	 \end{matrix}\right. \] 
\vspace{0.5cm}
	 \[ \left\{\begin{matrix}
	 3x 	&+&	4y  		&=&	10\\
	 8x		&+& 	4y		&=&	20  \AddNode\\
	 \end{matrix}\right. \] 
\vspace{0.5cm}
	 \[ \left\{\begin{matrix}
	 3x 	&+&	4y  		&=&	10  \\
	 5x		&& 			  &=&	10  \AddNode\\
	 \end{matrix}\right. \] 
\vspace{0.5cm}
	 \[ \left\{\begin{matrix}
	 3(2) 	&+&	4y  		&=&	10\\
	 x		&& 			  &=&	2  \AddNode\\
	 \end{matrix}\right. \] 
\vspace{0.5cm}
	 \[ \left\{\begin{matrix}
	 3(2) 	&+&	4y  		&=&	10\AddNode\\
	 x		&& 			  &=&	2  \\
	 \end{matrix}\right. \] 
\vspace{0.5cm}
	 \[ \left\{\begin{matrix}
	 4y  		&=&	10-6\AddNode\\
	 x				  &=&	2  \\
	 \end{matrix}\right. \] 
\vspace{0.5cm}
	 \[ \left\{\begin{matrix}
	 y  		&=&	1 \AddNode\\
	 x				  &=&	2  \\
	 \end{matrix}\right. \] 
	\LinkNodes{\begin{minipage}{3cm}
	   both sides of second equation  are multiplied by 4\end{minipage}}
	\LinkNodes{\begin{minipage}{3cm}
	  The first equation  is subtracted from  second \end{minipage}}
	\LinkNodes[margin=4 cm]{$\div 5$} 
	\LinkNodes{\begin{minipage}{3cm}
	  As a result, $x = 2$, this value is then substituted in the first equation
	\end{minipage}}
	\LinkNodes{%
	\begin{minipage}{3cm}
	      $6$ is subtracted from both sides\end{minipage}}
	         \LinkNodes[margin=4 cm]{$\div 4$}
	\end{NodesList}
	
	The solution is $\{(x=2~;~y=1)\}$
 \end{minipage}\end{tkzexample}


\subsection{Nested Environments aligned}
\index{Nested Environments}\IoptEnv{NodesList}{margin}
 \IstyleEnv{NodesList}{LabelStyle}   \Ienv{aligned}
This example is more complex because the environments are nested.

\begin{tkzexample}[vbox,small,num]
\begin{NodesList}[margin=0cm]
 \begin{displaymath}
   \begin{aligned}
      x^2-4       & = 0                                           \AddNode\\
      (x-2)(x+2)  & = 0                                           \AddNode\\
     \left.\begin{aligned}
              x-2 & = 0                                                   \\
              x   & = 2                                                   \\
                  &                                                       \\
              x+2 & = 0                                                   \\
              x   & = -2                                                  \\
           \end{aligned}\right\}                                 \AddNode\\
     \end{aligned}
 \end{displaymath}
  {\tikzset{LabelStyle/.style = {left=0.1cm,pos=.25,text=red}} 
  \LinkNodes[]{factorisons}%
   \LinkNodes{One of the factors is null}%
  }
\end{NodesList}\end{tkzexample}

\subsection{One environment and two groups}
\Iopt{AddNode}{groups}\Ienv{align}
\begin{tkzexample}[vbox,small,num]
    \begin{NodesList}[margin=4 cm,dy=3pt]
       \begin{align}
     3\left(x^2-\frac{2}{3}\right) &= 4                             \AddNode\\
       3x^2-2  &= 4                                                 \AddNode\\
       3x^2    &= 6                                                 \AddNode\\
        x^2    &= 2                                                 \AddNode[2]\\
 \sqrt{x^2}    &= \sqrt{2}                                          \AddNode[2]\\
      |x|      &= \sqrt{2}                                          \AddNode[2]\\
       x       &= \pm\sqrt{2}    
         \end{align}
 \LinkNodes{expand}%
 \LinkNodes{$+2$}%
 \LinkNodes[margin=5 cm]{$\sqrt{\ldots}$}
 \LinkNodes[margin=5 cm]{$\sqrt{x}=|x|$}
    \end{NodesList} \end{tkzexample}


\vfill\newpage
\subsection{Two environments and a group}
\IoptEnv{NodesList}{margin}\Ienv{aligned}
\begin{tkzexample}[vbox]
\begin{NodesList}[margin=0.5cm]
 \begin{displaymath}
   \begin{aligned}
      x^2-4       &= 0                                              \AddNode\\
      (x-2)(x+2)  &= 0                                              \AddNode\\
      {\left.
         \begin{aligned}
             x-2 &= 0                                                       \\
             x   &= 2                                                       \\
                 &                                                          \\
             x+2 &= 0                                                       \\
             x   &= -2                                                      \\
         \end{aligned}
       \right\}%
      }                                                            \AddNode\\
     \end{aligned}
 \end{displaymath}
{\tikzset{LabelStyle/.style = {left=0.5cm,pos=.25,text=red}}
 \LinkNodes[]{The first member can be factored as}%
 \LinkNodes{One of the factors is null}%
}
\end{NodesList}\end{tkzexample}

\vfill\newpage
\subsection{Label with  \tkzname{minipage}}
  \Ienv{minipage} \Ienv{aligned}
You can see in this example how to define  a style if you want to place correctly a "minipage".
\IoptEnv{NodesList}{margin}\IoptEnv{NodesList}{dy}
\begin{tkzexample}[vbox,small,num]
\begin{NodesList}[margin=1cm,dy=3pt]
  \begin{displaymath}
    \begin{aligned}
        x^2-4       &= 0                                           \AddNode\\
        (x-2)(x+2)  &= 0                                           \AddNode\\
                    &\left.%
                     \begin{aligned}
                             x-2 &= 0                                      \\
                             x   &= 2                                      \\
                                 &                                         \\
                             x+2 &= 0                                      \\
                             x   &= -2                                       
                     \end{aligned}%
                     \right\}\AddNode%
    \end{aligned}%
  \end{displaymath}
  {\tikzset{LabelStyle/.style = {left=0.1cm,pos=.25,text=red}}
  \LinkNodes{The first member can be factored as}%
  \tikzset{LabelStyle/.append style = {pos=.5,sloped}}
  \LinkNodes{%
\fbox{\begin{minipage}{4cm}
     If the product of any two numbers is zero, %
      then one or both of the numbers is zero
  \end{minipage}%
}
  }%
  }%
\end{NodesList}\end{tkzexample}

\vfill\newpage
\subsection{Three groups  and few environments aligned}
 \IoptEnv{displaymath}{displaywidth}\Iopt{AddNode}{groups}
It is interesting to notice the use of \tkzcname{displaywidth} which allows in display mathematical mode to modify the placement with regard to the left margin.

\medskip
Solve in \textbf{R} : 
\colorbox{black}{\textcolor{white}{$\left(\dfrac{2}{3}-3x\right)\left(\dfrac{3}{5}+2x\right)=0 $}}

\medskip
\begin{NodesList}[dy=3]
  \begin{displaymath}\displaywidth=.8\linewidth
    \begin{aligned}
      &\left(\frac{2}{3}-3x\right)\left(\frac{3}{5}+2x\right)=0     \AddNode\\
      &{\begin{aligned}
          &\Longleftrightarrow&&%
          \left\{{%
            \begin{aligned}
              \frac{2}{3}-3x&=0                                 \AddNode[2]&\\
              \text{ou}&&                                       \AddNode    \\
              \frac{3}{5}+2x&=0                                 \AddNode[3]&\\
            \end{aligned}}%
          \right.                                                           \\
        &\Longleftrightarrow&&%
        {%
          \left\{%
          \begin{aligned}
            2-9x&=0                                              \AddNode[2]\\
            \text{ou}&                                                      \\
            3+10x&=0                                             \AddNode[3]\\
          \end{aligned}\right.}                                             \\
        &\Longleftrightarrow&&%
        {%
          \left\{%
          \begin{aligned}
             2&=9x                                               \AddNode[2]\\
                    \text{ou}&                                              \\
            10x&=-3                                              \AddNode[3]\\
          \end{aligned}\right.}                                             \\
         &\Longleftrightarrow&&%
        {%
          \left\{%
          \begin{aligned}
            x&=\frac{2}{9}                                       \AddNode[2]\\
            \text{ou}&                                                      \\
            x&=-\frac{3}{10}                                     \AddNode[3]\\
          \end{aligned}\right.}                                             \\
       \end{aligned}}
    \end{aligned}
  \end{displaymath}
 \LinkNodes[margin=4.5cm]{%
\begin{minipage}{4cm}
   \textcolor{red}{\textbf{If the product of any two numbers is zero, %
      then one or both of the numbers is zero.}}
\end{minipage}}%
{\LinkNodes[margin=5cm]{$\times{}3$}%
 \LinkNodes[margin=5cm]{$+9x$}
 \LinkNodes[margin=5cm]{$\div 9$}}
 \LinkNodes{$\times{}5$}%
 \LinkNodes{$+3$}
 \LinkNodes{$\div 10$}
\end{NodesList}

On the next page, the code looks like: 
\vfill\newpage
\begin{tkzexample}[vbox,code only,small,num]
 \begin{NodesList}[dy=3]
   \begin{displaymath}\displaywidth=.8\linewidth
     \begin{aligned}
       &\left(\frac{2}{3}-3x\right)\left(\frac{3}{5}+2x\right)=0    \AddNode\\
       &{\begin{aligned}
           &\Longleftrightarrow&&%
           \left\{{%
             \begin{aligned}
               \frac{2}{3}-3x&=0
                                                                \AddNode[2]&\\
               \textrm{ou}&&                                      \AddNode    \\
               \frac{3}{5}+2x&=0                                \AddNode[3]&\\
             \end{aligned}}%
           \right.                                                          \\
         &\Longleftrightarrow&&%
         {%
           \left\{%
           \begin{aligned}
             2-9x&=0                                             \AddNode[2]\\
             \textrm{ou}&                                                     \\
             3+10x&=0                                            \AddNode[3]\\
           \end{aligned}\right.}                                            \\
         &\Longleftrightarrow&&%
         {%
           \left\{%
           \begin{aligned}
              2&=9x                                              \AddNode[2]\\
                     \textrm{ou}&                                             \\
             10x&=-3                                             \AddNode[3]\\
           \end{aligned}\right.}                                            \\
          &\Longleftrightarrow&&%
         {%
           \left\{%
           \begin{aligned}
             x&=\frac{2}{9}                                      \AddNode[2]\\
             \textrm{ou}&                                                     \\
             x&=-\frac{3}{10}                                    \AddNode[3]\\
           \end{aligned}\right.}                                            \\
        \end{aligned}}
     \end{aligned}
   \end{displaymath}
  \LinkNodes[margin=4.5cm]{%
 \begin{minipage}{4cm}
    \textcolor{red}{\textbf{If the product of any two numbers is zero, then %
       one or both of the numbers is zero.}}
 \end{minipage}}%
 {\LinkNodes[margin=5cm]{$\times{}3$}%
  \LinkNodes[margin=5cm]{$+9x$}
  \LinkNodes[margin=5cm]{$\div(9)$}}
  \LinkNodes{$\times{}5$}%
  \LinkNodes{$+3$}
  \LinkNodes{$\div(10)$}
 \end{NodesList}\end{tkzexample}
\Iopt{AddNode}{groups}

\section{How to use \tkzname{tkz-linknodes.sty} with  \tkzname{align}}
\subsection{With align et minipage}
  \Ienv{align}   \Ienv{minipage} 
With this environment, we are directly in the display math mode and the lines are numbered.

This environment is very useful and I recommend you to see the examples in MathMode.tex  of Herbert Vo\ss.

\medskip
\begin{tkzexample}[vbox,small,num]
  \begin{minipage}{12cm}
    \begin{NodesList}[margin=4 cm]
       \begin{align}
     3\left(x^2-\frac{2}{3}\right) &= 4                             \AddNode\\
       3x^2-2  &= 4                                                 \AddNode\\
       3x^2    &= 6                                                 \AddNode\\
        x^2    &= 2                                                 \AddNode\\
 \sqrt{x^2}    &= \sqrt{2}                                          \AddNode\\
      |x|      &= \sqrt{2}                                          \AddNode\\
       x       &= \pm\sqrt{2}    
         \end{align}
 \LinkNodes{expand}%
 \LinkNodes{$+2$}%
 \LinkNodes{$\div 3$}
 \LinkNodes{$\sqrt{\ldots}$}
 \LinkNodes{$\sqrt{x}=|x|$}
    \end{NodesList} 
  \end{minipage}\end{tkzexample}

\vfill\newpage
\subsection{With \tkzname{align*}}
  \Ienv{align*} 
\begin{tkzexample}[vbox,small,num]
\begin{NodesList}[margin=4 cm]
\begin{align*}
     3\left(x^2-\frac{2}{3}\right) &= 4                             \AddNode\\
       3x^2-2  &= 4                                                 \AddNode\\
       3x^2    &= 6                                                 \AddNode\\
        x^2    &= 2                                                 \AddNode\\
 \sqrt{x^2}    &= \sqrt{2}                                          \AddNode\\
      |x|      &= \sqrt{2}                                          \AddNode\\
       x       &= \pm\sqrt{2}                                      
     \end{align*}
 \LinkNodes{expand}%
 \LinkNodes{$+2$}%
 \LinkNodes{$\div 3$}
 \LinkNodes{$\sqrt{\ldots}$}
 \LinkNodes{$\sqrt{x}=|x|$}
\end{NodesList}\end{tkzexample}

\subsection{With \tkzname{align} and \tkzname{nonumber}}
  \Imacro{nonnumber} \Ienv{align}
\begin{tkzexample}[vbox,small,num]
\begin{NodesList}[margin=4 cm]
\begin{align}
     3\left(x^2-\frac{2}{3}\right) &= 4                    \nonumber\AddNode\\
       3x^2-2  &= 4                                                 \AddNode\\
       3x^2    &= 6                                        \nonumber\AddNode\\
        x^2    &= 2                                                 \AddNode\\
 \sqrt{x^2}    &= \sqrt{2}                                          \AddNode\\
      |x|      &= \sqrt{2}                                          \AddNode\\
       x       &= \pm\sqrt{2} 
     \end{align}
 \LinkNodes{expand}%
 \LinkNodes{$+2$}%
 \LinkNodes{$\div 3$}
 \LinkNodes{$\sqrt{\ldots}$}
 \LinkNodes{$\sqrt{x}=|x|$}
\end{NodesList}\end{tkzexample}

\section{How to use \tkzname{tkz-linknodes.sty} with  \tkzname{array}}
  \Ienv{array} 
\subsection{With \tkzname{array} an example from  Mathmode.tex}
\begin{tkzexample}[vbox,small,num]
\begin{minipage}{11cm}
{\renewcommand{\arraystretch}{2}%
\begin{NodesList}
\[y = \left\{%
   \begin{array}{ll}
     x^2+2x  &\textrm{if }x<0,                                   \AddNode   \\
     x^3     &\textrm{if }0\le x<1,                              \AddNode[2]\\
     x^2+x   &\textrm{if }1\le x<2,                              \AddNode   \\
     x^3-x^2 &\textrm{if }2\le x.                                \AddNode[2]
   \end{array}\right.\]
\tikzset{ArrowStyle/.append style = {<->,red}}
\tikzset{LabelStyle/.append style = {pos=0.20}}
\LinkNodes[margin=3cm]{Degree 2 - quadratic} 
{\tikzset{ArrowStyle/.append style = {<->,blue}}
\LinkNodes[margin=1cm]{Degree 3 - cubic}} 
\end{NodesList}}
\end{minipage}\end{tkzexample}

\vfill\newpage
\subsection{An example from  Mathmode.tex}
  \Ienv{array} \Iopt{LinkNodes}{margin} 
In this example, we use an environment \tkzname{minipage} in the label.
\begin{tkzexample}[vbox,small,num]
\begin{NodesList}[margin=0cm]
  \[
  \begin{array}{@{}r@{\quad}ccrr@{}}
   \textrm{a}) & y & = & c & (constant)                            \AddNode \\
   \textrm{b}) & y & = & cx+d & (linear)                                    \\
   \textrm{c}) & y & = & bx^{2}+cx+d & (square)                             \\
   \textrm{d}) & y & = & ax^{3}+bx^{2}+cx+d & (cubic)              \AddNode
  \end{array}
\]
{\tikzset{ArrowStyle/.append style = {-,red}}
 \tikzset{LabelStyle/.append style = {left,text=red}}
 \LinkNodes{%
   \begin{minipage}{4cm}
    Here are the various studied cases
   \end{minipage}}%
 }
\end{NodesList}\end{tkzexample}

\vfill\newpage
\subsection{An example from  \tkzname{Mathmode.tex}}
  \Ienv{array} 
\begin{tkzexample}[vbox,small,num]
\begin{NodesList}
\[
\begin{array}{rcll}
   y & = & x^{2}+bx+c                                                       \\
     & = & x^{2}+2\cdot{\displaystyle\frac{b}{2}x+c}                        \\
     & = & \underbrace{x^{2}+2\cdot\frac{b}{2}x+%
           \left(\frac{b}{2}\right)^{2}}-%
           {\displaystyle\left(\frac{b}{2}\right)^{2}+c}                    \\
     &   & \qquad\left(x+{\displaystyle \frac{b}{2}}\right)^{2}             \\
     & = & \left(x+{\displaystyle \frac{b}{2}}\right)^{2}-%
          \left({\displaystyle  \frac{b}{2}}\right)^{2}+c           \AddNode\\
   y+\left({\displaystyle \frac{b}{2}}\right)^{2}-c%
     & = & \left(x+{\displaystyle \frac{b}{2}}\right)^{2}           \AddNode\\
   y-y_{S}%
     & = & (x-x_{S})^{2}                                                    \\
   S(x_{S};y_{S})%
     & \,\textrm{soit}\,%
         & S\left(-{\displaystyle%
           \frac{b}{2};\,\left({\displaystyle\frac{b}{2}}\right)^{2}-c}\right)
\end{array}
 \]
 \tikzset{LabelStyle/.append style = {right=0.5cm,pos=0.25,text=red}}
 \LinkNodes[margin=5cm]{%
 \begin{minipage}{3cm}
 we add to each members $\left({\displaystyle \frac{b}{2}}\right)^{2}-c$
   \end{minipage}}%
 \end{NodesList}\end{tkzexample}

\vfill\newpage
\section{Use with diverse environments}
  \Ienv{gather} 
\subsection{With \tkzname{gather}}
A little modified example from  Mathmode.tex
\begin{tkzexample}[vbox,small,num]
\begin{center}
\fbox{%
 \begin{minipage}{14cm}
 \begin{NodesList}
   \begin{gather}
      \boxed{ 3(x^2-3) =4 }                                         \AddNode\\
      x^2-3  =\frac{4}{3}                                           \AddNode\\
      \intertext{\hfil isolate the term with the variable \hfil}
      x^2    =\frac{13}{3}                                          \AddNode\\
      \sqrt{x^2}    =\sqrt{\frac{13}{3}}                            \AddNode\\
       |x|   =\sqrt{\frac{13}{3}}                                   \AddNode\\
      x      =\pm\sqrt{\frac{13}{3}}                                \AddNode
   \end{gather}
   \LinkNodes[margin=1cm]{$\div 3$}%
   \LinkNodes[margin=1.5cm]{$+3$}%
   \LinkNodes[margin=2.5cm]{$\sqrt{\ldots}$}
   \LinkNodes[margin=3cm]{$\sqrt{x^2}=|x|$}
   \LinkNodes[margin=4.5cm]{we have two answers}
 \end{NodesList}
\end{minipage}%
}
\end{center}\end{tkzexample}

\vfill\newpage
\subsection{With \tkzname{gather*} and \tkzname{align*}}
       \Ienv{gather*}\Ienv{align*} 
        
An example from Mathmode.tex

\begin{tkzexample}[vbox,small,num]
\begin{minipage}{\linewidth-7pt}
  \begin{NodesList}
    \begin{gather*}
      \begin{align*}
        m_2 &=  m_2' + m_2''                                        \AddNode\\
            &= \frac{V_2'}{v_2'} + \frac{V_2''}{v_2''}
      \end{align*}                                                          \\
      \Rightarrow m_2 v_2' = V - V_2'' + V_2''\frac{v_2'}{v_2''}    \AddNode\\
    \end{gather*}
    \begin{gather*}
      \begin{align*}
        m_2 &=  m_2' + m_2''                                        \AddNode\\
            &= \frac{V_2'}{v_2'} + \frac{V_2''}{v_2''} &
      \end{align*}                                                          \\
      \Rightarrow m_2 v_2' = V - V_2'' + V_2''\frac{v_2'}{v_2''}    \AddNode\\
    \end{gather*}
     \LinkNodes{(i)}
     \LinkNodes{(ii)}
     \LinkNodes{(iii)}
  \end{NodesList}
\end{minipage}
\end{tkzexample}

\vfill\newpage  
\subsection{With \tkzname{enumerate}}    
\Ienv{enumerate} 
This example  shows that we can use the environment \tkzname{NodesList} with a list \tkzname{enumerate}
\begin{tkzexample}[vbox,small,num]
  \begin{NodesList}[margin=7cm]
  \begin{enumerate}
    \item  A                                                     \AddNode
    \item  B                                                     \AddNode
    \item  C                                                     \AddNode
    \item  D                                                     \AddNode
  \end{enumerate}
  \LinkNodes{Liberté}%
  \LinkNodes{Égalité}%
  \LinkNodes{Fraternité}
\end{NodesList}
\end{tkzexample}

\subsection{With \tkzname{flalign}}    
\Ienv{flalign}
Another example from Mathmode.tex
 \IstyleEnv{NodesList}{ArrowStyle}  \IstyleEnv{NodesList}{LabelStyle}  
\begin{tkzexample}[vbox,small,num] 
\begin{NodesList}
\begin{flalign}
       x & = 2\quad\textrm{if }y >2\AddNode & \\
       x & = 3\quad\textrm{if }y \le 2 \AddNode& 
     \end{flalign}
{\tikzset{ArrowStyle/.append style = {<->,red}}
 \tikzset{LabelStyle/.append style = {left,text=blue}}
 \LinkNodes{Two cases are to be studied}}
\end{NodesList}
\end{tkzexample}

\vfill\newpage
\subsection{With \tkzname{listings}}  
\Ienv{listings}

	\lstset{escapechar=\§}
		\begin{NodesList}
		 \begin{lstlisting}
		 void example(FILE *fp)
		 {
		   int c;

		   while((c=fgetc(fp)!=EOF)){
		     if(c=='X')
		       goto done; §\AddNode§
		     fputc(c,stdout);
		   }

		done: §\AddNode§
		   exit(0);
		 }
		 \end{lstlisting}
		 \tikzset{ArrowStyle/.append style = {->,red}}

		 \LinkNodes{}
		\end{NodesList}



\begin{tkzexample}[code only,small,num]
	\lstset{escapechar=\§}
		\begin{NodesList}
		 \begin{lstlisting}
		 void example(FILE *fp)
		 {
		   int c;

		   while((c=fgetc(fp)!=EOF)){
		     if(c=='X')
		       goto done; §\AddNode§
		     fputc(c,stdout);
		   }

		done: §\AddNode§
		   exit(0);
		 }
		 \end{lstlisting}
		 \tikzset{ArrowStyle/.append style = {->,red}}

		 \LinkNodes{}
		\end{NodesList}
\end{tkzexample}

\section{Beamer and tkz-linknodes}
\index{Class!Beamer}
The next example is from \tkzimp{Guillaume Connan}. The first thing you can notice about this code is the multiple nodes from the first line.

\begin{tkzexample}[code only,small,num]
	\documentclass[xcolor={usenames,pdftex,dvipsnames,table},10pt]{beamer}
	\usepackage[utf8]{inputenc}
	\usepackage{lmodern}
	\usepackage[upright]{fourier}
	\usepackage{tikz}

	\usepackage{amsmath,calc}
	\usepackage{tkz-linknodes}
	\usetikzlibrary{arrows,shapes}
	\newcommand{\vtab}{\rule[-1.2em]{0pt}{3em}}
	\begin{document}

	\begin{frame}
	\tiny
	\begin{NodesList}[margin=1cm]
	\[
	\begin{array}{lllllll}
	\hline
	\text{ Decimal}&\text{Babylone}&\text{Athenien}&\text{Maya}&%
	\text{Japonais}&\text{Binaire}&\text{Bibinaire} \\
	\hline
	\uncover<2->{\vtab 13&A&B&C&D&1101&DA%
	\AddNode\AddNode[2]\AddNode[3]\AddNode[4]\AddNode[5]\\}
	\uncover<4->{\vtab 130&AB&C&D&&10000010&KOHE\AddNode\\}
	\uncover<6->{\vtab 26&A&B&C&D&11010&HAKE\AddNode[2]\\}
	\uncover<8->{\vtab 208&A&B&C&D&11010000&DAHO\AddNode[3]\\}
	\uncover<10->{\vtab 260&A&B&C&D&100000100&HAHOBO \AddNode[4]\\}
	\uncover<12->{\vtab 780&A&B&C&D&1100001100&HIHODO\AddNode[5]\\
	\hline}
	\end{array}
	\]
	\tikzstyle{ArrowStyle}+=[<->,blue]
	\visible<3-4>{\LinkNodes[]{$\times10$}}
	\visible<5-6>{\LinkNodes[]{$\times2$}}
	\visible<7-8>{\LinkNodes[]{$\times16$}}
	\visible<9-10>{\LinkNodes[]{$\times20$}}
	\visible<11-12>{\LinkNodes[]{$\times60$}}
	\end{NodesList}
	\end{frame}
	\end{document}
\end{tkzexample}

\vfill\newpage
\section{\tkzname{tkz-linknodes} and ordinary text}
The following text is from \url{http://www.sir-lancelot.co.uk/camelot.htm}. 

\bigskip

	\begin{minipage}{12 cm}
		\begin{NodesList}[margin=-1cm]
			"In some versions of the legend, one of Lancelot's first tasks as a knight was to bring Guinevere to Camelot for her wedding to Arthur. During their journey back to Camelot, Guinevere and Lancelot fell in love\AddNode. In other stories, Guinevere was already Queen when Lancelot arrived, and he became one of the Queen's Knights. Lancelot soon became recognised as the greatest of the knights after successfully completing several quests. 

			\dots
			
			Lancelot helped King Arthur put down the rebellion of Galehaut the Haut Prince, who surrendered to Arthur after being influenced by Lancelot's chivalry in battle. Later Galehaut became Lancelot's close friend and acted as a secret go-between\AddNode Lancelot and Guinevere."
			
				{ \tikzset{ArrowStyle/.append style = {opacity=.5,red,]-[}}
			        \LinkNodes{%
			      \begin{minipage}{5cm}
		            \begin{itemize}
		              \item to feel in love ?
		               \item go-between  ?
		            \end{itemize}
		            
		       \end{minipage}
			        }}
		\end{NodesList}
	\end{minipage}
	
\begin{tkzexample}[code only,small,num]
\begin{minipage}{12 cm}
\begin{NodesList}[margin=-1cm]
	"In some versions of the legend, one of Lancelot's first tasks as a knight was to%
	bring Guinevere to Camelot for her wedding to Arthur. During their journey back to%
	 Camelot, Guinevere and Lancelot fell in love.\AddNode In other stories, Guinevere%
	 was already Queen when Lancelot arrived, and he became one of the Queen's%
	 Knights. Lancelot soon became recognised as the greatest of the knights after%
	successfully completing several quests. 

			\dots
			
Lancelot helped King Arthur put down the rebellion of Galehaut the Haut Prince, who%
 surrendered to Arthur after being influenced by Lancelot's chivalry in battle. Later%
  Galehaut became Lancelot's close friend and acted as a secret go-between\AddNode%
   Lancelot and Guinevere."
			
				{ \tikzset{ArrowStyle/.append style = {opacity=.5,red,]-[}}
			        \LinkNodes{%
			      \begin{minipage}{5cm}
		            \begin{itemize}
		              \item to feel in love ?
		               \item go-between  ?
		            \end{itemize}
		            
		       \end{minipage}
			        }}
\end{NodesList}
\end{minipage}\end{tkzexample}
\vfill\newpage
\section{Raise a Node}
\index{NodesList!raise a node}

A better method of solving this problem is obtained by raising box. I use \TEX\ for that but perhaps there is a \LATEX\ method.
I remove \tkzcname{AddNode} and insert 
\begin{tkzexample}[code only, width=6cm]	\raise -1.2ex\hbox{\AddNode}
\end{tkzexample}


	\begin{minipage}{12 cm}
		\begin{NodesList}[margin=-1cm]
			"In some versions of the legend, one of Lancelot's first tasks as a knight was to bring Guinevere to Camelot for her wedding to Arthur. During their journey back to Camelot, Guinevere and Lancelot fell in love.\raise -1.2ex\hbox{\AddNode} In other stories, Guinevere was already Queen when Lancelot arrived, and he became one of the Queen's Knights. Lancelot soon became recognised as the greatest of the knights after successfully completing several quests. 

			\dots
			
			Lancelot helped King Arthur put down the rebellion of Galehaut the Haut Prince, who surrendered to Arthur after being influenced by Lancelot's chivalry in battle. Later Galehaut became Lancelot's close friend and acted as a secret  go-between\raise -2ex\hbox{\AddNode} Lancelot and Guinevere."
			
				{ \tikzset{ArrowStyle/.append style = {opacity=.5,green!50!black,]-[}}
			        \LinkNodes{%
			      \begin{minipage}{5cm}
		            \begin{itemize}
		              \item to feel in love ?
		               \item go-between  ?
		            \end{itemize}
		            
		       \end{minipage}
			        }}
		\end{NodesList}
	\end{minipage}
\printindex
\end{document}
