Multipage multirow multiline tables

longtablemultirowtables

I am writing a study paper in which I need a table with multirow and multiline cells with horizontal and vertical lines on each cell. I want it to look like in this example but multirow cells should contain a lot of text like here so it is needed to fit width and increase height, and I want it to be multipage longtable or xltabular or something else.

So after all I need something like this (do not pay attention to the blue box, it is done just to highlight the picture)

enter image description here

I've tried tablesgenerator and latex-tables but what I got is this:

enter image description here

Best Answer

Thanks to leandriis firstly for tabularray suggestion. It was some pain, exploring documentation, xd, but here is MWE also containing

  • Caption justification for tabularray (or alignment idk)
  • campcont justification for tabularray

text

\documentclass[a4paper,14pt]{article}

\usepackage{array}              % Tables
\usepackage{booktabs}           % Tables
\usepackage{multirow}           % Tables
\usepackage{pdflscape}          % landscape page
\usepackage{tabularray}         % long table
\usepackage{lipsum}             % filler words

\usepackage{extsizes}
\usepackage{geometry}
\geometry{top=20mm}
\geometry{bottom=30mm}
\geometry{left=15mm}
\geometry{right=15mm}


\usepackage[labelfont=bf]{caption}
\usepackage{ragged2e}

\DefTblrTemplate{caption-tag}{default}{\textbf{\tablename\hspace{0.25em}\thetable}}
\DefTblrTemplate{caption-sep}{default}{\textbf{:}\enskip}
\DefTblrTemplate{caption-text}{default}{\InsertTblrText{caption}}

\DefTblrTemplate{caption}{default}{
    \raggedleft
    \UseTblrTemplate{caption-tag}{default}
    \UseTblrTemplate{caption-sep}{default}
    \UseTblrTemplate{caption-text}{default}
}

\DefTblrTemplate{contfoot-text}{default}{Continued on the next page}
\SetTblrTemplate{contfoot-text}{default}

\DefTblrTemplate{conthead-text}{default}{(Continued)}

\DefTblrTemplate{conthead}{default}{
    \UseTblrTemplate{conthead-text}{default}
}


\DefTblrTemplate{capcont}{default}{
    \hfill
    \UseTblrTemplate{caption-tag}{default}
    \UseTblrTemplate{caption-sep}{default}
    \UseTblrTemplate{caption-text}{default}
    \UseTblrTemplate{conthead-text}{default}
}

\begin{document}
And we gonna try

\vspace{0.67\textheight}

\begin{longtblr}[
        caption = {Caption long enough},
        label = {table:exmpl}
    ]{
        colspec={X[4,l]X[2,l]X[2,l]X[2,l]},width=\linewidth,
        vlines,hlines,
        vspan=even,
        rowhead=2,
        row{1-2}={font=\bfseries}
    }
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \SetCell[r=2]{l} Accuracy type &
    \SetCell[r=2]{l}Amplitude Range &
    \SetCell[c=2]{c} Frequency Range & \\
    & & 1-2 GHz & 3-4 GHz \\
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \SetCell[r=2]{l} Long long long text of some metrology stuff,but here was another word and it was cursed & 
    1 to 2 dB &
    25 &
    35 \\*
    &
    2 to 4 dB &
    55 &
    65 \\
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \SetCell[r=2]{l} the same thing but confidence interval is p=0.95 &
    3 to 6 db &
    420 &
    69 \\*
    &
    6 to 9 db &
    228 &
    1337 \\
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \SetCell[r=2]{l} And **** *** for the last time, but on the new page &
    3 to 6 db &
    420 &
    69 \\*
    &
    6 to 9 db &
    228 &
    leet \\
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{longtblr}

\end{document}

enter image description here

Related Question