1

I want to draw a red arrow from one cell in a table to another. Linking the descriptions in this case with the units I have used table and tabular, and don't want to use matrix. I am using the exam class. I have many of these tables to write for the answer keys.

MWE

\documentclass[12pt,addpoints]{exam}
\usepackage{array}% this is need to centre data
\renewcommand{\arraystretch}{2}
\begin{document}
\begin{table}[h!]
\begin{center}
\setlength{\tabcolsep}{80pt}
\renewcommand{\arraystretch}{5}
\setlength\extrarowheight{-4pt}
\begin{tabular}{|c|c|} % <-- Alignments: 1st column left, 2nd middle and 3rd right, with vertical lines in between
% this is symbols representing meaning in relation to measurement contexts
\hline
Length of a classroom    &  cm \\ %\rule{0pt}{10pt}
%\\ % this needs to put in otherwise next line will be indented
\hline
Length of a finger nail  &  m  \\ %\rule{0pt}{10pt}
\hline
Length of your shoe  &  mm   \\ %\rule{0pt}{10pt}
\hline
\end{tabular}
\renewcommand{\arraystretch}{1}
\end{center}
\end{table}
\end{document}
4
  • 1
    Can you provide a sketch how you imagine where is your arrow (where it start and where it end)?
    – Zarko
    Sep 17 at 9:10
  • Apologies, Zarko, from the end of the word to the beginning of the unit, PS, how do I draw a sketch and upload to website
    – Jon
    Sep 17 at 9:35
  • Or somewhere suitable in the one cell to somewhere suitable in another cell
    – Jon
    Sep 17 at 9:42
  • Check, if the tikzmark package can help you. As starting point may serve tex.stackexchange.com/questions/638973/…
    – Zarko
    Sep 17 at 10:16

1 Answer 1

1

As I mentioned in above comment, you can try with tikzmark library, similarly as is done in here:

\documentclass[12pt,addpoints]{exam}
\usepackage{array}% this is need to centre data
\renewcommand{\arraystretch}{2}

\usepackage{tikz}           % <---
\usetikzlibrary{tikzmark}   % <---


\begin{document}
    \begin{table}[h!]
\centering
\setlength{\tabcolsep}{80pt}
\renewcommand{\arraystretch}{5}
\setlength\extrarowheight{-4pt}
\begin{tabular}{|c|c|} % <-- Alignments: 1st column left, 2nd middle and 3rd right, with vertical lines in between
% this is symbols representing meaning in relation to measurement contexts
\hline
Length of a \tikzmarknode{a}{classroom}                 % <---
        &  \tikzmarknode{b}{cm} \\                      % <---
%\\ % this needs to put in otherwise next line will be indented
\hline
Length of a finger nail  &  m  \\ %\rule{0pt}{10pt}
\hline
Length of your shoe  &  mm   \\ %\rule{0pt}{10pt}
\hline
\end{tabular}
\begin{tikzpicture}[overlay, remember picture,
                    shorten >=2pt, shorten <=2pt]
                    ]
\draw [red, very thick, ->] (a) -- (b);
\end{tikzpicture}
    \end{table}
\end{document}

After two or more compiling result of above MWE is:

enter image description here

1
  • Really do appreciate the quick response, all the other explanations too complicated
    – Jon
    Sep 17 at 12:54

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.