Latex 重新创建具有不同列大小的表格

Latex 重新创建具有不同列大小的表格

我无法重新创建此表,我不知道为什么。我尝试使用 p{3cm} 和表格中的类似命令,但结果不一样……此外,我无法重新创建列之间的空格。

在此处输入图片描述

答案1

由于缺少 MWE(最小工作示例),一份包含您的表格的小而完整的文档,因此只能为您的表格提出一个骨架。

我想到两个解决方案:

  • 以可以在 Overleaf 中编译的形式使用该tabularray包)
\usepackage{tabularray}

\begin{document}
    \begin{table}[ht]
    \centering
    \caption{Table caption}
    \label{tab:my-table}
    \small
\begin{tblr}{colspec = {*{4}{X[l, font=\linespread{0.84}\selectfont]}},
             colsep = 4pt,
             rowsep = 0pt}
    \hline[0.8pt]
A. Convetional PID controller
    &   B. Advanced Control I
        &   C. Advanced Control II
            &   D. Advanced Control III     \\
    \hline[0.4pt]
bla bla bla
    &   some long text in two lines
        &   some long text in two lines
            &   some long text in two lines \\
bla bla bla
    &   some long text in two lines
        &   some long text in two lines
            &   some long text in two lines \\[1ex]
            
bla bla bla
    &   some long text in two lines
        &   some long text in two lines
            &   some long text in two lines \\
bla bla bla
    &   some long text in two lines
        &   some long text in two lines
            &   some long text in two lines \\
    \hline[0.8pt]
\end{tblr}%
    \end{table}
\end{document}

在此处输入图片描述

  • 和 booktabs 包的使用tabularx
\documentclass{article}
\usepackage{ragged2e}
\usepackage{booktabs, tabularx}
\newcolumntype{Y}{>{\small\linespread{0.84}\selectfont
                    \RaggedRight}X}

\begin{document}
    \begin{table}[ht]
    \centering
    \caption{Table caption}
    \label{tab:my-table}
\begin{tabularx}{\linewidth}{*{4}{Y} }
    \toprule
A. Convetional PID controller
    &   B. Advanced Control I
        &   C. Advanced Control II
            &   D. Advanced Control III     \\
    \midrule
bla bla bla
    &   some long text in two lines
        &   some long text in two lines
            &   some long text in two lines \\
bla bla bla
    &   some long text in two lines
        &   some long text in two lines
            &   some long text in two lines \\
    \addlinespace            
bla bla bla
    &   some long text in two lines
        &   some long text in two lines
            &   some long text in two lines \\
bla bla bla
    &   some long text in two lines
        &   some long text in two lines
            &   some long text in two lines \\
    \bottomrule
\end{tabularx}%
    \end{table}
\end{document}

两个命题的结果非常相似:

在此处输入图片描述

答案2

请尝试以下代码。由于您不想要垂直线,您可以添加空列,编译时它会在列之间创建空格。

     \documentclass{article}
     \usepackage{graphicx}
     \begin{document}
     \begin{table}[]
     \centering
     \caption{}
     \label{tab:my-table}
     \resizebox{0.5\textwidth}{!}{%
     \begin{tabular}{lllllll}
     \hline
     A &  & B  &  & C  &  & D  \\ \hline
     1 &  & 2  &  & 3  &  & 4  \\
     5 &  & 6  &  & 7  &  & 8  \\
     9 &  & 10 &  & 11 &  & 12 \\ \hline
     \end{tabular}%
     }
     \end{table}
     \end{document}        

在此处输入图片描述

相关内容