I was writing my bachelor thesis and stumbled on problem of how to create table in latex, bud make it perceived as a Figure instead of Table by latex.
I managed to find following solution
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
\begin{figure}[H] \begin{center} \resizebox{.2\textwidth}{!}{ \begin{tabular}{ | a | b | c | } \hline 1 & 2 & 3 \\ \hline 4 & 5 & 6 \\ \hline 7 & 8 & 9 \\ \hline \end{tabular} } \end{center} \caption{Lovely table } \label{faketable:numberTable} \end{figure} |
The point is simply to wrap table between the {figure} and put there the caption you wish.
Another useful features in the example are
- \begin{center} <someContent> \end{center} to center the content
- resizebox{ .2\textwidth}{!} – using the float number you can adjust table cell size and scale the whole table like this. The second bracket with exclamation mark {!} means that height of table should be the same as width. However you can also decide to specify it as you wish.
- \begin{figure}[H] – The H letter tells latex how to position the figure in the text. These options and some more are well described at this stackoverflow question