Link Search Menu Expand Document
  1. About Table
    1. tabularray
    2. Miscellaneous
      1. Bold \hline
      2. Multiple rows and columns
      3. Align cell in tabularx
      4. Repeated alignments
      5. Custom alignment on specific cell

About Table

tabularray

Typeset Tabulars and Arrays with LATEX3.

\documentclass[10pt,journal,compsoc]{IEEEtran}
\usepackage{tabularray}

\begin{table}[!t]
\caption{Comparison of Attention mechanisms}
\label{D70_compare}
\centering
\begin{tblr}{
colspec = {l c | X[c]},
hline{1, 6} = {1.5pt, solid},
hline{2} = {1-2}{1pt, dashed},
hline{3},
row{5} = {cyan8},
}
\SetCell[c=2]{c} two column & & \SetCell[r=2]{c} two rows &\\
attention & out. proj. &\\
space-time & sth1 & 90.3\\
space-time & sth2 & 70.6\\
space-time & sth3 & 90.3
\end{tblr}
\end{table}

Screenshot from 2022-05-28 16-46-01

Miscellaneous

Bold \hline

\usepackage{makecell}

% inside table
\Xhline{1.5pt}
\Xhline{2\arrayrulewidth}

Multiple rows and columns

%multi-column
\multicolumn{number cols}{align}{text} % align: l,c,r
 
%multi-row
\usepackage{multirow}
\multirow{number rows}{width}{text}
% Using * as width, the text argument’s natural width is used.

Align cell in tabularx

{>{\raggedright\arraybackslash}X} % align left
{>{\centering\arraybackslash}X}   % align center
{>{\raggedleft\arraybackslash}X}  % align right

Difference between c and >{\centering\arraybackslash}X: The first do alignment w.r.t the local cells, while the latter w.r.t the global space. See below two examples:

\begin{tabularx}{\textwidth}{l l l l l c c c c c}

Screenshot from 2022-05-22 20-23-53

\begin{tabularx}{\textwidth}{l l l l l *{5}{>{\centering\arraybackslash}X}}

Screenshot from 2022-05-22 20-25-57

Repeated alignments

*{num_repeated}{alignment} % see above example

Custom alignment on specific cell

\multicolumn{1}{|r|}{Item3}

Screenshot from 2022-05-22 20-33-43