多页多行多行表格

多页多行多行表格

我正在写一篇研究论文,其中我需要一个包含多行和多行单元格的表格,每个单元格上有水平线和垂直线。我希望它看起来像这个例子但多行单元格应该包含大量文本像这儿所以需要适应宽度和增加高度,并且我希望它是多页的longtable或者xltabular其他什么。

所以毕竟我需要这样的东西(不要注意蓝色框,它只是为了突出图片)

在此处输入图片描述

我试过了表格生成器latex 表但我得到的是这样的:

在此处输入图片描述

答案1

谢谢莱安德里斯首先是tabularray建议。探索文档有点痛苦,xd,但这里是 MWE 也包含

  • tabularray 的标题对齐方式(或对齐方式,不清楚)
  • campconttabularray 的理由

文本

\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}

在此处输入图片描述

相关内容