# [texhax] Adding annotations to a computer code file

E. Krishnan ekmath at asianetindia.com
Thu May 5 10:06:12 CEST 2005

On Tue, 3 May 2005, Peter Flom wrote:

> That is I'd like to have one part of the
> document be LaTeX commands, and another part (next to the commands) be
> text in boxes explaining the commands, with arrows pointing towards the
> commands they explain.....

> an example is in Kopka
> and Daly's Guide to LaTeX, 4th edition, page 16, 18, and 19.

I haven't seen the new edition of Kopka and Doily but is this what you
want?

\documentclass{article}
\usepackage{amsmath}
\usepackage{pstricks,pst-node}
\usepackage{fancyvrb}

\begin{document}

\begin{minipage}{0.45\textwidth}
\begin{Verbatim}[commandchars=\|]
We use the symbol |rnode[i1][$\sqrt]{x}$
to denote the |rnode[i2][\emph]{positive}
square root
\end{Verbatim}
\end{minipage}
\hfill
\begin{minipage}{0.45\textwidth}
We use the symbol \rnode{o1}{$\sqrt{x}$}
to denote the  \rnode{o2}{\emph{positive}} square root
\ncbar[linestyle=dotted,dotsep=1pt,nodesep=3pt,angle=90]{->}{i1}{o1}
\ncbar[linestyle=dotted,dotsep=1pt,nodesep=3pt,angle=-90]{->}{i2}{o2}
\end{minipage}

\end{document}

--
Krishnan