# Multirow in tabularx?

Can we use multirow in tabularx? It seemed not working and recognized:

\multirow{2}{*}{95\% Confidence

Full code:

\documentclass{article}
\usepackage{makecell} % for bold in table using \small
\renewcommand\theadfont{\small} % for bold in table using \small
\usepackage{tabularx, ragged2e}
\usepackage{booktabs}

\begin{document}

\begin{table}[!ht]
\centering
\begin{tabularx}{\textwidth}{l>{\raggedright\arraybackslash}Xccc}
\toprule
& &  & \thead{\small {\textbf{Statistic}}}& \thead{\small {\textbf{Std. Error}}} \\
\midrule
\multicolumn{1}{l}{Difference} & Mean
& & 44.20000 & 4.54068  \\
\cline{2-5}
& \multirow{2}{*}{95\% Confidence Interval for Mean} & Lower Bound & 33.9283 & \\
\cline{3-5}
& & Upper Bound & \54.4717 \\
\cline{2-5}
& Kurtosis & & -1.000 & 1.334 \\
\bottomrule
\end{tabularx}
\end{table}

\end{document}

Outcome:

I actually want something like below:

• Please tag your question only with appropriate tags. I notice that a lot of your questions have been tagged with biblatex even though they were about tables and have nothing to to with biblatex. (Ironically, one of your questions that was about biblatex was not tagged with biblatex initially.) Appropriate tagging makes it easier for people to find your question and avoids confusions. I'm only mentioning this now since I noticed that this became a pattern and people always had to re-tag your questions that were otherwise tagged quite well. – moewe Aug 11 at 15:08
• @moewe, thanks. I was thinking this writing is biblatex. I will take note it next time. – aan Aug 11 at 15:11
• I see. biblatex (ctan.org/pkg/biblatex) is a bibliography and citation package that has usually nothing to do with tables. One sign that this question is not about biblatex is that your MWE does not load the package at all (there is no \usepackage{biblatex} or \usepackage[<options>]{biblatex}). – moewe Aug 11 at 15:14
• More or less, it is not always easy to decide on tags and for package tags like booktabs or biblatex the fact that you use the package is more of a necessary condition rather than a sufficient condition to use the tag. In this case I would guess that booktabs is not actually that relevant to the problem at hand and would not tag the question with booktabs, but I may well be wrong. The important tags are certainly multirow and tables and possibly to a lesser extent tabularx. – moewe Aug 11 at 15:22
• Don't get me wrong. You don't need to get everything "right" on a first attempt: Sometimes it only transpires what is really relevant once the answer is known. And people here are well aware that tagging is an art and not always easy. If one knows what biblatex does it is fairly clear from the MWE that it is not involved and hence the tag not helpful. Since biblatex popped up a lot in your question tags (and almost always was not relevant) I thought it would be better to mention it than silently correcting it for all future questions. – moewe Aug 11 at 15:27

You can 1) if you load multirow and 2) use the = key, since you're in a fixed width column. I took the liberty to use the S column type for the last two columns, to have an alignment of the numbers on the decimal dot, and set the font for the column heads instead of hard coding each in the table. Also, I replaced the \clines with \cmidrule s to add some padding around the rules.

\documentclass{article}
\usepackage{makecell} % for bold in table using \small
\renewcommand\theadfont{\small} % for bold in table using \small
\usepackage{tabularx, ragged2e, multirow}
\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}

\begin{table}[!ht]
\centering
\sisetup{table-number-alignment=center}
\begin{tabularx}{\textwidth}{l>{\raggedright\arraybackslash}XcS[table-format=-1.5]S[table-format=1.5]}
\toprule
& & & {\thead{Statistic}}& {\thead{Std. Error}} \\
\midrule
\multicolumn{1}{l}{Difference} & Mean
& & 44.20000 & 4.54068 \\
\cmidrule{2-5}
& \multirow{2}{=}{95\% Confidence Interval for Mean} & Lower Bound & 33.9283 & \\
\cmidrule{3-5}
& & Upper Bound & \ 54.4717 \\
\cmidrule{2-5}
& Kurtosis & & -1.000 & 1.334 \\
\bottomrule
\end{tabularx}
\end{table}

\end{document}

• In this case, I think that the figures should be normalised (padded with zeros) to have the same number of decimals. This was the recommendation in two books regarding typography which I have read the last month (one Norwegian, one American). However, if you have text after the last decimal (parenthesis, footnotemark) you should align at the decimal point. – Sveinung Aug 11 at 15:45
• @Sveinung: this is a sensible point of view, except perhaps for the kurtosis, which seems to have a very different order of magnitude. – Bernard Aug 11 at 16:14
• Of cause, if adding zeros changes the meaning, you should not add them. But how can -1.000 00 be different from -1.000? (Stupid lawyer question :) ) – Sveinung Aug 11 at 16:16
• The difference lies in the number of significant figures it implies. – Bernard Aug 11 at 16:27
• Understood. Thank you for enlighten me. – Sveinung Aug 11 at 16:28

