I wonder if it's possible to automatically center a table entry vertically and horizontally within a tabularx
environment.
You can see that the matrix does not center:
The code I want to adjust is:
\begin{table}[h]
\renewcommand{\arraystretch}{1.1}
\centering{\caption{Test Table}
\begin{tabularx}{\textwidth}{|X||c|c|c|c|c|}
\hline
Holder1 & \multicolumn{2}{c|}{Holder2}& \multicolumn{2}{c|}{Holder3} & Holder4 \\
% \cline{2-5}
& $\boldsymbol{X}_1$ & $\boldsymbol{X}_1$ & $\boldsymbol{X}_2$ & {$\boldsymbol{X}_2$} & {Holder4 additional}\\
\cline{1-6}
abcv abcv abcv abcv abcv abcv ac sf abcv abcv & $\begin{bmatrix} W_{11} \end{bmatrix}$ & $\begin{bmatrix} D_{11} \end{bmatrix}$ & $\begin{bmatrix} K_{12} \end{bmatrix}$ & 0 & 22\\
\hline
abcv abcv abcv abcv abcv abcv ac sf abcv abcv & $\begin{bmatrix} DD_{11} \\ Kl_{21} \end{bmatrix}$ & $\begin{bmatrix} D_{11} \\ D_{21} \end{bmatrix}$ & $\begin{bmatrix} X_{12} \\ S_{22} \end{bmatrix}$ & 0 & 1\\
\hline
\text{text text text} & $\begin{bmatrix} G_{11} & G_{41} \\ G_{21} & G_{51} \\ W_{31} & O_{61} \end{bmatrix}$ & $\begin{bmatrix} G_{11} \\ G_{21} \\ G_{31} \end{bmatrix}$ & $\begin{bmatrix} F_{12} \\ F_{12} \\ X_{12} \end{bmatrix}$ & 0 & 3\\
\hline
\end{tabularx}
\label{}}
\end{table}
Best Answer
Redefine the
X
column type asm{#1}
. I added some vertical padding withcellspace
andextrarowheight
and gave a decent spacing between caption and table with thecaption
package.