我有一个使用 制作的表格tabularx
,我想合并一些具有相同内容的单元格,以便只需要一个条目。当我尝试使用multicolumn
使用在此处输入链接描述但当添加额外的文本时,表格就会变得扭曲。
我能否就以下问题提供一些建议:a) 使用什么方法修复问题tabularx
;或者 b) 使用更好的包来容纳大量文本和数字?
我已附加 MWE 和输出图像。
平均能量损失
\documentclass[11pt,a4paper]{report}
\usepackage{color}
\usepackage[hidelinks]{hyperref}
\usepackage{graphicx, epstopdf}
\usepackage{etoolbox}%This package combined with the \pathcmd rewrites the standard style for 'Chapter' to allow the fancy horizontal and vertical lines.
\patchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{mystyle}}{}{}
\graphicspath{{../Visuals/}}
\usepackage{gensymb}
\usepackage{adjustbox}
\usepackage{tabulary}
\usepackage{tabularx}
\usepackage{booktabs,caption, makecell}
\usepackage{pdflscape,afterpage,caption}
\usepackage[british]{babel}
\usepackage[backend=bibtex, citestyle=ieee, bibstyle=ieee]{biblatex}
\usepackage[section]{placeins}%Allows you to permanently fix figures.
\usepackage{titleps}%fancy page borders?
\usepackage[left=2.5cm, right=2.5cm, top=3.5cm, bottom=3.5cm]{geometry}
%\usepackage{caption}
\captionsetup[figure]{font=scriptsize,labelfont=scriptsize}
\usepackage{microtype}
\usepackage{setspace}
\usepackage{amsmath}
\usepackage{datetime}
\usepackage{lipsum}%random text generator. [1-XXXX] to specify the number of paragraphs.
\newdate{date}{28}{02}{2018}
\date{\displaydate{date}}
\onehalfspacing
\setcounter{secnumdepth}{3}
\newcolumntype{Z}{ >{\centering\arraybackslash}X }
\renewcommand\theadfont{\bfseries}
%\renewcommand\theadalign{cc}
\usepackage[autolanguage, np]{numprint}
\begin{document}
\begin{table}[!h]
\setlength\tabcolsep{4pt}
\caption{Caption}
\begin{tabularx}{\textwidth}{*{6}{Z}}
%\toprule
\multicolumn{4}{c}{} \\
\midrule
\thead{Test} & \thead{Theoretical \\ Yield (mg)} & \thead{Flow \\ rates \\} & \thead{Residence \\ time, \\ $\tau$ (minutes)} & \thead{Temperature \\ ($\degree$C)} & \thead{Solvent} \\%
\midrule
1 & TEXT & TEXT & TEXT & TEXT & TEXT \\
2 & 70.0 & 64, 65, 71 & 10 & -15 & DCM \\
3 & 70.0 & 64, 65, 71 & 10 & 5 & DCM \\
4 & 70.0 & 64, 65, 71 & 10 & 10 & DCM \\
\bottomrule
\label{Label}
\end{tabularx}
\end{table}
\end{document}
提前致谢!
答案1
我猜你正在寻找这样的东西:
\documentclass[11pt,a4paper]{report}
\usepackage{booktabs, makecell, multirow}
\renewcommand\theadfont{\small\bfseries}
\renewcommand\theadgape{}
\usepackage[skip=1ex]{caption}
\usepackage{siunitx}
\begin{document}
\begin{table}[!h]
\caption{Caption}
\label{Label}
\setlength\tabcolsep{0pt}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} *{6}{c} }
\toprule
\thead{Test}
& \thead[b]{Theoretical \\ Yield (mg)}
& \thead[b]{Flow \\ rates}
& \thead[b]{Residence \\ time $\tau$\\ (minutes)}
& \thead[b]{Temperature \\ (\si{\celsius})}
& \thead[b]{Solvent} \\
\midrule
1 & TEXT & TEXT & TEXT & TEXT & TEXT \\
2 & \multirow{3}{*}{70.0}
& \multirow{3}{*}{64, 65, 71}
& \multirow{3}{*}{10}
& -15 & \multirow{3}{*}{DCM} \\
3 & & & & 5 & \\
4 & & & & 10 & \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}