如何在合并单元格内换行

如何在合并单元格内换行

我在将一些文本放入合并单元格时遇到了麻烦。这是表格的代码。

\begin{table}
\resizebox{\textwidth}{!}{%
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{\textbf{\begin{tabular}[c]{@{}c@{}}Solute in\\ Measurement\\ Number\end{tabular}}} & \textbf{PNR} & \textbf{PRL} & \textbf{TPL} & \textbf{PMT} & \textbf{AMT} & \textbf{HXP} \\ \hline
\multirow{3}{*}{\textbf{\begin{tabular}[c]{@{}c@{}}Area\\ Under\\ Each\\ Peak\\ (mAu$\cdot$min)\end{tabular}}} & 1 & 212.47839 & 1041.35779 & 851.02411 & 755.29639 & 802.65906 & 371.62747 \\ \cline{2-8} 
 & 2 & 213.23718 & 1045.07227 & 858.31976 & 757.09601 & 807.86127 & 353.14246 \\ \cline{2-8} 
 & 3 & 213.71013 & 1047.04382 & 858.27057 & 762.12048 & 809.55322 & 365.25497 \\ \hline
\multirow{3}{*}{\textbf{Ratio}} & 1 & 0.57175103 & 2.8021550 & 2.2899925 & 2.0324019 & 2.1598486 & 1 \\ \cline{2-8} 
 & 2 & 0.60382764 & 2.9593504 & 2.4305198 & 2.1438827 & 2.2876356 & 1 \\ \cline{2-8} 
 & 3 & 0.58509849 & 2.8666107 & 2.3497848 & 2.2164058 & 2.2164058 & 1 \\ \hline
\multicolumn{2}{|c|}{\textbf{Average}} & 0.58689239 & 2.8760387 & 2.3567657 & 2.0876095 & 2.2212966 & 1 \\ \hline
\end{tabular}%
}
\end{table}

以下是它的产品。 在此处输入图片描述

有人能帮我把短语“每个峰下的面积(mAu*min)”放在这里的单元格里吗?(我知道字体是 Times New Roman,但无论如何我使用什么字体都无所谓。是的,每个单词都按原样输入,因为我仍然想坚持使用这种文本大小。)

答案1

您的表格有三种可能的版本。由于没有给出 MWE,我猜是 documentclass。

在此处输入图片描述

\documentclass{article}
\usepackage{multirow}
\usepackage{makecell}
\renewcommand{\theadfont}{\normalsize\bfseries}

\usepackage{booktabs}

\usepackage{geometry}
\begin{document}

\begin{table}
\setlength{\tabcolsep}{5.9pt}
\centering
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{\thead{Solute in\\ Measurement\\ Number}} & \thead{PNR} & \thead{PRL} & \thead{TPL} & \thead{PMT} & \thead{AMT} & \thead{HXP} \\ 
\hline
\textbf{Area Under} & 1 & 212.47839 & 1041.35779 & 851.02411 & 755.29639 & 802.65906 & 371.62747 \\ \cline{2-8} 
\textbf{Each Peak} & 2 & 213.23718 & 1045.07227 & 858.31976 & 757.09601 & 807.86127 & 353.14246 \\ \cline{2-8} 
\textbf{(mAu$\cdot$min)} & 3 & 213.71013 & 1047.04382 & 858.27057 & 762.12048 & 809.55322 & 365.25497 \\ \hline
 & 1 & 0.57175103 & 2.8021550 & 2.2899925 & 2.0324019 & 2.1598486 & 1 \\ \cline{2-8} 
\textbf{Ratio} & 2 & 0.60382764 & 2.9593504 & 2.4305198 & 2.1438827 & 2.2876356 & 1 \\ \cline{2-8} 
 & 3 & 0.58509849 & 2.8666107 & 2.3497848 & 2.2164058 & 2.2164058 & 1 \\ \hline
\multicolumn{2}{|c|}{\thead{Average}} & 0.58689239 & 2.8760387 & 2.3567657 & 2.0876095 & 2.2212966 & 1 \\ \hline
\end{tabular}%
\end{table}


