I am using the markup listing from Draw comparison lines between two listings.
\documentclass{article}
\usepackage{listings}% http://ctan.org/pkg/listings
\usepackage{tikz}% http://ctan.org/pkg/pgf
\usetikzlibrary{calc}
% https://tex.stackexchange.com/questions/1559/adding-a-large-brace-next-to-a-body-of-text/1570#1570
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\lstset{
frame=single,
mathescape % Allows escaping to (La)TeX mode within $..$
}
\begin{document}
\noindent\begin{minipage}{.45\textwidth}
\begin{lstlisting}[caption={Original code}]
1 $\tikzmark{L1line1}$
2
3
4 $\tikzmark{L1line4}$
\end{lstlisting}
\end{minipage}\hfill
\begin{minipage}{.5\textwidth}
\begin{lstlisting}[caption={Code after insertion of detour}]
$\tikzmark{L2line1}$ 86
$\tikzmark{L2line4}$ 4
\end{lstlisting}
\end{minipage}
\tikz[overlay,remember picture] \draw[color=red] ($(L1line1)+(0pt,0.7ex)$) -- ($(L2line1)+(0pt,0.7ex)$);
\tikz[overlay,remember picture] \draw[color=blue] ($(L1line4)+(0pt,0.7ex)$) -- ($(L2line4)+(0pt,0.7ex)$);
\end{document}
This results in the following:
I want to add arrowheads on the end of each line - 4 in this case. I've attempted to edit the markup with the help of Drawing Arrows in Tables but haven't been able to progress much. Could someone please show me how arrowheads could be plotted in this case?
->
to the options to thedraw
commands at the end. That is, changecolor=red
tocolor=red, ->
. Same for the other.->
to the\draw[color=red,->]
command in\tikz[overlay,remember picture] \draw[color=red] ($(L1line1)+(0pt,0.7ex)$) -- ($(L2line1)+(0pt,0.7ex)$);
should do the trick.listings
isn't even necessary for the issue with arrowheads. Reducing your code not only helps other users here who might help you, but also helps you understand your problem better.