0

I have a table made using tabularx and I'd like to merge some of the cells which have the same content so that only one entry is required. When I try to use multicolumn as per enter link description here but this skews the table when additional text is added.

Can I have advice on either a) fixing the problem using tabularx or b) a better package to accommodate large amounts of text and numbers?

I have attached an MWE and image of the output.

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} 

enter image description here

Thanks in advance!

2
  • 1
    What do you mean by “skews the table”? Do you want to insert text to one row of your boxed part? Also, please remove the unnecessary packages to make your example code “minimal”. Aug 15, 2018 at 21:18
  • The only \multicolumn in your code has an empty content , so where is the problem?
    – Bernard
    Aug 15, 2018 at 22:06

1 Answer 1

3

i guess that you looking for something like this:

enter image description here

\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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .