如何调整表格中的单元格宽度并避免出现间隙?

如何调整表格中的单元格宽度并避免出现间隙?

在此处输入图片描述

\begin{table}[H]
        \centering
        \caption{Comparison of liquid level in the tank using various methods for given input parameters}
        \label{tab5}
        \resizebox{\textwidth}{!}{
            \renewcommand{\arraystretch}{5.3}
            \begin{tabular}{|c|c|c|c|c|c|}
                \hline
                \backslashbox{\textbf{Estimation methods}}{\textbf{qqqqqqqqq}}
                & %\multicolumn{1}{l|}{\myrotcell{wwwwwwww}}%    
                \vbox{\hbox{\multirow{1}{1pt}{\rotatebox{90}{\textbf{eeeeeee}}}}\vspace{9pt}} & \vbox{\hbox{\multirow{1}{1pt}{\rotatebox{90}{{\textbf{rrrrrrr} (\textcelsius)}}}}\vspace{2pt}} %\myrotcell{ttttttt(\textcelsius)}%
                & %\myrotcell{fffffff($kg/m^{3}$)}%
                \vbox{\hbox{\multirow{1}{1pt}{\rotatebox{90}{\textbf{{hhhhhh ($kg/m^{3}$)}}}}}\vspace{0.5pt}}
                & %\myrotcell{hhhhhhh(inchs)}%
                \vbox{\hbox{\multirow{1}{1pt}{\rotatebox{90}{\textbf{jjjjj ($inchs$)}}}}\vspace{22pt}}
                & \vbox{\hbox{\multirow{1}{1pt}{\rotatebox{90}{\textbf{Llllll ($m$)}}}}\vspace{1pt}}
                %\myrotcell{Liquid level(m)}% 
                \\ \hline
                \textbf{bus} & 1 & 11 & 111 & 11 & 1.1111 \\ \hline
                \textbf{bus}                  & 1 & 11 & 111 & 11 & 1.1111    \\ \hline
                \textbf{car}                 & 1 & 11 & 111 & 11 & 1.1111      \\ \hline
                \textbf{car}                    & 1 & 11 & 111 & 11 & 1.1111  \\ \hline
                \textbf{bus}                   & 1.1 & 111 & 1111 & 11 & 0.11                   \\ \hline
            \end{tabular}
        }
    \end{table}

答案1

你可能喜欢:

在此处输入图片描述

\documentclass{article}
\usepackage{lipsum}

\usepackage{rotating}   % needed
\usepackage{makecell}   % needed
\usepackage{tabularray}
\UseTblrLibrary{diagbox, siunitx, varwidth}

\begin{document}
    \begin{table}[ht]
    \centering
\settowidth\rotheadsize{wwwwwwww}
    \begin{tblr}{
      hline{1,Z} = {2-Z}{0.8pt}, hline{2,4-Y} = {solid}, hline{3,Z} = {0.8pt},
      vline{1}   = {2-Z}{solid}, vline{2-Z} = {solid},
         colspec = {Q[m, font=\bfseries]
                    Q[c, si={table-format=1.1}]
                    Q[c, si={table-format=3.0}]
                    Q[c, si={table-format=4.0}]
                    Q[c, si={table-format=2.0}]
                    Q[c, si={table-format=1.4}]},
    cell{2}{2-Z} = {cmd=\rotcell},
          row{2} = {font=\small\bfseries, rowsep=0pt},
         measure = vbox,
                  }
    &\SetCell[c=5]{c,font=\small\bfseries}   qqqqq
            &       &       &       &           \\                
\SetCell{c}{Estimation\\ methods}
    &   {wwwwwwww} 
            &   {rrrrrrr (\unit{\celsius})} 
                    &   {hhhhhh (\unit{\kilogram\per\cubic\meter})} 
                            &   {jjjjj (\unit{inch})}
                                    &   {Llllll (\unit{\metre})}    \\
bus & 1     & 11    & 111   & 11    & 1.1111    \\
bus & 1     & 11    & 111   & 11    & 1.1111    \\
car & 1     & 11    & 111   & 11    & 1.1111    \\
car & 1     & 11    & 111   & 11    & 1.1111    \\
bus & 1.1   & 111   & 1111  & 11    & 0.11      \\
    \end{tblr}
    \end{table}
\end{document}

相关内容