Asked
Active
Viewed 2.3k times
7
-
Do they all have the same size? – Bernard May 21 '16 at 16:07
-
@Bernard all the figures are the same size – rayallen May 21 '16 at 17:31
2 Answers
6
Assuming that all figures could be 6em wide, this can be done using booktabs in a normal tabular environment.
\documentclass{article}
\usepackage{graphicx,booktabs,array}
\begin{document}
\newcommand{\addpic}{\includegraphics[width=6em]{example-image}}
\newcolumntype{C}{>{\centering\arraybackslash}m{6em}}
\begin{table}\sffamily
\begin{tabular}{l*4{C}@{}}
\toprule
Nr. & a & b & c & d \\
\midrule
1 & \addpic & \addpic & \addpic & \addpic \\
2 & \addpic & \addpic & \addpic & \addpic \\
3 & \addpic & \addpic & \addpic & \addpic \\
\bottomrule
\end{tabular}
\caption{caption}
\end{table}
\end{document}
AboAmmar
- 46,352
- 4
- 58
- 127
-
-
@rayallen - You can explicitly specify column spacing as you wish, e.g.,
{lC@{\hspace{4pt}}CCC@{}}. This4ptcan be any length. – AboAmmar May 21 '16 at 20:37
2
For a table of figures like this one you can use the package booktabs, like this:
\documentclass[a4paper,10pt]{article}
\usepackage{booktabs}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\newcommand{\dummyfigure}{\tikz \fill [NavyBlue] (0,0) rectangle node [black] {Figure} (2,2);}
\begin{document}
\begin{table}
\centering
\begin{tabular}{ccccc}
\toprule
Nr. & a & b & c & d \\
\midrule
1 & \dummyfigure & \dummyfigure & \dummyfigure & \dummyfigure \\
2 & \dummyfigure & \dummyfigure & \dummyfigure & \dummyfigure \\
3 & \dummyfigure & \dummyfigure & \dummyfigure & \dummyfigure \\
\bottomrule
\end{tabular}
\caption{Table of figures}
\label{tbl:table_of_figures}
\end{table}
\end{document}
But, as you can see in the figure below, the text in the first column will not be vertically aligned.
In order to do this, you need to use the array package and create a new column type:
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
Then, use this new column type for the columns containing the figures, like this:
\documentclass[a4paper,10pt]{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\newcommand{\dummyfigure}{\tikz \fill [NavyBlue] (0,0) rectangle node [black] {Figure} (2,2);}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}
\begin{table}
\centering
\begin{tabular}{cM{20mm}M{20mm}M{20mm}M{20mm}}
\toprule
Nr. & a & b & c & d \\
\midrule
1 & \dummyfigure & \dummyfigure & \dummyfigure & \dummyfigure \\
2 & \dummyfigure & \dummyfigure & \dummyfigure & \dummyfigure \\
3 & \dummyfigure & \dummyfigure & \dummyfigure & \dummyfigure \\
\bottomrule
\end{tabular}
\caption{Table of figures}
\label{tbl:table_of_figures}
\end{table}
\end{document}
Ronny
- 166
-
-
@rayallen you can add what you want between columns with
@{}, so you can increase/decrease the space between them with@{\hspace{1mm}}. In your case, you need to replace the column types, for example, with:\begin{tabular}{c@{\hspace{1mm}}M{20mm}M{20mm}M{20mm}M{20mm}}– Ronny May 21 '16 at 21:18



