4

If I use \rowcolor the \pm symbol that I have in the row gets cropped, it seems.

MWE:

\documentclass{article}
\usepackage{dcolumn}
\usepackage{xcolor,colortbl}

\definecolor{lightgray}{HTML}{EEEEEE}

\begin{document}
    \begin{tabular}{lcD{.}{.}{3}p{0cm}D{.}{.}{3}}
        \toprule
        \textbf{Model} & \textbf{MAPE} & \multicolumn{3}{c}{\textbf{Time (s)}}\\
        \midrule
        \rowcolor{lightgray} \texttt{snaive} & 29.28\% & 0.003 & $\pm$ &
            0.001\\
        \texttt{ARIMA} & 34.02\% & 22.480 & $\pm$ & 13.210\\
        \rowcolor{lightgray} \texttt{GAM} & 15.32\% & 18.481 & $\pm$ &
            0.854\\
        \rowcolor{lightgray} \texttt{GAMM[p = 1]} & 11.06\% & 447.861 &
            $\pm$ & 191.182\\
        \bottomrule
    \end{tabular}
\end{document}

This is the resulting output: table

The problem is really visible, but here it is the zoomed-in version:

symbols

They appear cropped to the right. I don't know what would cause this and how I could fix it.

  • 1
    p{0cm} is too small change to p{5mm} for example – flav Sep 26 '17 at 12:00
4

You need to give some value in para mode definition instead of zero, i.e., \begin{tabular}{lcD{.}{.}{3}p{**1cm**}D{.}{.}{3}}

  • You're right, it works now. I wonder why it a width of 0 is enough when \rowcolor is not used. – rubik Sep 26 '17 at 12:04
  • 4
    @rubik Because, when you are not coloring the row, it is not necessarily a problem if the glyph hangs over into the next column. But if you are coloring the row, then the overhang gets overwritten by the next column's color box. – Steven B. Segletes Sep 26 '17 at 12:06
  • @StevenB.Segletes Great, nice explanation... – MadyYuvi Sep 26 '17 at 12:15
  • @StevenB.Segletes Thanks Steven, the explanation was very clear! – rubik Sep 26 '17 at 12:15

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.