7

I am doing something wrong here. I get a message saying

Use of \@array doesn't match its definition. `\@ifnextchar ... \reserved@d =#1\def  
\reserved@a { #2}\def \reserved@b {#3}\f... l.108 ...tabular}{|c|>{\centering}p{3cm}
|c|c|l|c|}.

Here is a complete code

\documentclass{exam}
\usepackage{textcomp, booktabs}
\begin{document}
\section*{\large \textrecipe}

\begin{tabular}{|c|>{\centering}p{3cm}|c|c|l|c|}
\toprule 
Sr No & Drug & Dose  & frequency & Duration & Remark \midrule
1 &  &  & -~~ -~~ -  & x & before/with/after meals, at night \midrule
\hline 
2 &  &  & -~~ -~~ -  & x & before/with/after meals, at night \\
\hline 
3 &  &  & -~~ -~~ -  & x & before/with/after meals, at night \\ 
\hline 
4 &  &  & -~~ -~~ -  & x & before/with/after meals, at night \\ 
\hline 
5 &  &  & -~~ -~~ -  & x & before/with/after meals, at night  \\
\hline 
6 &  &  & -~~ -~~ -  & x & before/with/after meals, at night \\
\hline 
7 &  &  & -~~ -~~ -  & x & before/with/after meals, at night  \bottomrule 

\end{tabular}



\end{document}
1
  • 3
    you need the array package for the extended .>{...} syntax Commented Dec 1, 2014 at 10:18

1 Answer 1

4

Solved. Just add array package or Modify code like this

\section*{\large \textrecipe}
\begin{table}[htp]
\rowcolors{2}{gray!25}{white}
\begin{tabular}{c p{3cm}p{3cm}clc} 
\toprule 
 Sr No & Drug & Dose  & frequency & Duration & Remark \\ \midrule
1 &  &  & -~~ -~~ -  & x & before/with/after meals, at night \\

 2 &  &  & -~~ -~~ -  & x & before/with/after meals, at night \\

3 &  &  & -~~ -~~ -  & x & before/with/after meals, at night \\ 

 4 &  &  & -~~ -~~ -  & x & before/with/after meals, at night \\ 

5 &  &  & -~~ -~~ -  & x & before/with/after meals, at night  \\

6 &  &  & -~~ -~~ -  & x & before/with/after meals, at night \\

7 &  &  & -~~ -~~ -  & x & before/with/after meals, at night \\ \bottomrule 

\end{tabular}
\end{table}
\end{document}
2
  • It might be an idea not to use [h] but at least [htp]. If the table is a bit long, it will not fit at as a [h]=[ht] float. And since the list is then empty, the float ends up at the end of the chapter.
    – daleif
    Commented Dec 1, 2014 at 10:29
  • It's a bad idea mixing commands from booktabs like \toprule and \midrule with vertical rules. Just remove the | characters in the argument to tabular and the useless \hline you have.
    – egreg
    Commented Dec 1, 2014 at 10:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .