I have an exam where my students should connect two objects in different columns on a page. The two columns are one with text alternatives and one with pictures/formulae. I want to draw a red line connecting the correct object for the corrected sheet, how can I do it?

{\bf A} \\ \vspace{10 mm}
(1) Surjektivitet \\ \vspace{20 mm}
(2) Reflexivitet \\ \vspace{20 mm}
(3) Symmetri  \\ \vspace{20 mm}
(4) Injektivitet \\  \vspace{20 mm}
(5) Transitivitet \\ \vspace{30 mm}

Lycka till!
{\bf B}  \\ \vspace{10 mm}
\vspace{-10 mm} \includegraphics[width=0.4\textwidth]{Injection} \\  \vspace{20 mm}
(b) \textbf{$\forall a \in A, \;\; a\mathcal{R}a$ }. \footnote{  $\forall a \in A$, läses ut som för varje element $a$ i mängden $A$ så gäller\dots}\\ \vspace{20 mm}

(c) \textbf{$\forall x,y,z \in X,$ $(x\mathcal{R}y \wedge y\mathcal{R}z  \Rightarrow x\mathcal{R}z)$ }\\ \vspace{20 mm}

(d)\\   \begin{center}  
\vspace{-10 mm} \includegraphics[width=0.4\textwidth]{Surjection}\\    \end{center}

Ex. (3) connects to (b) with a red arrow.

migrated from stackoverflow.com Jun 19 '13 at 16:12

This question came from our site for professional and enthusiast programmers.


This can be done with \tikzmark. First you place some marks and then use the \Connect command to connect the appropriate marks:


  \tikz[remember picture,overlay]\node (#1) {};%

\tikz[remember picture,overlay]
  \draw[->,red,>=latex,#1] (#2.north east) -- ( $ (#3.north west) + (-20pt,0) $ );%


{\bfseries A}
\item Surjektivitet\tikzmark{starta}
\item Reflexivitet\tikzmark{startb}
\item Symmetri\tikzmark{startc}
\item Injektivitet\tikzmark{startd}
\item Transitivitet\tikzmark{starte}
Lycka till!
{\bfseries B}
\item\tikzmark{endb} $\forall a \in A, \;\; a\mathcal{R}a$.\footnote{$\forall a \in A$, läses ut som för varje element $a$ i mängden $A$ så gäller\dots}
\item\tikzmark{endc} $\forall x,y,z \in X,$ $(x\mathcal{R}y \wedge y\mathcal{R}z  \Rightarrow x\mathcal{R}z)$

\begin{tikzpicture}[remember picture,overlay]


enter image description here

The demo option for graphicx simply replaces actual figures with black rectangles; do not use that option in your actual document. I also changed the height of the included images, just for the example code.

Not related to the question, but you were using a lot of manual adjustments that are not really necessary (and, in some case, are not correct); in particular, I used the enumitem package to customize some enumerate environments, allowing you to minimize the manual interventions.

  • Thank you! Your answer is greatly appreciated. Will consider the other improvements too. – AndyMeow Jun 24 '13 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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