# longtable, siunitx, multirow, multicolumn, textsuperscript combination problem

I have the table below with, \multirow, \multicolumn and \textsuperscript calls. I would like to have all entries centered, and the numerical entries additionally "scientifically" aligned right (as done by the siunitx package). For the time being I use \rlap, but that only aligns the text superscripts, not the numerical entries. Ideally, I should use something like the siunitx package, and in principle it should automatically align the textsuperscripts, but I am having trouble combining the siunitx package with my current code. Can anyone help?

\begin{center}

\renewcommand{\arraystretch}{1.5}

\begin{tiny}

\begin{longtable}{ccc}
\caption{...}\label{tab:1}\\
\hline
Text & Text & $X$\\
&      & $\mathrm{\left[\%\right]}$\\
\hline
\multicolumn{3}{l}%
{\tablename\ \thetable\ (\emph{continued from previous page})} \\
\hline
Text & Text & $X$\\
&      & $\mathrm{\left[\%\right]}$\\
\hline
\hline
\multicolumn{3}{r}%
{(\emph{continued on next page})} \\
\endfoot
\hline
\\
\multicolumn{3}{l}%
{\shortstack[l]{\textsuperscript{a}Method 1\\
\textsuperscript{b}Remark}}
\endlastfoot

Text & Text & 70.5\rlap{\textsuperscript{a}}\\
& Text & 8.8\rlap{\textsuperscript{a}}\\
& Text & 78.1\rlap{\textsuperscript{a}}\\
& Text & 7.0\rlap{\textsuperscript{a}}\\
& Text & 76.5\rlap{\textsuperscript{a}}\\
& Text & 92.5\rlap{\textsuperscript{a,b}}\\
Text & \multirow{2}{*}{text} & \multirow{2}{*}{8.71\rlap{\textsuperscript{a}}}\\
Text &      &\\

Text & Text & 79.2\rlap{\textsuperscript{a}}\\
& Text & 69.0\rlap{\textsuperscript{a}}\\
& Text & 65.2\rlap{\textsuperscript{a}}\\
& Text & 77.7\rlap{\textsuperscript{a}}\\
& Text & 69.7\rlap{\textsuperscript{a,b}}\\
& Text & 67.6\rlap{\textsuperscript{a}}\\
&      &\\
\cdashline{1-3}
\multicolumn{2}{c}%
{\textbf{Mean}} & 76.35\\
\multicolumn{2}{c}%
{(SD)}          & (7.82)\\

\end{longtable}

\end{tiny}
\end{center}


Here the shortened MWE combining \multirow with \tablenum, to achieve the same alignment, but with larger space between the two rows than with \makecell:

\documentclass{article}

\usepackage{longtable}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{arydshln}

\usepackage{makecell}

\usepackage{multirow}

\begin{document}

\renewcommand{\arraystretch}{1.5}

\begin{longtable}{ccc}

\caption{...}\label{tab:1}\\

\hline
Text & Text & $X$\\
&      & [\%]\\
\hline
\multicolumn{3}{l}{\tablename\ \thetable\ (\emph{continued from previous page})} \\
\hline
Text & Text &  $X$\\
&      &  [\%]\\
\hline
\hline
\multicolumn{3}{r}{(\emph{continued on next page})} \\
\endfoot
\hline
\multicolumn{3}{l}%
{\shortstack[l]{\textsuperscript{a}Method 1\\
\textsuperscript{b}Remark 1}}
\endlastfoot

\multirow{ 1}{*}{Ttext} & \multirow{ 1}{*}{Ttext} & \multirow{ 1}{*}{\tablenum[table-format = 2.1]{70.5}\rlap{\textsuperscript{a,b}}}\\
Ttext & \multirow{ 2}{*}{Ttext} & \multirow{ 2}{*}{\tablenum[table-format = 2.1]{8.7}\rlap{\textsuperscript{a}}}\\
Ttext & &\\
\cdashline{1-3}
\multicolumn{2}{c}{\textbf{Mean}} &  \multirow{ 1}{*}{\tablenum[table-format = 2.1]{76.3}}\\
\multicolumn{2}{c}{(SD)}          &  \multirow{ 1}{*}{\tablenum[table-format = 2.1,input-symbols=()]{(7.8)}}\\

