Is it possible to vertically center multiple columns in a table?

I found an example here , but this only applies to one column, and I can not adapt it to fit my needs. I would like something like this:

alt text

+3
source share
2 answers

Try the following:

\begin{tabular}{|m{3.5em}|b{1em}|b{1em}|b{1em}|}
\hline
%% row 1

&x1
&x2
&x3
\\\hline
%% row 2
Long Label
&1
&0
&1
\\\hline
%% row 3
Long Label
&1
&0
&1
\\\hline
\end{tabular}

For more information on formatting tables, see http://en.wikibooks.org/wiki/LaTeX/Tables

EDIT: changed c to b {}

+1
source

For this you will need \usepackage{array}.

, , m{}, . , - :

\begin{tabular}{|m{2cm}|m{1ex}|m{1ex}|m{1ex}} \hline
           & x1 & x2 & x3 \\\hline
Long Label & 1  & 0  & 1  \\\hline
Long Label & 0  & 1  & 1  \\\hline
\end{tabular}
+1

Source: https://habr.com/ru/post/1763686/


All Articles