\begin{table}
\renewcommand{\theadfont}{\normalsize}
\centering
\begin{tabular}{cccccccc}
\toprule
\multicolumn{2}{c}{\thead{Solute in\\ Measurement\\ Number}} & \thead{PNR} & \thead{PRL} & \thead{TPL} & \thead{PMT} & \thead{AMT} & \thead{HXP} \\ 
\midrule
{Area Under} & 1 & 212.47839 & 1041.35779 & 851.02411 & 755.29639 & 802.65906 & 371.62747 \\  
{Each Peak} & 2 & 213.23718 & 1045.07227 & 858.31976 & 757.09601 & 807.86127 & 353.14246 \\ 
{(mAu$\cdot$min)} & 3 & 213.71013 & 1047.04382 & 858.27057 & 762.12048 & 809.55322 & 365.25497 \\ \midrule
 & 1 & 0.57175103 & 2.8021550 & 2.2899925 & 2.0324019 & 2.1598486 & 1 \\ 
{Ratio} & 2 & 0.60382764 & 2.9593504 & 2.4305198 & 2.1438827 & 2.2876356 & 1 \\  
 & 3 & 0.58509849 & 2.8666107 & 2.3497848 & 2.2164058 & 2.2164058 & 1 \\ \midrule
\multicolumn{2}{c}{\thead{Average}} & 0.58689239 & 2.8760387 & 2.3567657 & 2.0876095 & 2.2212966 & 1 \\ \bottomrule
\end{tabular}%
\end{table}


\begin{table}
\renewcommand{\theadfont}{\normalsize}
\centering
\begin{tabular}{rcccccc}
\toprule
  & \multicolumn{6}{c}{\thead{Solute in Measurement Number}}\\
  & \thead{PNR} & \thead{PRL} & \thead{TPL} & \thead{PMT} & \thead{AMT} & \thead{HXP} \\ 
\midrule
\multicolumn{7}{@{}l}{Area Under Each Peak (mAu$\cdot$min)}\\
  1 & 212.47839 & 1041.35779 & 851.02411 & 755.29639 & 802.65906 & 371.62747 \\  
  2 & 213.23718 & 1045.07227 & 858.31976 & 757.09601 & 807.86127 & 353.14246 \\ 
  3 & 213.71013 & 1047.04382 & 858.27057 & 762.12048 & 809.55322 & 365.25497 \\ 
\multicolumn{7}{@{}l}{Ratio} \\
  1 & 0.57175103 & 2.8021550 & 2.2899925 & 2.0324019 & 2.1598486 & 1 \\ 
  2 & 0.60382764 & 2.9593504 & 2.4305198 & 2.1438827 & 2.2876356 & 1 \\  
  3 & 0.58509849 & 2.8666107 & 2.3497848 & 2.2164058 & 2.2164058 & 1 \\ 
Average & 0.58689239 & 2.8760387 & 2.3567657 & 2.0876095 & 2.2212966 & 1 \\ \bottomrule
\end{tabular}%
\end{table}

\end{document}

答案2

首先,我想问的是,在六个数据列中显示 5 到 8 位小数是否有用。我不能确定,因为我不知道这个表格到底是什么。不过,我有一种预感,如果你只显示 2 位或最多 3 位小数,你的读者会更满意。不是5 或 8。

为了减少显示的数字数量而不必重新输入所有数字,使用siunitx包、其S列类型及其与路由相关的选项会很方便 - 请参阅下面的实现。

有了这个设置,似乎没有必要进行任何换行扭曲。

在此处输入图片描述

\documentclass{article}
\usepackage{booktabs,siunitx}
\begin{document}

\begin{table}
\setlength\tabcolsep{0pt}
\sisetup{round-mode=places,
         round-precision=2,
         table-format=3.2} % set a default col. format

\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} lc 
   S S[table-format=4.2] *{4}{S} }
\toprule
Solute in Measurement & Number &
{PNR} & {PRL} & {TPL} & {PMT} & {PMT} & {HXP} \\ 
\midrule
Area under each peak & 1 & 212.47839 & 1041.35779 & 851.02411 & 755.29639 & 802.65906 & 371.62747 \\ 
\quad(mAu$\cdot$min) & 2 & 213.23718 & 1045.07227 & 858.31976 & 757.09601 & 807.86127 & 353.14246 \\ 
 & 3 & 213.71013 & 1047.04382 & 858.27057 & 762.12048 & 809.55322 & 365.25497 \\
\addlinespace
Ratio & 1 & 0.57175103 & 2.8021550 & 2.2899925 & 2.0324019 & 2.1598486 & 1 \\ 
 & 2 & 0.60382764 & 2.9593504 & 2.4305198 & 2.1438827 & 2.2876356 & 1 \\
 & 3 & 0.58509849 & 2.8666107 & 2.3497848 & 2.2164058 & 2.2164058 & 1 \\ 
\addlinespace
Average & & 0.58689239 & 2.8760387 & 2.3567657 & 2.0876095 & 2.2212966 & 1 \\ 
\bottomrule
\end{tabular*}
\end{table}
\end{document}

相关内容