[Tex/LaTex] Weird error “Missing number treated as zero”

errorstabulary

I am preparing a PhD dissertation using the report document class. I'm using TexMaker. I keep getting an error message for this table:

\documentclass[12pt,a4paper,onesided]{report}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage[table]{xcolor}
\usepackage{amsfonts}
\usepackage{fixltx2e}
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage[T1]{fontenc}
\usepackage{tabu}
\usepackage{sectsty}
\sectionfont{\large}
    \subsectionfont{\normalsize}
\usepackage{caption}
    \captionsetup[figure]{labelfont=bf, textfont=bf}
    \captionsetup[table]{labelfont=bf, textfont=bf}
\setlength{\footnotesep}{\baselineskip}
\usepackage{textcomp}\usepackage{booktabs}
\usepackage{tabulary}
\usepackage{multirow}
\usepackage{hyperref}
\usepackage{float}
\usepackage{array}
    \newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
    \newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
    \makeatletter
\newcommand{\thickhline}{%
    \noalign {\ifnum 0=`}\fi \hrule height 2pt
    \futurelet \reserved@a \@xhline}
\newcolumntype{"}{@{\hskip\tabcolsep\vrule width 1pt\hskip\tabcolsep}}
\makeatother

\begin{document}

\begin{table}[ht!]
        \renewcommand{\arraystretch}{3.5}
        \small
        \begin{center}
        \caption{Alternate Wordings of the Survey, Fielded on Mechanical Turk.}
        \begin{tabulary}{1.1\textwidth}{|C|L|}
            \hline
            Alternate Version I & ``Would you support or oppose removing trade restrictions which would allow firms such as [\emph{Tuntyakore \& Zideying/Gordon \& Roberts}] to more freely sell their goods in the United States? (Note that all firms affected by such a policy would be highly similar to [\emph{Tuntyakore \& Zideying/Gordon \& Roberts}] in terms of their workforce characteristics.)''\\ \hline
        Alternate Version II & ``Would you support or oppose removing trade restrictions which would allow [\emph{Tuntyakore \& Zideying/Gordon \& Roberts}] to more freely sell its goods in the United States?''\\ \hline
        \end{tabulary}
        \end{center}
        \end{table}

The error message refers to the line that says "\end{tabulary} and states:

! Missing number, treated as zero.
<to be read again>
|
l.346 \end{tabulary}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Illegal unit of measure (pt inserted).
<to be read again>
|
l.346 \end{tabulary}
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

This table works fine when I build it in a smaller document but does not work in this one. Not sure what to change about it.

Thanks in advance!

Best Answer

The error is in the two lines

\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

because tabulary reserves the L and C column types for its needs and by redefining them the package gets confused.

Here's a minimal example, with just the needed packages. Note that the onesided option to report is wrong; it's called oneside and is the default anyway. I wouldn't set the caption text font to bold face.

\documentclass[12pt,a4paper]{report}
\usepackage{tabulary}
\usepackage{caption}

\captionsetup[table]{labelfont=bf, textfont=bf}

\begin{document}

\begin{table}[ht!]
\centering\small

\caption{Alternate Wordings of the Survey, Fielded on Mechanical Turk.}

\begin{tabulary}{\textwidth}{|C|L|}
\hline
Alternate Version I & 
  ``Would you support or oppose removing trade restrictions which would allow 
  firms such as [\emph{Tuntyakore \& Zideying/Gordon \& Roberts}] to more freely 
  sell their goods in the United States? (Note that all firms affected by such a 
  policy would be highly similar to [\emph{Tuntyakore \& Zideying/Gordon \& 
  Roberts}] in terms of their workforce characteristics.)''\\
\hline
Alternate Version II & 
  ``Would you support or oppose removing trade restrictions which would allow 
  [\emph{Tuntyakore \& Zideying/Gordon \& Roberts}] to more freely sell its 
  goods in the United States?''\\
\hline
\end{tabulary}
\end{table}

\end{document}

enter image description here