Sunday, 19 May 2013

Text does not fit into table which causes bad box errors

Text does not fit into table which causes bad box errors

I use Excel2Latex to convert tables in Excel to Latex, however a problem arises when the text is too long to fit in the column and I get many bad box errors. My code is:
% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{table}[htbp]
  \centering
  \caption{Add caption}
    \begin{tabular}{rr}
    \toprule
    \multicolumn{1}{c}{\textbf{Variable}} & \multicolumn{1}{c}{\textbf{Description}} \\
    \midrule
    \multicolumn{1}{l}{\textit{W\_hours}} & \multicolumn{1}{l}{The average number of hours worked each week by the respondent} \\
    \multicolumn{1}{l}{\textit{W\_hours\_dummy}} & \multicolumn{1}{l}{A dummy variable that takes the value of unity if the respondent works more than 0 hours each week, and zero otherwise} \\
    \multicolumn{1}{l}{\textit{W\_age}} & \multicolumn{1}{l}{The age (in years) of the woman} \\
    \multicolumn{1}{l}{\textit{W\_educ}} & \multicolumn{1}{l}{The number of years of formal education of the woman} \\
    \multicolumn{1}{l}{\textit{W\_exper}} & \multicolumn{1}{l}{The woman's work experience (in years)} \\
    \multicolumn{1}{l}{\textit{Hus\_age}} & \multicolumn{1}{l}{The age (in years) of the woman's husband} \\
    \multicolumn{1}{l}{\textit{Hus\_educ}} & \multicolumn{1}{l}{The number of years of formal education of the woman's husband} \\
    \multicolumn{1}{l}{\textit{Hus\_inc}} & \multicolumn{1}{l}{The annual income (in \$'000s) of the woman's husband} \\
    \multicolumn{1}{l}{\textit{faminc}} & \multicolumn{1}{l}{The annual income (in \$'000s) of the family unit} \\
    \multicolumn{1}{l}{\textit{kids05}} & \multicolumn{1}{l}{The number of children under the age of 6} \\
    \multicolumn{1}{l}{\textit{kids618}} & \multicolumn{1}{l}{The number of children aged between 6 and 18} \\
    \multicolumn{1}{l}{\textit{largecity}} & \multicolumn{1}{l}{A dummy variable that takes the value of unity if the woman lives in a large city, and zero otherwise} \\
    \multicolumn{1}{l}{\textit{W\_mothereduc}} & \multicolumn{1}{l}{The number of years of formal education of the woman's mother} \\
    \multicolumn{1}{l}{\textit{W\_fathereduc}} & \multicolumn{1}{l}{The number of years of education of the woman's father} \\
    \multicolumn{1}{l}{\textit{W\_motherworked}} & \multicolumn{1}{l}{A dummy variable that takes the value of unity if the woman's mother was herself a working mum, and zero otherwise} \\
    \multicolumn{1}{l}{\textit{Hus\_mothereduc}} & \multicolumn{1}{l}{The number of years of formal education of the woman's husband's mother} \\
    \multicolumn{1}{l}{\textit{Hus\_fathereduc}} & \multicolumn{1}{l}{The numbger of years education of the woman's husband's father} \\
    \multicolumn{1}{l}{\textit{Hus\_motherworked}} & \multicolumn{1}{l}{A dummy variable that takes the value of unity if the woman's husband's mother was herself a working mum, and zero otherwise} \\
    \bottomrule
    \end{tabular}%
  \label{tab:addlabel}%
\end{table}%
The resulting table produced looks like:

What are some solutions to this?

No comments:

Post a Comment