# How to solve \headrow error?

\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}
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}

• \headrow is not a command of threeparttable, could you please add a minimal example which reproduces your error? – CarLaTeX Sep 7 '19 at 4:24
• @CarLaTeX check please the example – user2869180 Sep 7 '19 at 4:28
• I can't find any package which defines \headrow, why don't you simply use \hline? Or \toprule from booktabs package? – CarLaTeX Sep 7 '19 at 4:48
• i need a table where a get an alternative row color – user2869180 Sep 7 '19 at 4:51
• you presumably saw some documentation that suggested a command called \headrow that document must have told you how to define it (it is not a standard command) – David Carlisle Sep 7 '19 at 8:33

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}
\begin{document}
\begin{table}[bt]
\centering
\caption{Toy Students Dataset}
\label{owakey}
\begin{threeparttable}
\begin{tabular}{lccc}
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: