0

EDIT: I'm using this template: PoPETs (Sciendo). This is important for the failure.

Here's some simple code to demonstrate which uses the dgruyter_NEW package from the above template:

\documentclass[USenglish,oneside,twocolumn]{article}
\usepackage[big]{dgruyter_NEW}
\usepackage{pifont}
\usepackage{amsfonts}
\usepackage[table]{xcolor}
\usepackage{booktabs,array}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.8}
\definecolor{tableheadcolor}{gray}{0.92}

\begin{document}
\begin{table*}[t]
\begin{tabularx}{\linewidth}{l}
    \rowcolor{tableheadcolor} A \\
\end{tabularx}
\end{table*}
\end{document}

The result:

For reference, I am using this template: PoPETs (Sciendo). Any ideas?

7
  • 1
    Welcome! Could you please post a complete example, which starts with \documentclass, ends with \end{document} and can be compiled? And explain why you put \centering after \end{tabularx}?
    – user194703
    Jun 10, 2020 at 2:22
  • Sure, I have done so. The \centering does not seem to have affected the result, I believe it was for a caption that I removed.
    – rosstex
    Jun 10, 2020 at 2:56
  • 2
    Thanks! The problem is that on my installation the package dgruyter_NEW is not known. If I replace it by tabularx, I can't reproduce the error.
    – user194703
    Jun 10, 2020 at 3:01
  • Thanks for looking into it! Yep, that package comes from the conference template. I have narrowed the issue to that template itself, but I haven't gotten further.
    – rosstex
    Jun 10, 2020 at 3:40
  • 2
    OK, then you probably may want to provide a link to the template, maybe a good soul will dig through it. (There is a general misconception that every .sty file is written by a LaTeX goddess. Unfortunately this is very far from the truth, and in particular conference templates often leave a lot room for improvement.)
    – user194703
    Jun 10, 2020 at 3:42

2 Answers 2

1

(My answer gives the same suggestion with @shaananc's answer, but with a complete example accompanied with some explanations.)

dgruyter_NEW.sty patches many internal macros including \@array. As @shaananc pointed, two \expandafter\ifx\d@llarbegin\begingroup\hskip-\col@sep\fi is added to the definition of \@preamble, which as I understand is used to remove the space before first column and after last column in a tabular. It seems this change is not compatible with \rowcolor.

In the following example, those two lines are removed from the definition of \@array (by \xpatchcmd from xpatch command), and tabular examples are given to illustrate what changed and how to restore the effect of dgruyter_NEW.sty manually.

\documentclass[USenglish,oneside,twocolumn]{article}
\usepackage[big]{dgruyter_NEW}
\usepackage{pifont}
\usepackage{amsfonts}
\usepackage[table]{xcolor}
\usepackage{booktabs,array}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.8}
\definecolor{tableheadcolor}{gray}{0.92}

\usepackage{xpatch}
\makeatletter
\xpatchcmd\@array
  {\expandafter\ifx\d@llarbegin\begingroup\hskip-\col@sep\fi}
  {}
  {}{\fail}
\xpatchcmd\@array
  {\expandafter\ifx\d@llarbegin\begingroup\hskip-\col@sep\fi}
  {}
  {}{\fail}
\makeatother

\begin{document}

\subsection*{With \texttt{\string\rowcolor}}
\begin{tabularx}{\linewidth}{c}
  \rowcolor{tableheadcolor} A \\
  B \\
  C \\
\end{tabularx}

\subsection*{Without \texttt{\string\rowcolor}}
\begin{tabular}{c}
  A \\
  B \\
  C \\
\end{tabular}\smallskip

Note the space of width \verb|\tabcolsep| is inserted before first column and after last column by default (again).

\subsection*{Without \texttt{\string\rowcolor}, use \texttt{@\{\}} to remove  that space}
\begin{tabular}{@{}c@{}}
  A \\
  B \\
  C \\
\end{tabular}\smallskip

Note this emulates the original effect of \verb|dgruyter_NEW.sty|.

\end{document}

enter image description here

1

This block of code in the template is causing the issues:

\def\@array[#1]#2{%
  \@tempdima \ht \strutbox
  \advance \@tempdima by\extrarowheight
  \setbox \@arstrutbox \hbox{\vrule
             \@height \arraystretch \@tempdima
             \@depth \arraystretch \dp \strutbox
             \@width \z@}%
  \begingroup
  \@mkpream{#2}%
  \xdef\@preamble{\noexpand \ialign \@halignto
                  \bgroup
                    \expandafter\ifx\d@llarbegin\begingroup\hskip-\col@sep\fi
                    \@arstrut \@preamble
                    \expandafter\ifx\d@llarbegin\begingroup\hskip-\col@sep\fi
                          \tabskip \z@ \cr}%
  \endgroup
  \@arrayleft
  \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi
  \bgroup
  \let \@sharp ##\let \protect \relax
  \lineskip \z@
  \baselineskip \z@
  \m@th
  \let\\\@arraycr \let\tabularnewline\\\let\par\@empty \@preamble}

It is used to modify the box sizes for the template, but I don't know enough to explain what the precise problem is or to provide a fix.

EDIT: My suspicion is that the lengths here aren't what they should be \expandafter\ifx\d@llarbegin\begingroup\hskip-\col@sep\fi

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.