2

I coded the following table:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[]{booktabs}
\title{table}
\author{subham.soni007 }
\date{March 2015}

\begin{document}
\begin{table}[h]
\begin{tabular}{@{}lll@{}}
\toprule
\multicolumn{1}{c}{\textbf{PARAMETER}}                                               & \multicolumn{1}{c}{\textbf{EXISTING SYSTEM}}                                                        & \multicolumn{1}{c}{\textbf{PROPOSED SYSTEM}}                                                          \\ \midrule
\textbf{Type}                                                                        & Content-Based                                                                                       & Service-Based                                                                                         \\
\textbf{User’s Context}                                                              & \begin{tabular}[c]{@{}l@{}}The dialogue does not change \\ according to user’s context\end{tabular} & \begin{tabular}[c]{@{}l@{}}The dialogue changes according \\ to user’s context and needs\end{tabular} \\
\textbf{\begin{tabular}[c]{@{}l@{}}Failure\\ Recovery\end{tabular}}                  & \begin{tabular}[c]{@{}l@{}}User is not notified \\ about the failure\end{tabular}                   & \begin{tabular}[c]{@{}l@{}}The session is maintained, next time\\ when the user calls\end{tabular}    \\
\textbf{\begin{tabular}[c]{@{}l@{}}Number\\ of Dialogues\end{tabular}}               & Fixed                                                                                               & Variable                                                                                              \\
\textbf{\begin{tabular}[c]{@{}l@{}}Use of Domain-Specific\\  Knowledge\end{tabular}} & \begin{tabular}[c]{@{}l@{}}Does\\ not use\end{tabular}                                              & Uses domain-specific knowledge                                                                        \\ \bottomrule
\end{tabular}
\end{table}
\end{document}

When I compile in WinEdt, I get an error that missing number treated as zero near \begin{tabular}{@{}lll@{}}. But when I compile with sharelatex, everything is fine. What is the issue?

5
  • 2
    I get no error on TeXLive 2014...
    – user31729
    Commented Mar 23, 2015 at 15:46
  • 2
    Also with MikTeX 2.9.
    – percusse
    Commented Mar 23, 2015 at 15:46
  • 1
    Also with MiKTeX and WinEdt.
    – Bernard
    Commented Mar 23, 2015 at 16:03
  • 1
    You say you get the error near \begin{tabular}{@{}lll@{}}, but are you sure that your code you are working on matches the MWE? I ask because I often get "missing number" errors in tables when I'm missing a brace in a parameter. Commented Mar 24, 2015 at 0:20
  • No error either with TeXworks and MacTeX2014.
    – Mico
    Commented Mar 24, 2015 at 6:41

2 Answers 2

4

I propose this code, which is simpler:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[]{booktabs}
\setlength\defaultaddspace{1.25ex}
\usepackage{ragged2e}
\usepackage{array, tabularx}
\renewcommand{\tabularxcolumn}[1]{>{\RaggedRight\arraybackslash} m{#1}}
\newcolumntype{Y}{ >{\bfseries\RaggedRight\hsize=0.9\hsize}X}
\newcolumntype{Z}{ >{\RaggedRight\hsize=1.1\hsize}X}
\usepackage{makecell}
\renewcommand\theadalign{{p{5cm}}c}
\renewcommand\theadfont{\bfseries}
\title{table}
\author{subham.soni007 }
\date{March 2015}

\begin{document}

\begin{table}[h]
  \setlength\tabcolsep{4pt}%
  \begin{tabularx}{\linewidth}{@{\,}>{\bfseries}YXZ@{\,}}
    \toprule
    \thead{PARAMETER} & \thead{EXISTING SYSTEM} & \thead{PROPOSED SYSTEM} \\
    \midrule
    Type & Content-Based & Service-Based \\
    \addlinespace
    User’s Context & The dialogue does not change according to user’s context & The dialogue changes according to user’s context and needs \\
    \addlinespace
    Failure Recovery & User is not notified about the failure & The session is maintained, next time when the user calls \\
    \addlinespace
    Number\break of Dialogues & Fixed & Variable \\
    \addlinespace
    Use of Domain-Specific Knowledge
                              & Does not use & Uses domain-specific knowledge \\
    \bottomrule
  \end{tabularx}
\end{table}
\end{document} 

enter image description here

2

Rather than use ALL-CAPS HEADERS and bold lettering to provide visual emphasis, I would focus on optimizing the table's structure in order to enhance its readability and intelligibility. To that effect, it's usually a good idea to avoid repetitive material and to move important information into the header row and left-most column of the table.

Here's a before-and-after comparison of the way your table can look.

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs,ragged2e,tabularx}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\usepackage{xcolor}  % just for this example
\begin{document}

\noindent
\textcolor{red}{\texttt{after}}
\begin{table}[h]
  \begin{tabularx}{\textwidth}{@{} LLL @{}}
    \toprule
    Parameter & Existing System & Proposed System \\
    \midrule
    Type & Content-based & Service-based \\ \addlinespace
    Dialogue changes with user's context and needs & No & Yes \\ \addlinespace
    Failure recovery & User is not notified about the failure 
       & Session is maintained, next time when the user calls \\ \addlinespace
    Number of dialogues & Fixed & Variable \\ \addlinespace
    Use of domain-specific knowledge & No & Yes \\
    \bottomrule
  \end{tabularx}
\end{table}

\bigskip\noindent 
\textcolor{red}{\texttt{before}} (width of text block is exceeded massively)
\begin{table}[h]
\begin{tabular}{@{}lll@{}}
\toprule
\multicolumn{1}{c}{\textbf{PARAMETER}}                                               & \multicolumn{1}{c}{\textbf{EXISTING SYSTEM}}                                                        & \multicolumn{1}{c}{\textbf{PROPOSED SYSTEM}}                                                          \\ \midrule
\textbf{Type}                                                                        & Content-Based                                                                                       & Service-Based                                                                                         \\
\textbf{User’s Context}                                                              & \begin{tabular}[c]{@{}l@{}}The dialogue does not change \\ according to user’s context\end{tabular} & \begin{tabular}[c]{@{}l@{}}The dialogue changes according \\ to user’s context and needs\end{tabular} \\
\textbf{\begin{tabular}[c]{@{}l@{}}Failure\\ Recovery\end{tabular}}                  & \begin{tabular}[c]{@{}l@{}}User is not notified \\ about the failure\end{tabular}                   & \begin{tabular}[c]{@{}l@{}}The session is maintained, next time\\ when the user calls\end{tabular}    \\
\textbf{\begin{tabular}[c]{@{}l@{}}Number\\ of Dialogues\end{tabular}}               & Fixed                                                                                               & Variable                                                                                              \\
\textbf{\begin{tabular}[c]{@{}l@{}}Use of Domain-Specific\\  Knowledge\end{tabular}} & \begin{tabular}[c]{@{}l@{}}Does\\ not use\end{tabular}                                              & Uses domain-specific knowledge                                                                        \\ \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 .