1

How can I draw the following figure in LaTeX using tikz (if possible)?

enter image description here

How to draw the figure with the fruits replaced by letters or numbers?

1

Here you go! The matrix of nodes from the matrix library seems to be ideal for that task.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
  \matrix[matrix of nodes,row sep=1em] (m)
  {
    $S$: & apple  & apple  & apple  & apple  & apple  \\
    $T$: & 1      & 2      & 3      & 4      & 5      \\
    $W$: & banana & banana & banana & banana & banana \\
  };
  \foreach \y in {1,3} {
    \foreach \x in {2,...,6} {
      \draw[<->] (m-\y-\x) -- (m-2-\x);
    }
  }
\end{tikzpicture}
\end{document}

enter image description here

  • Is it impossible to retain the original form of the picture? – user 170039 Oct 28 '15 at 9:09
  • 1
    @user170039 What do you mean by that? The arrow tips, the font, the fruit images? If you'd like to keep the original layout exactly, I'd suggest \includegraphics{original-image}. – Henri Menke Oct 28 '15 at 9:20

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.