Create a table with row properties

tables

Probably a question that has appeared somewhere before, but I have not found a comprehensive solution to it yet. How to create a table with custom row height (eg. 5cm), vertical center and horizontal center. Thank you very much!

enter image description here

P/S: I used to use \newcolumntype but I can only modify the attributes of column:

example:

\documentclass{article}

\usepackage{array}

\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\begin{document}

\begin{tabular}{| c | L{3cm} | C{3cm} | R{3cm} |}

content

\end{tabular}

\end{document}

Best Answer

Just table, without symbols at bottom right corners of headers cells, with tabularray package too. From interesting @Imran answer (+1) it differ in:

  • table design
  • a way how table specifications are determined
\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{siunitx}

\begin{document}
\noindent%
\begin{tblr}{hline{1,Z}=1pt, hline{2}=0.6pt, hline{3-Y}=0.2pt,
             vlines,
             rows = {4\baselineskip, font=\sffamily},
             row{1} = {bg=azure8, fg=white, font=\bfseries},
             colspec = {X[1,c] X[2,l] X[4,l] X[2,c, si={table-format=3.0}]},
            }
Order   & Date  & Product           & {{{Qty}}} \\
%
1001    & 1-May & Arrowroot         &   5       \\
1002    & 2-May & Bran              &  20       \\
1003    & 3-May & Chocolate Chip    &  80       \\
1004    & 4-May & Oatmeal Raisin    & 240       \\
\end{tblr}
\end{document}

enter image description here

Edit: It is not clear, what you mean with atribute. A symbols at bottom right corners of headers cells? It is possible to drawn it in cells, but achieve their functionality (for example: open windows, where you can select contents in cells) is a different story. For this LaTeX is not right tools.

Addendum (1): In the case that you like to have a long table caption and column headers on each page, that you should use longtblr anvironment:

\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{siunitx}

\begin{document}
\DefTblrTemplate{contfoot-text}{normal}{\scriptsize\textit{Continued on the next page}}
\SetTblrTemplate{contfoot-text}{normal}
\noindent%
\begin{longtblr}[
caption = {Caption text if any (caption label is always presented)},
  label = {tab:lontblr}
                ]{
        rowhead=1,
        hline{1,Z}=1pt, hline{2}=0.6pt, hline{3-Y}=0.2pt,
        vlines,
        rows = {4\baselineskip, font=\sffamily},
        row{1} = {bg=azure8, fg=white, font=\bfseries},
        colspec = {X[1,c] X[2,l] X[4,l] X[2,c, si={table-format=3.0}]},
            }
Order   & Date  & Product           & {{{Qty}}} \\
%
1001    & 1-May & Arrowroot         &   5       \\
1002    & 2-May & Bran              &  20       \\
1003    & 3-May & Chocolate Chip    &  80       \\
1004    & 4-May & Oatmeal Raisin    & 240       \\
%
1001    & 1-May & Arrowroot         &   5       \\
1002    & 2-May & Bran              &  20       \\
1003    & 3-May & Chocolate Chip    &  80       \\
1004    & 4-May & Oatmeal Raisin    & 240       \\
%
1001    & 1-May & Arrowroot         &   5       \\
1002    & 2-May & Bran              &  20       \\
1003    & 3-May & Chocolate Chip    &  80       \\
1004    & 4-May & Oatmeal Raisin    & 240       \\
%
1001    & 1-May & Arrowroot         &   5       \\
1002    & 2-May & Bran              &  20       \\
1003    & 3-May & Chocolate Chip    &  80       \\
1004    & 4-May & Oatmeal Raisin    & 240       \\
\end{longtblr}
\end{document}

enter image description here

Addendum (2): In the case, when you not like to have captions, than before table add:

\DefTblrTemplate{firsthead, middlehead,lasthead}{default}{}

and than delete optional table specifications (since they haven't any sence anymore). So, complete table specifications in your case are:

\begin{longtblr}{
        rowhead={1},
        hline{1,Z}=1pt, hline{2}=0.6pt, hline{3-Y}=0.2pt,
        vlines,
        rows = {4\baselineskip, font=\sffamily},
        row{1} = {bg=azure8, fg=white, font=\bfseries},
        colspec = {X[1,c] X[2,l] X[4,l] X[2,c, si={table-format=3.0}]},
            }