I would like to draw arrows like I show in the image below, sorry for the bad quality of the image.
Here is the equation:
\lambda_1(2,1,-1) + \lambda_2 (1,1,1) = (4,1,-5)
Any tips on how this could be accomplished?
EDIT: Tried to scaffold this bit of code here but failed miserably without any result showing up:
https://tex.stackexchange.com/a/168978/107417
added the packages and commands in the post and changed my equation-code to
\begin{equation*}
\source{\lambda_1}(2,1,-1) + \source{\lambda_2} (\target{1},1,1) = (\target{4},1,-5)
\end{equation*}
EDIT 2:
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{tikz,pgfplots}
\newcounter{source}
\newcommand\source[1]{%
\tikz[remember picture,baseline,inner sep=0pt] {%
\node [name=source-\thesource,anchor=base]{$#1$};
}%
\setcounter{target}{0}
\stepcounter{source}
}
\newcounter{target}
\newcommand\target[1]{%
\tikz[remember picture,baseline,inner xsep=0pt] {%
\node [name=target-\thetarget,anchor=base]{$#1$};
}%
\setcounter{source}{0}
\stepcounter{target}%
}
\newcommand\drawarrows{
\tikz[remember picture, overlay, bend left=45, -latex] {
\foreach \j [evaluate=\j as \m using int(\j)] in {1,...,\thesource}{
\foreach \i [evaluate=\i as \n using int(\i-1)] in {1,...,\thetarget} {
\draw [red](source-0.north) to (target-\n.north) ;
\node [red] at ([xshift=-5mm]target-\n.north) [above=2mm] {\i};
}
}
}
\tikz[remember picture, overlay, bend left=-45, -latex] {
\foreach \j [evaluate=\j as \m using int(\j)] in {1,...,\thesource}{
\foreach \i [evaluate=\i as \n using int(\i-1)] in {1,...,\thetarget} {
\draw [blue](source-1.south) to (target-\n.south) ;
\pgfmathsetmacro{\ii}{\i+2)};
\node [blue] at ([xshift=-2mm]target-\n.south) [below=2mm] {\pgfmathprintnumber \ii};
}
}
}}
\begin{document}
\begin{equation*}
\source{\lambda_1}(2,1,-1) + \source{\lambda_2} (\target{1},1,1) = (\target{4},1,-5)
\end{equation*}
\end{document}




\docummentclass{...}used packages relevant to your problem,\begin{document}your code and ending with\end{document}– Zarko Sep 09 '16 at 16:50