I wouldn't use a \multirow directive. Instead, I would place the cell contents into a bespoke tabular environment, as is done in the following example.

\documentclass{article}
\usepackage{tabularx, % for 'tabularx' env.
ragged2e, % for \RaggedRight macro
booktabs, % for \toprule, \midrule, etc
siunitx,  % for 'S' column type
amsmath}  % for [b] option of \smash command
\sisetup{group-digits=false}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\newcommand\mytab[1]{\smash[b]{%
\begin{tabular}[t]{@{}L@{}} #1 \end{tabular}}}

\begin{document}

\begin{table}[!ht]
%%\centering % not needed
\begin{tabularx}{\textwidth}{ @{} l L l
S[table-format=-1.5]
S[table-format= 1.5] @{}}
\toprule
& & & {Statistic} & {Std.\ Error} \\
\midrule
Difference & Mean & & 44.20000 & 4.54068  \\
\cmidrule(l){2-5}
& \mytab{95\% Confidence Interval for Mean} & Lower Bound & 33.9283 & \\
\cmidrule(l){3-5}
& & Upper Bound & 54.4717 \\
\cmidrule(l){2-5}
& Kurtosis & & -1.000 & 1.334 \\
\bottomrule
\end{tabularx}
\end{table}

\end{document}

If you typeset a calstable using the package cals, spanning cells horizontally and vertically centre them, is easy.

\usepackage{cals, url}
\usepackage{babel}
\usepackage{xcolor}
\usepackage[footnotefigures]{MinionPro}
\input{glyphtounicode}
\pdfgentounicode=1
\usepackage[scaled=0.86]{luximono}
\RequirePackage[utf8]{inputenx}
\RequirePackage[T1]{fontenc}

\RequirePackage[letterspace=100,%
babel=true,%
tracking=true,%
kerning=true]%
{microtype}

\renewcommand{\sfdefault}{uop}
\let\nc=\nullcell                                                  % Shortcuts
\let\sc=\spancontent

\setkomafont{captionlabel}{\normalfont}

\begin{document}

\begin{table*}
\caption{A caption}
\begin{calstable}[c]
% Defining columns relative to each other and relative to the margins
\colwidths{{\dimexpr(\columnwidth)/6\relax}
{\dimexpr(\columnwidth)/5\relax}
{\dimexpr(\columnwidth)/6\relax}
{\dimexpr(\columnwidth)/6\relax}
{\dimexpr(\columnwidth)/6\relax}
}
% The tabular fills the text area if sum of all columns is 5

% Set up the tabular
\makeatletter
\def\cals@framers@width{0.8pt}   % Outside frame rules, reduce if the rule is too heavy
\def\cals@framecs@width{0pt}
\def\cals@bodyrs@width{0.6pt}
\cals@setcellprevdepth{Al}
\def\cals@cs@width{0pt}             % Inside rules, reduce if the rule is too heavy
\def\cals@rs@width{0.6pt}
\def\cals@bgcolor{}

\def\bb{\ifx\cals@borderB\relax     % Botton border switch (off-on)
\def\cals@borderB{0pt}
\else \let\cals@borderB\relax\fi}

% R1H1
\brow
\lp\cell{}\lp
\cell{}
\cell{}
\alignR\cell{\vfil Statistics}
\rp\alignR\cell{\vfil Std. Error}\rp
\erow
\mdseries%
}
\tfoot{\lastrule\strut}
%R2B1
\brow
\lp\bb\alignL\cell{Difference}\lp
\bb\alignL\cell{Mean}
\cell{}
\alignR\cell{44.200\,00}
\rp\alignR\cell{4.540\,68}\rp\bb
\erow
%R3B2
\brow
\lp\cell{}\lp
\nc{lrt}
\bb\alignL\cell{Lower Bound}
\alignR\cell{33.928\,30}
\rp\cell{}\rp\bb
\erow
%R4B3
\brow
\lp\cell{}\lp
\bb\nc{lrb}\alignL\sc{\vfil 95\% Confidence\\ Interval for Mean}
\alignL\cell{Upper Bound}
\alignR\cell{54.471\,70}
\rp\cell{}\rp
\erow
%R5B4
\brow
\lp\cell{}\lp
\alignL\cell{Kurtosis}
\cell{}
\alignR\cell{-1.000\hspace*{0.9em}}
\rp\alignR\cell{1.334\hspace*{0.9em}}\rp
\erow
\makeatletter
\end{calstable}\par
\end{table*}

\end{document}
• I had tried \input{glyphtounicode} But there is an error. I am using Overleaf. It said LaTex Error: File MinionPro.sty` – aan Aug 11 at 17:23
• @aan Sorry for not cleaning up the MWE. Replace \usepackage[footnotefigures]{MinionPro} with \usepackage{lmodern} and delete the two next lines, i.e. \input{glyphtounicode} \pdfgentounicode=1. Also package url, luximono and xcolor is unnecessary. – Sveinung Aug 12 at 7:25
• thanks for your reply. Yes, working well now. Thanks – aan Aug 12 at 13:22