My desired features for the table alignment are:
- The cell sizes should be auto-adjustable according to the contents.
- Every table cell content should be vertically and horizontally center-aligned.
- The first column's contents (except its header) should be vertically center-aligned but horizontally left-aligned.
- A fair amount of padding should appear between images and table cell borders.
- The text-color and background-color of the header row should be different.
\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\tabcolsep10pt\fboxrule0pt\fboxsep\tabcolsep
\usepackage{geometry}
\usepackage{array}
\renewcommand{\arraystretch}{1.2}
\usepackage{tabularx}
\newcolumntype{L}[1]{>{\flushleft\arraybackslash}m{#1}}
\renewcommand{\tabularxcolumn}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}
\begin{center}
\begin{tabularx}{\linewidth}{|L{.15\linewidth}|X|X|X|} \hline
\multicolumn{1}{|c|}{Property} & Microcanonical & Canonical & Grand-canonical \\ \hline
Contact with environment
& Isolated system, so the energy and number of particles are constant.
& System are in thermal contact, such that it can exchange energy but no particles.
& System can exchange both energy and particles. \\ \hline
Probability density, $\rho(E)$
& {$$\begin{cases} \text{C,} & E \text{ to } (E+dE)\\ 0, & \text{otherwise} \end{cases}$$}
here, $C=$ constant
& $Ae^{(F-E)/KT}$
& $Ae^{(\Omega + \mu N - E)/KT}$ \\ \hline
Diagram
& \includegraphics[width=\linewidth, valign=c]{example-image}
& \includegraphics[width=\linewidth, valign=c]{example-image}
& \includegraphics[width=\linewidth, valign=c]{example-image} \\ \hline
\end{tabularx}
\end{center}
\end{document}
Issues that needed to be fixed:
- The first column's contents are not vertically center-aligned
- The second column's cell with the displayed equation is not properly aligned at the center.
- The padding around images is not appearing perfectly.