如何使表格的行和列宽度可调?

如何使表格的行和列宽度可调?

如何使表格的行和列宽度可调?

在此处输入图片描述

\documentclass[journal]{IEEEtran}
\usepackage{graphicx}
 \usepackage{booktabs}
 \usepackage{multirow}
 \usepackage{longtable}
 \usepackage{mathtools}
\begin{document}

\begin{table}[]
\resizebox{\textwidth}{!}{%
\begin{tabular}{@{}cccllll@{}}
\toprule
No                 & TYPE & \multicolumn{2}{c}{X}                 & \multicolumn{1}{c}{Y} & \multicolumn{1}{c}{Z} & \multicolumn{1}{c}{T} \\ \midrule
\multirow{2}{*}{1} & A    & \multicolumn{2}{c}{\multirow{2}{*}{$\begin{aligned}
    M &= -\frac{1}{D} \\
    d &= e+f
  \end{aligned}$}} &   4th column                   & 5th column                      &  6th column                     \\ \cmidrule(lr){2-2} \cmidrule(l){5-7} 
                   & B    & \multicolumn{2}{c}{}                  &                       &                       &                       \\ \midrule
\multirow{2}{*}{2} & C    & \multicolumn{2}{c}{\multirow{2}{*}{}} &                       &                       &                       \\ \cmidrule(lr){2-2} \cmidrule(l){5-7} 
                   & D    & \multicolumn{2}{c}{}                  &                       &                       &                       \\ \bottomrule
\end{tabular}%
}
\end{table}




\end{document}

答案1

不要缩放表格。字体大小应符合期刊的要求。

\documentclass{IEEEtran}
\usepackage{tabularray}
\usepackage{lipsum}
\begin{document}
\begin{table*}
\caption{title}
\begin{tblr}
{
colspec      = {Q[c,m]Q[c,m]Q[c,m]X[c,m]X[c,m]X[c,m]},
hline{1,Z}   = {wd=.08em},
hline{2,4}   = {wd=.05em},
hline{3,5}   = {2}{wd=.05em},
hline{3,5}   = {4-Z}{wd=.05em},
cell{2,4}{1} = {r=2}{},
}
No & TYPE & X                & Y          & Z          & T          \\
1  & A    & $M=-\frac{1}{D}$ & 4th column & 5th column & 6th column \\
   & B    & $d=e+f$          &            &            &            \\
2  & C    &                  &            &            &            \\
   & D    &                  &            &            &            \\
\end{tblr}
\end{table*}
\lipsum
\begin{table}
\caption{title}
\begin{tblr}
{
colspec      = {Q[c,m]Q[c,m]Q[c,m]X[c,m]X[c,m]X[c,m]},
hline{1,Z}   = {wd=.08em},
hline{2,4}   = {wd=.05em},
hline{3,5}   = {2}{wd=.05em},
hline{3,5}   = {4-Z}{wd=.05em},
cell{2,4}{1} = {r=2}{},
}
No & TYPE & X                & Y          & Z          & T          \\
1  & A    & $M=-\frac{1}{D}$ & 4th column & 5th column & 6th column \\
   & B    & $d=e+f$          &            &            &            \\
2  & C    &                  &            &            &            \\
   & D    &                  &            &            &            \\
\end{tblr}
\end{table}
\begin{table}
\caption{title}
\begin{tblr}
{
colspec      = {Q[c,m]Q[c,m]Q[c,m]X[c,m]X[c,m]X[c,m]},
hline{1,Z}   = {wd=.08em},
hline{2,4}   = {wd=.05em},
hline{3,5}   = {2}{wd=.05em},
hline{3,5}   = {4-Z}{wd=.05em},
cell{2,4}{1} = {r=2}{},
columns      = {colsep=3pt},
}
No & TYPE & X                & Y          & Z          & T          \\
1  & A    & $M=-\frac{1}{D}$ & 4th column & 5th column & 6th column \\
   & B    & $d=e+f$          &            &            &            \\
2  & C    &                  &            &            &            \\
   & D    &                  &            &            &            \\
\end{tblr}
\end{table}
\lipsum
\end{document}

在此处输入图片描述

答案2

像这样?

在此处输入图片描述

  • 不清楚您为什么使用\multicolumn单元格。
  • 据我了解,在第一列和第三列中有多行单元格
  • tabularray简单:
\documentclass[journal]{IEEEtran}
\usepackage{lipsum}

\usepackage{tabularray}
\UseTblrLibrary{amsmath, booktabs}
\usepackage{mathtools}

\begin{document}
\lipsum[11]
    \begin{table}[ht]
\begin{tblr}{colspec = {@{} Q[c, m] c Q[c,mode=math] *{3}{X[l]} @{}},
             cell{even[2]}{1-3} = {r=2}{},   % multi row cell{<rows>}{<columns>}
             rowsep=3pt,
             vspan = even
             }
    \toprule
No  & TYPE  &   X   &   Y   &   Z   &   T   \\ 
    \midrule
1   & A & \begin{aligned}
            M & = -\frac{1}{D} \\
            d & = e + f
          \end{aligned} 
            &   4th column
                &   5th column
                &   6th column  \\
    \midrule
    & B &   &   &               \\
    \midrule
2   & C &   &   &               \\ 
    \midrule
    & D &   &   &               \\ 
    \bottomrule
\end{tblr}
    \end{table}
\end{document}

相关内容