9

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?

ryyst
  • 355

3 Answers3

16

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}

Peter Grill
  • 223,288
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

Moriambar
  • 11,466
Gonzalo Medina
  • 505,128
0

Here is a solution with {NiceTabular} of nicematrix.

\documentclass[letterpaper]{book}
\usepackage{nicematrix,tikz,booktabs}

\begin{document}

\NiceMatrixOptions{nullify-dots,xdots/horizontal-labels}

\begin{NiceTabular}{cc}[first-row,last-col] \toprule head1 & date \ \midrule text & 3 & \Vdots[line-style={solid,->}]^{\text{time}}\ text & 2 \ text & 1 \ \bottomrule \end{NiceTabular}

\end{document}

You can as many rows as you want without changing the code for the arrow.

Output of the above code

F. Pantigny
  • 40,250