I want to adjust a column of a table
, such that the heading is centred, the rest rows are left aligned, which I managed myself (see figure). Now, all rows have an additional attribute (length), which I want to be pushed to the extreme right of each cell. I tried with \hfil
, but they are now centred in the space (not right aligned).
How can I do that?
MWE added:
\documentclass{article}
\begin{document}
\begin{table}
\begin{tabular}{|c|l|} \hline
Item & \multicolumn{1}{c|}{Entries \hfil (length)} \\ \hline
1 & 1, 2, 3, 4, 5, 6, 7 \hfil (7) \\ \hline
2 & 1, 2, 3, 4, 5, 6, 7, 8, 9 \hfil (9) \\ \hline
3 & 1, 2, 3, 4 \hfil (4) \\ \hline
\end{tabular}
\end{table}
\end{document}
Best Answer
Why don't you use
3
columns? Also, you might use thebooktabs
package: no vertical rules and better vertical spacing between rows. I give an example of both: