3

Two of my columns have extra space before them which is not supposed to be there. I think the issue has to do with using \multicolumn inside a table with type X columns.

enter image description here

My source code:

\documentclass{IEEEtran}


\usepackage{fontspec}


\usepackage{tabularx}

    \newcolumntype{C}{ >{ \arraybackslash \Centering } X }

    \renewcommand \tabularxcolumn [1] {  >{ \centering } m{#1} }



\renewcommand{\tabularxcolumn}[1]{ >{\centering}m{#1} }


\usepackage{booktabs}

\usepackage{ragged2e}

\usepackage{makecell}

\usepackage{multirow}
\setlength\extrarowheight{10pt}

\usepackage{float}

\usepackage[defaultmathsizes, subdued, italic, LGRgreek, symbolre, symbolmisc]{mathastext}

\newcommand{\multcolhsize}[1]{\dimexpr #1\hsize + #1\tabcolsep + \tabcolsep \relax}

\usepackage{adjustbox}

\begin{document}

\newcommand{\RERInteractionSumm}{\sum_{j \in \mathnormalbold{R}, \thinspace j \neq i} P_{R, \thinspace j}^{\adjustbox{raise=0.1\baselineskip}{*}} \thinspace w_{ij}}

\begin{table*}[htb]

    % Table options

        % Caption
        \caption{Comparison of SDSCR obtained by}
        \label{table:SDSCR_full_v_app_27}

        % Center the table
        \centering


    \begin{tabularx}{\textwidth}{>{\hsize=0.9\hsize}C |>{\hsize=0.9\hsize}C |>{\hsize=0.9\hsize}C |>{\hsize=1.35\hsize}C |>{\hsize=1.35\hsize}C |>{\hsize=0.9\hsize}C |>{\hsize=0.9\hsize}C |>{\hsize=0.9\hsize}C |>{\hsize=0.9\hsize}C}

        \toprule


        $\left| V_{R, \thinspace i} \right|^{2}$ &  $\left| Z_{RR, \thinspace ii} \right|$& $P_{R, \thinspace i}^{\adjustbox{raise=0.05\baselineskip}{*}}$
        & \multicolumn{2}{>{\hsize=\multcolhsize{2}}C|}{
                        $ \displaystyle \RERInteractionSumm$
                                                    }
        & \multicolumn{2}{>{\hsize=\multcolhsize{2}}C|}{
                        $\left| S_{eq, \thinspace i}^{\adjustbox{raise=0.05\baselineskip}{*}} \right|$
                                                        }
        & \multicolumn{2}{>{\hsize=\multcolhsize{2}}C}{$SDSCR_{i}$}
        \\
        \Xhline{0.2mm}


        $0.992$ & $0.0941$ & $3$ & $-1.05-0.095j$ & $-0.95-0.513j$ & $1.95$ & $2.11$ & $5.41$ & $4.99$
        \\


        $0.995$ & $0.0921$ & $3$ & $-1.08-0.108j$ & $-0.97-0.529j$ & $1.92$ & $2.10$ & $5.62$ & $5.16$
        \\


        $0.997$ & $0.0910$ & $3$ & $-1.09-0.115j$ & $-0.98-0.537j$ & $1.91$ & $2.09$ & $5.73$ & $5.25$
        \\

        $0.999$ & $0.0900$ & $3$ & $-1.11-0.124j$ & $-1.00-0.547j$ & $1.90$ & $2.08$ & $5.86$ & $5.35$
        \\


        $1.001$ & $0.0886$ & $3$ & $-1.12-0.132j$ & $-1.01-0.557j$ & $1.88$ & $2.07$ & $6.01$ & $5.46$
        \\

        $1.003$ & $0.0872$ & $3$ & $-1.14-0.143j$ & $-1.02-0.569j$ & $1.86$ & $2.06$ & $6.16$ & $5.58$
        \\

        $1.005$ & $0.0858$ & $3$ & $-1.16-0.154j$ & $-1.04-0.582j$ & $1.85$ & $2.05$ & $6.34$ & $5.72$
        \\

        $1.007$ & $0.0843$ & $3$ & $-1.18-0.166j$ & $-1.06-0.596j$ & $1.83$ & $2.04$ & $6.54$ & $5.87$
        \\

        $1.009$ & $0.0827$ & $3$ & $-1.21-0.180j$ & $-1.07-0.612j$ & $1.80$ & $2.02$ & $6.77$ & $6.04$
        \\

        $1.011$ & $0.0809$ & $3$ & $-1.23-0.196j$ & $-1.09-0.630j$ & $1.78$ & $2.01$ & $7.02$ & $6.23$
        \\

        \bottomrule



    \end{tabularx}

\end{table*}


\end{document}
  • The width calculations for the three header cells that span two columns each are incorrect. Anyway, it's not even necessary to calculate their widths. It suffices to the the basic c column type: \multicolumn{2}{c}{...} – Mico Nov 17 '18 at 21:11
  • 1
    In addition to what @Mico said, I would never use tabularx for a data table of numbers, X columns are all about line breaking of text to a calculated width. – David Carlisle Nov 17 '18 at 21:41
  • don't use math italic for multi-letter words, as you image shows they are spaced incorrectly for a word, use \mathrm{eq} and \mathrm{SDSCR} – David Carlisle Nov 17 '18 at 21:42
  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – user36296 Mar 12 at 10:04
6
  • Using a tabularx environment for the table at hand seems like vast overkill. Moreover, one of the hallmark capabilities of a tabularx environment, viz., automatic line breaking, is never used. I suggest you use an array environment or, if the tabular must absolutely, positively, span the width of both columns, a tabular* environment. With either environment, there's no need to calculate cell widths, etc.

  • I would also like to suggest that you omit all vertical lines —-they’re not needed —- and be less generous with the value of \extrarowheight.

    enter image description here


\documentclass{IEEEtran}

\usepackage{fontspec}
\usepackage{array,ragged2e,booktabs,float}
\newcolumntype{C}{>{\Centering\arraybackslash} X }
\setlength\extrarowheight{4pt}

\usepackage[defaultmathsizes, subdued, italic, 
    LGRgreek, symbolre, symbolmisc]{mathastext}
\newcommand{\RERInteractionSumm}{%
   \sum_{j\in\mathbf{R},j\neq i} P_{R,j}^* w_{ij}}

\begin{document}
\begin{table*}[htb]
\caption{Comparison of SDSCR obtained by...}
\label{table:SDSCR_full_v_app_27}

\centering
%% First version: use an 'array' env.

$\begin{array}{@{} *{9}{c} @{}}
\toprule
| V_{R,i}|^{2} & | Z_{RR,ii}| & P_{R,i}^* & 
\multicolumn{2}{c}{\displaystyle\RERInteractionSumm}& 
\multicolumn{2}{c}{| S_{eq,  i}^*|}& 
\multicolumn{2}{c@{}}{\mathrm{SDSCR}_{i}}
\\
\cmidrule(r){1-1}
\cmidrule(lr){2-2}
\cmidrule(lr){3-3}
\cmidrule(lr){4-5}
\cmidrule(lr){6-7}
\cmidrule(l){8-9}
0.992 & 0.0941 & 3 & -1.05-0.095j & -0.95-0.513j & 1.95 & 2.11 & 5.41 & 4.99
\\
0.995 & 0.0921 & 3 & -1.08-0.108j & -0.97-0.529j & 1.92 & 2.10 & 5.62 & 5.16
\\
0.997 & 0.0910 & 3 & -1.09-0.115j & -0.98-0.537j & 1.91 & 2.09 & 5.73 & 5.25
\\
0.999 & 0.0900 & 3 & -1.11-0.124j & -1.00-0.547j & 1.90 & 2.08 & 5.86 & 5.35
\\
1.001 & 0.0886 & 3 & -1.12-0.132j & -1.01-0.557j & 1.88 & 2.07 & 6.01 & 5.46
\\
1.003 & 0.0872 & 3 & -1.14-0.143j & -1.02-0.569j & 1.86 & 2.06 & 6.16 & 5.58
\\
1.005 & 0.0858 & 3 & -1.16-0.154j & -1.04-0.582j & 1.85 & 2.05 & 6.34 & 5.72
\\
1.007 & 0.0843 & 3 & -1.18-0.166j & -1.06-0.596j & 1.83 & 2.04 & 6.54 & 5.87
\\
1.009 & 0.0827 & 3 & -1.21-0.180j & -1.07-0.612j & 1.80 & 2.02 & 6.77 & 6.04
\\
1.011 & 0.0809 & 3 & -1.23-0.196j & -1.09-0.630j & 1.78 & 2.01 & 7.02 & 6.23
\\
\bottomrule
\end{array}$

\vspace{1cm}

%%% Second version: use a 'tabular*' env.
\setlength\tabcolsep{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} *{9}{c} }
\toprule
$| V_{R,i}|^{2}$ & $| Z_{RR,ii}|$ & $P_{R,i}^*$ & 
\multicolumn{2}{c}{$\displaystyle\RERInteractionSumm$}& 
\multicolumn{2}{c}{$| S_{eq,  i}^*|$}& 
\multicolumn{2}{c}{$\mathrm{SDSCR}_{i}$}
\\
\cmidrule{1-1}
\cmidrule{2-2}
\cmidrule{3-3}
\cmidrule{4-5}
\cmidrule{6-7}
\cmidrule{8-9}
$0.992$ & $0.0941$ & $3$ & $-1.05-0.095j$ & $-0.95-0.513j$ & $1.95$ & $2.11$ & $5.41$ & $4.99$
\\
$0.995$ & $0.0921$ & $3$ & $-1.08-0.108j$ & $-0.97-0.529j$ & $1.92$ & $2.10$ & $5.62$ & $5.16$
\\
$0.997$ & $0.0910$ & $3$ & $-1.09-0.115j$ & $-0.98-0.537j$ & $1.91$ & $2.09$ & $5.73$ & $5.25$
\\
$0.999$ & $0.0900$ & $3$ & $-1.11-0.124j$ & $-1.00-0.547j$ & $1.90$ & $2.08$ & $5.86$ & $5.35$
\\
$1.001$ & $0.0886$ & $3$ & $-1.12-0.132j$ & $-1.01-0.557j$ & $1.88$ & $2.07$ & $6.01$ & $5.46$
\\
$1.003$ & $0.0872$ & $3$ & $-1.14-0.143j$ & $-1.02-0.569j$ & $1.86$ & $2.06$ & $6.16$ & $5.58$
\\
$1.005$ & $0.0858$ & $3$ & $-1.16-0.154j$ & $-1.04-0.582j$ & $1.85$ & $2.05$ & $6.34$ & $5.72$
\\
$1.007$ & $0.0843$ & $3$ & $-1.18-0.166j$ & $-1.06-0.596j$ & $1.83$ & $2.04$ & $6.54$ & $5.87$
\\
$1.009$ & $0.0827$ & $3$ & $-1.21-0.180j$ & $-1.07-0.612j$ & $1.80$ & $2.02$ & $6.77$ & $6.04$
\\
$1.011$ & $0.0809$ & $3$ & $-1.23-0.196j$ & $-1.09-0.630j$ & $1.78$ & $2.01$ & $7.02$ & $6.23$
\\
\bottomrule
\end{tabular*}
\end{table*}

\end{document}
  • 2
    +1 for not using my package:-) – David Carlisle Nov 17 '18 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.