1

\headrow is not working and give error on Overleaf:

The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.

even I use \usepackage{threeparttable}

How to solve that?

\begin{table}[bt]
\centering
\caption{Toy Students Dataset}
  \label{owakey}
\begin{threeparttable}
\begin{tabular}{lccc}
\headrow
t & FirstName & LastName & HasFriend \\
student\_1&&&\\
    student\_2&&&---\\
    student\_3& &&\\ 
\hiderowcolors

\hline  % Please only put a hline at the end of the table
\end{tabular}
\end{threeparttable}
\end{table}

with \documentclass[12pt]{memoireuqam1.3ang}

1 Answers1

3

The command \headrow is defined in a custom class developed by Overleaf called wiley-article.cls (see Copy/paste code from Overleaf to LaTeX?). The definition there is \newcommand{\headrow}{\rowcolor{black!20}}, which fits your description of an 'alternative row color'. The \rowcolor command itself is provided by the colortbl package, which can be loaded using \usepackage[table]{xcolor}. Loading xcolor also allows to use color specifications like black!20 (20% black).

MWE:

\documentclass{memoir}
\usepackage{threeparttable}
\usepackage[table]{xcolor}
\newcommand{\headrow}{\rowcolor{black!20}}
\begin{document}
\begin{table}[bt]
\centering
\caption{Toy Students Dataset}
  \label{owakey}
\begin{threeparttable}
\begin{tabular}{lccc}
\headrow
t & FirstName & LastName & HasFriend \\
student\_1&&&\\
    student\_2&&&---\\
    student\_3& &&\\ 
\hiderowcolors

\hline  % Please only put a hline at the end of the table
\end{tabular}
\end{threeparttable}
\end{table}
\end{document}

Result:

enter image description here

Marijn
  • 37,699