Skip to content

Instantly share code, notes, and snippets.

@Alistair1231
Last active January 25, 2025 15:32
Show Gist options
  • Save Alistair1231/01b56fcddf0e163cba43b7d1a77544a6 to your computer and use it in GitHub Desktop.
Save Alistair1231/01b56fcddf0e163cba43b7d1a77544a6 to your computer and use it in GitHub Desktop.

Table comparison

image

Tabularray

tabularray
% \usepackage{color}
% \usepackage{tabularray}
\definecolor{Casal}{rgb}{0.203,0.411,0.427}
\definecolor{Brown}{rgb}{0.588,0.203,0}
\begin{table}
  \centering
  \begin{tblr}{
      row{2} = {Casal,fg=blue},
      row{3} = {Casal},
      cell{1}{1} = {c=2}{c},
      cell{2}{1} = {fg=red},
      cell{2}{2} = {c=2}{Brown},
      cell{3}{1} = {c=3}{},
      cell{4}{1} = {Casal,fg=cyan},
      cell{4}{2} = {r=2}{},
      cell{4}{3} = {r},
      cell{5}{1} = {Casal,fg=cyan},
      cell{5}{3} = {r},
      cell{6}{1} = {Casal,fg=cyan},
      cell{6}{2} = {c=2,r=2}{},
      hline{1-3} = {-}{},
      hline{8} = {1}{},
    }
    Item      &             &       \\
    Animal    & Description &       \\
    Gnat      &             &       \\
    Bat       & each        & 0.01  \\
    Gnu       &             & 92.50 \\
    Emu       & stuffed     &       \\
    Armadillo &             &
  \end{tblr}
\end{table}

Tabular

tabular
% \usepackage{colortbl}
% \usepackage{multirow}

\begin{table}
  \centering
  \begin{tabular}{llr}
    \hline
    \multicolumn{2}{c}{Item}
    & \multicolumn{1}{l}{}                                       \\
    \hline
    {\cellcolor[rgb]{0.204,0.412,0.427}}\textcolor{red}{Animal} &
    \multicolumn{2}{l}{{\cellcolor[rgb]{0.588,0.204,0}}\textcolor{blue}{Description}}
    \\
    \hline
    \multicolumn{3}{l}{{\cellcolor[rgb]{0.204,0.412,0.427}}Gnat}
    \\
    {\cellcolor[rgb]{0.204,0.412,0.427}}\textcolor{cyan}{Bat}   &
    \multirow{2}{*}{each} & 0.01
    \\
    {\cellcolor[rgb]{0.204,0.412,0.427}}\textcolor{cyan}{Gnu}   &
    & 92.50                                                      \\
    {\cellcolor[rgb]{0.204,0.412,0.427}}\textcolor{cyan}{Emu}   &
    \multicolumn{2}{l}{\multirow{2}{*}{stuffed}}
    \\
    Armadillo                                                   &
    \multicolumn{2}{l}{}
    \\
    \cline{1-1}
  \end{tabular}
\end{table}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment