1

I am trying to make a table. Following is the sample of the table. But I got Illegal character in array error. I already searched all related question but did not find any solution. What did I do wrong?

   \begin{table*}[!ht]
    \centering
    \caption{Predictor Name and Data Source}
    \label{data}
    \resizebox{\textwidth}{!}{%
    \begin{tabular}{|l|l|l|1|}
    \hline
    \textbf{Type} & \textbf{Predictor Name} & \textbf{Acronym} & \textbf{Data Source} \\ \hline
    \multirow{9}{*}{Predictor} & Company Id & COMID & Lankabd.com \\ 
    \cline{2-4} 
                               & Lower Price & LOWPRCP & Household Size \\
                               \cline{2-4} 
                               & High Price & HIPRC & Male Literacy  \\
                               \cline{2-4} 
                               & Average Price & AVGPRC & Low Land \\
                               \cline{2-4} 
                               & Weighted Average Price & WTAVGPRC & Low Land \\
                               \cline{2-4} 
                               & Trade Number & TRDNO & Low Land \\
                               \cline{2-4} 
                               & Trade Volume & TRDVOL & Low Land \\
                               \cline{2-4} 
                                & Issued Share & ISSUEDSHARE & Low Land \\
                                \cline{2-4}
                               & Turn Over & TURNOVER & Households  \\
                               \hline

    \end{tabular}% 
    } 
    \end{table*}
3
  • 3
    the last column you intended l bit you have 1 (one) Nov 5, 2017 at 21:05
  • 2
    It is almost always bad to use \resizebox on a table there is no reason to scale the table Nov 5, 2017 at 21:06
  • 1
    note that [ht] prevents the table being placed on a float page (as no p) so makes it more likely that the table floats to the end of the document. Nov 5, 2017 at 21:56

1 Answer 1

1

The better way to obtain a table whose width equals that of the textblock is to use a tabular* environment.

I would also like to suggest that you give your table a more "open" look, by getting rid of all vertical rules and by using fewer, but well-spaced, horizontal rules.

enter image description here

\documentclass{article} 
\usepackage{graphicx,multirow,booktabs,caption}
\captionsetup{skip=0.333\baselineskip}
\begin{document}

\begin{table*}[!ht]
    \centering
    \caption{Original form}
    \label{data}
    \resizebox{\textwidth}{!}{%
    \begin{tabular}{|l|l|l|l|}
    \hline
    \textbf{Type} & \textbf{Predictor Name} & \textbf{Acronym} & \textbf{Data Source} \\ \hline
    \multirow{9}{*}{Predictor} & Company Id & COMID & Lankabd.com \\ 
    \cline{2-4} 
                               & Lower Price & LOWPRCP & Household Size \\
                               \cline{2-4} 
                               & High Price & HIPRC & Male Literacy  \\
                               \cline{2-4} 
                               & Average Price & AVGPRC & Low Land \\
                               \cline{2-4} 
                               & Weighted Average Price & WTAVGPRC & Low Land \\
                               \cline{2-4} 
                               & Trade Number & TRDNO & Low Land \\
                               \cline{2-4} 
                               & Trade Volume & TRDVOL & Low Land \\
                               \cline{2-4} 
                                & Issued Share & ISSUEDSHARE & Low Land \\
                                \cline{2-4}
                               & Turn Over & TURNOVER & Households  \\
                               \hline

    \end{tabular}% 
    } 
\end{table*}

\begin{table*}[!ht]
\caption{Proposed new look: No \texttt{\string\resizebox}, no vertical rules, \& fewer but well-spaced horizontal rules}
\label{take-two}
\setlength\tabcolsep{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}llll}
\toprule
    \textbf{Type} & \textbf{Predictor Name} & \textbf{Acronym} & \textbf{Data Source} \\ 
\midrule
Predictor 
    & Company Id & COMID & Lankabd.com \\ 
    & Lower Price & LOWPRCP & Household Size \\
    & High Price & HIPRC & Male Literacy  \\
    \addlinespace 
    & Average Price & AVGPRC & Low Land \\
    & Weighted Average Price & WTAVGPRC & Low Land \\
    & Trade Number & TRDNO & Low Land \\
    \addlinespace
    & Trade Volume & TRDVOL & Low Land \\
    & Issued Share & ISSUEDSHARE & Low Land \\
    & Turn Over & TURNOVER & Households  \\
\bottomrule
\end{tabular*}
\end{table*}
\end{document}  

You must log in to answer this question.

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