8

I have a table. Each row in that table represents data at a certain point of time. Lower rows represent data for later times.

To illustrate this, I'd like to draw an arrow at the side (which doesn't really matter) of the table, pointing downwards, labelled with something like "time".

How would I do this?

2 Answers 2

14

You can use \Downarrow to put a double arrow, or \downarrow for a single arrow. Applying a \left ... \right will allow it to be scaled to the height of the table.

The text can be added via \rotatebox[origin=c]{90}{time} from the graphicx package.

enter image description here

Notes:

  • Assuming you only want the arrow on the left, then you will need to ensure that you replace the \right\downarrow with \right. at the end of the table. Similarly, replace the \left\Downarrow with \left. if you only want the arrow on the right..

Code:

\documentclass{article}
\usepackage{graphicx}

\begin{document}
$\rotatebox[origin=c]{90}{time}%
\left\Downarrow% Use `\left.` if don't want arrow on this side.
\begin{tabular}{r r}
 1:00 & 2 \\
 3:00 & 4 \\
 5:00 & 6 \\
 7:00 & 8 \\
 8:00 & 10 \\
\end{tabular}
\right\downarrow%  Use `\right.` if don't want arrow on this side.
\rotatebox[origin=c]{90}{time}$
\end{document}
3
  • Very elegant! Upvoted this. :)
    – mSSM
    Jun 20, 2012 at 22:51
  • Is it possible to do the same at the top/bottom of the table with left/right arrows?
    – DurandA
    Oct 22, 2020 at 15:30
  • @DurandAL I recommend you post a new question. I personally would use the \tikzmarksolution as shown in the other answer as that would be a lot more flexible. Oct 22, 2020 at 16:51
8

The following code contains two options; the first one doesn't use any special symbol, simply adds /time(incr.) to the column header to indicate an increasing time sequence order. The second one is a TikZ based solution:

\documentclass{article}
\usepackage{booktabs}
\usepackage{tikz}
\usetikzlibrary{calc}

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

\begin{document}

\noindent\begin{tabular}{lc}
\toprule
head1 & data/time(incr.) \\
\midrule
text & 3 \\
text & 2 \\
text & 1 \\
\bottomrule
\end{tabular}

\vspace{1cm}

\noindent\begin{tabular}{lc}
\toprule
head1 & data \\
\midrule
text & 3\tikzmark{start}\\
text & 2 \\
text & 1\tikzmark{end} \\
\bottomrule
\end{tabular}

\begin{tikzpicture}[overlay,remember picture]
    \draw[->] let \p1=(start), \p2=(end) in ($(\x1,\y1)+(0.8,0.2)$) -- node[label=right:time] {} ($(\x1,\y2)+(0.8,0)$);
  \end{tikzpicture}

\end{document}

enter image description here

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.