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
    \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
  • 3
    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
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

|improve this answer|||||

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.