Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

doesn't this example work because?

\LinkNodes doesn't work

\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[upright]{fourier}
\usepackage{amsmath,tkz-linknodes}
\usepackage{tikz}

\begin{document}
\begin{NodesList}
\begin{displaymath}
\begin{aligned}
3(2a&-5b)&-7a(2a&+3b)&+5(a^2&+3b)& \AddNode[1] \AddNode[2] \AddNode[3] \AddNode[4] \AddNode[5] \AddNode[6] \AddNode[7]\\
6a+&\AddNode[1]\\ 
& -15b&   \AddNode[2]\\
&& -14a^2&   \AddNode[3]\\    
&& &-21ab&   \AddNode[4]\\
&&& &+5a^2&   \AddNode[5]\\
&&&& &+15b&   \AddNode[6]\\
6a&-15b&-14a^2&-21ab&+5a^2&+15b&\AddNode[7]\\   
\end{aligned}
\end{displaymath}

\LinkNodes{$3\cdot 2a$}%    
\LinkNodes{$3\cdot(-5b)$}%
\LinkNodes{$-7a\cdot(2a)$}%
\LinkNodes{$-7a\cdot(3b)$}%
\LinkNodes{$5\cdot(a^2)$}%
\LinkNodes{$5\cdot(3b)$}%

\end{NodesList}
\end{document} 
share|improve this question
1  
Could you clarify your question- at the moment it isn't very clear... –  cmhughes Apr 25 '12 at 19:57
    
Seems to work here (I think). Did you compile twice? –  Torbjørn T. Apr 25 '12 at 20:29
    
What is your problem exactly ? –  Alain Matthes Apr 25 '12 at 21:59
    
You need to remove amsmath and tikz because tkz-linknodes loads these packages. You need to have a recent xkeyval package and the last thing, tkz-linknodes loads etex.sty. But it will be interesting to know what is going wrong ! –  Alain Matthes Apr 26 '12 at 6:39

1 Answer 1

You need to compile twice Update : I added \AddNode[i] before the last &

\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[upright]{fourier}
\usepackage{amsmath,tkz-linknodes}
\usepackage{tikz}

\begin{document}

\begin{NodesList}
\begin{displaymath}
\begin{aligned}
3(2a&-5b)&-7a(2a&+3b)&+5(a^2&+3b)&\AddNode[1]\AddNode[2]\AddNode[3]\AddNode[4]\AddNode[5]\AddNode[6]\AddNode[7]\\
6a+&\AddNode[1]\\ 
& -15b\AddNode[2]&\\
&& -14a^2\AddNode[3]&\\    
&& &-21ab\AddNode[4]&\\
&&& &+5a^2\AddNode[5]&\\
&&&& &+15b\AddNode[6]&\\
6a&-15b&-14a^2&-21ab&+5a^2&+15b&\AddNode[7]\\   
\end{aligned}
\end{displaymath}
\tikzset{LabelStyle/.style = {left=0.1cm,pos=.5,text=red,fill=white}}
\LinkNodes[margin=3cm]{$3\cdot 2a$}%    
 \LinkNodes[margin=2cm]{$3\cdot(-5b)$}%
 \LinkNodes[margin=1cm]{$-7a\cdot(2a)$}%
 \LinkNodes[margin=0cm]{$-7a\cdot(3b)$}%
\LinkNodes[margin=-1cm]{$5\cdot(a^2)$}%
 \LinkNodes[margin=-2cm]{$5\cdot(3b)$}%  

\end{NodesList}
\end{document} 

enter image description here

Another possibility :

\begin{NodesList}
\begin{displaymath}
\begin{aligned}
3(2a&-5b)&-7a(2a&+3b)&+5(a^2&+3b)&\AddNode[1]\AddNode[2]\AddNode[3]\AddNode[4]\AddNode[5]\AddNode[6]\AddNode[7]\\
6a+&\AddNode[1]\\ 
& -15b\AddNode[2]&\\
&& -14a^2\AddNode[3]&\\    
&& &-21ab\AddNode[4]&\\
&&& &+5a^2\AddNode[5]&\\
&&&& &+15b\AddNode[6]&\\
6a&-15b&-14a^2&-21ab&+5a^2&+15b&\AddNode[7]\\   
\end{aligned}
\end{displaymath} 
\tikzset{LabelStyle/.style = {pos=0,above,text=red}}
\LinkNodes[margin=1.5cm]{$3\cdot (2a)$}%    
 \LinkNodes[margin=0cm]{$3\cdot(-5b)$}%
 \LinkNodes[margin=-1.5cm]{$-7a\cdot(2a)$}%
 \LinkNodes[margin=-3cm]{$-7a\cdot(3b)$}%
\LinkNodes[margin=-4.5cm]{$5\cdot(a^2)$}%
 \LinkNodes[margin=-6cm]{$5\cdot(3b)$}%  
\end{NodesList} 

This is a little package to make simple tasks, perhaps I would be more easy for you to use TikZ directly to get exactly what you want.

enter image description here

share|improve this answer
    
the solution of the problem is this. correct? \tikzset{LabelStyle/.style = {left=0.1cm,pos=.5,text=red,fill=white}} –  user13225 Apr 26 '12 at 5:34
    
@user13225 But what is your problem ? You can't get the same result ? –  Alain Matthes Apr 26 '12 at 5:53
    
@user13225 No the style is only to avoid to mixt texts and lines. The most important is to add correct margin. –  Alain Matthes Apr 26 '12 at 6:35
    
the writings in red, they were not correctly lined up, now all ok –  user13225 Apr 26 '12 at 9:26
    
You want align the writings in red with what ? You can modify pos but here the different lines don't have the same length. –  Alain Matthes Apr 26 '12 at 9:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.