\end{longtable}

\end{document}

• As always on this site, you are much much more likely to get help if you post a full minimal example instead of sniplets. Then others can easily copy and work with your code. Some people might not know where \shortstack comes from. Also why are you using left/right like that? Not needed at all. – daleif Jun 25 '18 at 17:44
• Thanks daleif! I'll upload the full MWE ASAP. As for the \left[...\right] it's just because I have other tables which need that and I streamlined them. – user165074 Jun 25 '18 at 17:51
• It looks like you've got two separate accounts, which means you cannot edit your original post or leave comments. The Stack Exchange staff can merge them together for you. – Phelype Oleinik Jun 25 '18 at 23:36
• That would be great Phelype! – user165074 Jun 26 '18 at 6:40

Maybe you are looking for something like the following:

\documentclass{article}

\usepackage{longtable}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{arydshln}
\usepackage{threeparttablex}
\usepackage{makecell}

\begin{document}

\renewcommand{\arraystretch}{1.5}

\begin{ThreePartTable}
\begin{TableNotes}
\item[a] Method 1
\item[b] Remark
\end{TableNotes}
\begin{longtable}{ccS[table-format=2.2,input-symbols=()]}
\caption{...}\label{tab:1}\\
\toprule
Text & Text & $X$\\
&      & [\%]\\
\midrule
\multicolumn{3}{l}{\tablename\ \thetable\ (\emph{continued from previous page})} \\
\hline
Text & Text &  $X$\\
&      &  [\%]\\
\midrule
\hline
\multicolumn{3}{r}{(\emph{continued on next page})} \\
\endfoot
\hline
\insertTableNotes
\endlastfoot

Text & Text & 70.5\tnote{a}\\
& Text & 8.8\tnote{a}\\
& Text & 78.1\tnote{a}\\
& Text & 7.0\tnote{a}\\
& Text & 76.5\tnote{a}\\
& Text & 92.5\tnote{a,b}\\
\makecell{Text \\Text} & text & 8.71\tnote{a}\\

Text & Text & 79.2\tnote{a}\\
& Text & 69.0\tnote{a}\\
& Text & 65.2\tnote{a}\\
& Text & 77.7\tnote{a}\\
& Text & 69.7\tnote{a}\\
& Text & 67.6\tnote{a}\\

\cdashline{1-3}
\multicolumn{2}{c}{\textbf{Mean}} & 76.35\\
\multicolumn{2}{c}{(SD)}          & (7.82)\\

\end{longtable}
\end{ThreePartTable}

\end{document}


I have used siunitx's S column with an appropriate table-format option in order to align the numbers with respect to the decimal separator.

For the notes, I have used the threeparttablex package and its ThreePartTable and TableNotes environments, as well as the \tnote command.

Additionally, I have replaced the \hlines by rules from the booktabs package.

I have also replaced the \multirow commands by a makecell command in the first column in order to achieve a similar layout without destroying the alignment in this particular row.

Lastly, I have removed the center environment as longtables are centered by default. From the longtable documentation:

The optional argument of longtable controls the horizontal alignment of the table. The possible options are [c] , [r] and [l] , for centring, right and left adjustment, respectively. Normally centring is the default,[...]

• Thanks a lot leandriis! Looks great. Ideally, I would prefer to use \multirow and \textsuperscript to stay in line with the code I use for other tables for which I don't really need the siunitx package. Is it possible to elegantly achieve that at all or is it too complex? – user165074 Jun 25 '18 at 19:04
• You can also achieve the same alignment without the threeparttable environment and the tnote commands. However, I don't think it is easily possible to use \multirow as its contents can't be interpreted as numbers by siunitx. Using {} around the command will successfully compile, but the alignment is centered, not with respect to the decimal separator. – leandriis Jun 25 '18 at 19:26
• I can live with \makecell, but just in case I want more space between the two lines therein by using \multirow, it is possible (see shortened MWE I just added). Thanks again! – user165074 Jun 25 '18 at 22:10