Why do I get the error “Missing number, treated as zero”

tables

I am currently defining a custom list environment for my CV. After significant help by this community, I managed to get the list environment as desired and it worked like a charm. However, compiling now generates an error. I am quite shocked, because I haven’t changed anything since the last successful compilation (at least, not knowingly. Hence, I’m at a complete loss at what is causing the error. The error that I get is “ Missing number, treated as zero”. The following MWE replicates the error.

\documentclass{article}
    
\usepackage{ragged2e}

\pagestyle{empty}
      
\newenvironment{entrylist}{%
  \noindent
  \begin{tabular*}{}{@{\extracolsep{\fill}}rl}
}{%
  \end{tabular*}
}
\renewcommand{\bfseries}{}
\newcommand{\entry}[4]{%
    \parbox[t]{2cm}{#1\raggedleft}&\parbox[t]{\dimexpr\textwidth-2\tabcolsep-2cm}{\strut%
    \textbf{#2}%
    \hfill%
    {\footnotesize #3\par}\\%
    #4\vspace{\parsep}%
  }\\}
  

\begin{document}
    
\begin{entrylist}
    
\entry
   {Office}
   {A very fancy building in a very fancy place}
   {}
   {}
  
\entry
   {Website}
   {www.somename.com}
   {}
   {}
    
 \entry
   {Email}
   {somename a aaa}
   {}
   {}
   
 \entry
   {Phone}
   {+00 0000 000000}
   {}
   {}
  
\end{entrylist}
    
\end{document}

Any help and finding and correcting the culprit of the error will be greatly appreciated.

Thank you all very much in advance for your time.

Best Answer

There are two errors in your code.

  • The first argument of the tabular* environment must not be empty. Instead, it has got to be a usable, i.e., positive length. Hence, I suggest you replace

    \begin{tabular*}{}{@{\extracolsep{\fill}}rl}
    

    with

    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}rl}
    

    Actually, the contents of the columns are hard-coded to be fixed-width \parbox entitities. Hence, the tabular* machinery does absolutely nothing useful. Thus, just write

    \newenvironment{entrylist}{%
      \noindent
      \begin{tabular}{@{}rl@{}}
    }{%
      \end{tabular}
    }
    
  • Second, there shouldn't be a \\ (line-break) directive in

    {\footnotesize #3\par}\\%
    

    since \par already produces a line-break.


To summarize, I think you may want to define the environment entrylist and the macro \entry as follows:

\newenvironment{entrylist}{%
  \noindent
  \begin{tabular}{@{} r l @{}}}{%
  \end{tabular}}

\newcommand{\entry}[4]{%
    \parbox[t]{2cm}{#1\raggedleft} &
    \parbox[t]{\dimexpr\textwidth-2\tabcolsep-2cm\relax}{\strut%
    #2%
    \hfill%
    {\footnotesize #3\par}
    #4\vspace{\parsep}%
  }\\}
Related Question