0

I'd like to add a note at the end of the row of a table. The note should be outside the table.

Something like this, which I made in an image editor. Note the little notes at the end: enter image description here

Anyone know of a way to do this?

Table source code (without notes) for your convenience:

\begin{center}
 \begin{tabular}{||c c c c||} 
 \hline
 Col1 & Col2 & Col2 & Col3 \\ [0.5ex] 
 \hline\hline
 1 & 6 & 87837 & 787 \\ 
 \hline
 2 & 7 & 78 & 5415 \\
 \hline
 3 & 545 & 778 & 7507 \\
 \hline
 4 & 545 & 18744 & 7560 \\
 \hline
 5 & 88 & 788 & 6344 \\ [1ex] 
 \hline
\end{tabular}
\end{center}
1
  • 1
    Do you want the notes to be a reference to a footnote or contain the entire note? You might add another column containing your notes (if it is to be the entire text next to the table) with a change in font size.
    – Skillmon
    Mar 7, 2017 at 9:41

2 Answers 2

1

In case you don't need any reference or a footnote, as Skillmon suggested:

\documentclass{standalone}
\begin{document}
     \begin{tabular}{||c c c c||l} 
     \cline{1-4}
     Col1 & Col2 & Col2 & Col3 &\\ [0.5ex] 
      \cline{1-4} \cline{1-4}
     1 & 6 & 87837 & 787 &\\ 
      \cline{1-4}
     2 & 7 & 78 & 5415 &{\tiny note1}\\
      \cline{1-4}
     3 & 545 & 778 & 7507& \\
      \cline{1-4}
     4 & 545 & 18744 & 7560 &{\tiny note2} \\
      \cline{1-4}
     5 & 88 & 788 & 6344 &\\ [1ex] 
      \cline{1-4}
    \end{tabular}
\end{document}

enter image description here

2
  • You might use >{\tiny} for your last column: \begin{tabular}{||c c c c||>{\tiny}l} to make it unnecesarry to use the \tiny switch each time. Note that this requires the array-package.
    – Skillmon
    Mar 7, 2017 at 11:37
  • Excellent, thanks Mace. Thanks also Fabian. Both totally legit. But Mace put a picture up, which I thought was a nice touch.
    – Peter
    Mar 7, 2017 at 14:35
2

You can just add a left-aligned column after the "main column" composing your table. Note that this impacts all of your rows, not only the ones featuring a note. You also need to change your hline commands with cline to avoid the lines to spread out of the main columns.

If you plan to use somewhat long notes that should span over several lines, you might want to consider the paragraph column type (p) instead of the left-aligned column type (l). Then you'd have to specify the width of the column.

You can also use the array package to associate the style of your notes only once in the header.

Complete solution with short red-coloured small-sized notes:

\documentclass{article}

\usepackage{array}
\usepackage{xcolor}

\begin{document}

\begin{center}
  \begin{tabular}{||c c c c|| >{\color{red}\small}l} 
    \cline{1-4}
    Col1 & Col2 & Col2 & Col3 & \\ [0.5ex] 
    \cline{1-4}\cline{1-4}
    1 & 6 & 87837 & 787 & \\ 
    \cline{1-4}
    2 & 7 & 78 & 5415 & note 1\\
    \cline{1-4}
    3 & 545 & 778 & 7507 & \\
    \cline{1-4}
    4 & 545 & 18744 & 7560 & note 2 \\
    \cline{1-4}
    5 & 88 & 788 & 6344 & \\ [1ex] 
    \cline{1-4}
  \end{tabular}
\end{center}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .