我怎样才能让我的桌子看起来更美观?

我怎样才能让我的桌子看起来更美观?

我需要帮助让我的桌子看起来更好。截至目前,我拥有以下内容:

在此处输入图片描述

然而,我希望它看起来像这样:

在此处输入图片描述

下面是我的代码:

\begin{table}[h!]
\tiny
\resizebox{\textwidth}{!}{%
 \begin{tabular}{|c|c|c|c|c|c|c|}
\hline
\multirow{2}{*}{\textbf{Process}} & \textbf{Welding Parameters} & \textbf{Adherend size} & 
\textbf{Welding speed} & \textbf{Consolidation} & \textbf{Configuration} & \textbf{Remarks} 
\\
\cline{2-7}
& Force, Amplitude, speed/time &  & Speed, (Number of welds) & Force,Time/speed &  &  \\
\hline
\end{tabular}%
}
\caption{}
\end{table}enter code here

答案1

根据原帖提供的少量信息,我假设 5 个数据列应该尽可能窄,部分原因是为最后一列(标记为“备注”)留出更多空间。我还假设最后一列应启用自动换行。如果这些假设不正确,请告知。

如果这些假设是正确的,那么以下解决方案可能会引起人们的兴趣。请注意,我在一些标题单元格中使用了\makecell说明,以使它们尽可能窄。进一步注意,我不会使用大胆的在标题单元格中,既因为没有必要,也因为它迫使标题单元格变宽,不必要地从最重要的最后一列中扣除空间。

在此处输入图片描述

\documentclass{article} % or some other suitable document class
\usepackage[a4paper,margin=2.5cm]{geometry} % set page parameters as needed
\usepackage{booktabs,makecell,tabularx,ragged2e}
\newcolumntype{L}{>{\RaggedRight \hangafter=1 \hangindent=1em}X}

\begin{document}

\begin{table}[ht]
\small % optional
\setlength\tabcolsep{4pt} % default: 6pt
\begin{tabularx}{\textwidth}{@{} l ccccc L @{}}
\toprule
Process & 
\makecell[t]{Welding\\parameters} & 
\makecell[t]{Adherend\\size} & 
\makecell[t]{Welding\\speed} &
\makecell[t]{Consoli-\\dation} & 
\makecell[t]{Configu-\\ration} & 
Remarks \\
\cmidrule{2-7}
& 
\makecell[t]{Force, ampl.,\\ speed/time} &  
& 
\makecell[t]{Speed\\(no.\ of welds)} & 
\makecell[t]{Force,\\time/speed} &  
\\
\midrule
aaa aaa aaa aaa & b & c & d & e & f & ggg hhh iii jjj kkk lll nnn mmm ooo ppp qqq \\
rrr rrr rrr rrr & s & t & u & v & w & xxx yyy zzz \\
\bottomrule
\end{tabularx}
\caption{A seven-column table}
\end{table}
\end{document}

答案2

抱歉,但我也不喜欢这个目标。带有垂直线的桌子永远不是好的(优雅、正式的)桌子。

除此之外,使用的目的\resizebox是为了体现糟糕的设计,以及使用字体\tiny,但如果不知道文档的内容,就很难提出巧妙的替代方案。这里有一个,但有几个假设(例如,您需要一个具有“正常”边距的肖像表,标题如“力、振幅、速度/时间”可以分成 3 列并简化,并且内容不需要比标题更多的宽度)。所以,很可能它不适合你的数据,但无论如何我希望这个例子能有所帮助。

在此处输入图片描述

\documentclass{article}
\usepackage{booktabs,tabulary,multirow}
\usepackage{geometry}
\begin{document}
\begin{table}
\footnotesize
\begin{tabulary}{\linewidth}{@{}lCCCC>{\centering}p{6em}CCcp{3cm}@{}}\toprule
 \multirow{2}{*}{Process} & \multicolumn{3}{c}{Welding Parameters} &  \multirow{2}{=}{\parbox{4em}{\centering Adherend  size}} & 
\multirow{2}{=}{\centering  Welding speed\par\tiny (No. welds)} & \multicolumn{2}{c}{Consolidation}  &  \\\cmidrule(rl){2-4}\cmidrule(rl){7-8}
 & Force & \mbox{Amplitude} & v/t &    &  & Force & t/v & Configuration  & Remarks \\\midrule
xxx  & xxxx & xxxx  &  xxx  & xxxx & xxxx &  xxx  & xxxx & xxxx & Whatever very important to take a lot of space. \\
xxx  & xxxx & xxxx  &  xxx  & xxxx & xxxx &  xxx  & xxxx & xxxx & Something also very mportant  \\
\bottomrule
\end{tabulary}%
\end{table}
\end{document}

相关内容