1

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!

  • 2
    Please show us a complete MWE showing this error. When I put \documentclass{article} \usepackage{tabulary} \begin{document} to your code, I don't get any error. – LaRiFaRi May 6 '14 at 19:10
  • Remove \relax which is just before \end{tabulary}, for a start. And please provide a MWE. I confirm I get no error with minimal set-up. – user4686 May 6 '14 at 19:13
  • Other topics: use \centering instead of the center environment. What is the \relax for? It gives vertical lines for me, which can be avoided without it. – LaRiFaRi May 6 '14 at 19:13
  • And one more thing: Please accept answers (click on the check-mark sign to the left of an answer) to other questions of yours as such. This is the way to say thank you on this side. All your questions are still left open and may discourage volunteers to help you (just as a hint on our etiquette, no offence). – LaRiFaRi May 6 '14 at 19:25
  • 1
    The columns type L and C are used by tabulary; if you do \newcolumntype{L}{...} and \newcolumntype{C}{...} you confuse tabulary. – egreg May 7 '14 at 18:12
2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.