0

I am new to Latex and have a table that keeps erroring out. The message I receive is "missing } inserted." I believe the error is being caused somewhere between lines 300-322 because I have run the code without the asterisk symbols (i.e. $0.44^{***}$) and it works fine. Am I missing a package or have I coded something wrong?

Thanks

\documentclass{article}

\usepackage{longtable,lscape,booktabs}

\begin{document}

% Table generated by Excel2LaTeX from sheet 'Sheet5'
\begin{landscape}
\begin{table}[h]\centering
   \caption{MNL Model with Grouped Disposal as DV}
   \scalebox{0.8}{
\begin{tabular}{lccccccccccc}
\cmidrule{2-12}          & \multicolumn{3}{c}{\textbf{Recycle vs. Trash }} &       & \multicolumn{3}{c}{\textbf{Recycle vs. Store }} &       & \multicolumn{3}{c}{\textbf{Store vs Trash }} \\
\cmidrule{2-12}          & \multicolumn{1}{c}{I} & \multicolumn{1}{c}{II} & \multicolumn{1}{c}{III} &       & \multicolumn{1}{c}{IV} & \multicolumn{1}{c}{V} & \multicolumn{1}{c}{VI} &       & \multicolumn{1}{c}{VII} & \multicolumn{1}{c}{VIII} & \multicolumn{1}{c}{IX} \\
          & \multicolumn{1}{c}{Coef.} & \multicolumn{1}{c}{Std. Error} & \multicolumn{1}{c}{Odds ratio} &       & \multicolumn{1}{c}{Coef.} & \multicolumn{1}{c}{Std. Error} & \multicolumn{1}{c}{Odds ratio} &       & \multicolumn{1}{c}{Coef.} & \multicolumn{1}{c}{Std. Error} & \multicolumn{1}{c}{Odds ratio} \\
\cmidrule{2-12}    1. EPR: Yes & $0.44^{*}$  & 0.21  & 1.55  &       & 0.06  & 0.18  & 1.06  &       & 0.38  & 0.24  & 1.46 \\
    1. LEGALAWARENESS: Yes & 0.07  & 0.22  & 1.07  &       & -$0.34^{*}$ & 0.16  & 0.71  &       & 0.41  & 0.25  & 1.50 \\
    1. LOCTAWARENESS: Maybe & $1.37^{***}$  & 0.23  & 3.92  &       & 1.17  & 0.19  & 3.92  &       & 0.20  & 0.28  & 1.22 \\
    2. LOCTAWARENESS: Yes & $1.67^{***}$  & 0.26  & 5.30  &       & $1.48^{***}$  & 0.20  & 4.41  &       & 0.18  & 0.30  & 1.20 \\
    2. IMPORTANCE: Not very & -0.08 & 0.66  & 0.95  &       & -0.65 & 0.95  & 0.52  &       & 0.56  & 0.88  & 1.76 \\
    3. IMPORTANCE: Neutral & $1.03^{^}$  & 0.58  & 2.80  &       & 0.25  & 0.87  & 1.28  &       & 0.78  & 0.82  & 2.18 \\
    4. IMPORTANCE: Somewhat Important & $1.95^{**}$  & 0.57  & 7.06  &       & -0.32 & 0.84  & 0.73  &       & $2.28^{**}$  & 0.80  & 9.74 \\
    5. IMPORTANCE: Very Important & $2.34^{***}$  & 0.57  & 10.41 &       & 0.02  & 0.85  & 10.41 &       & $2.32^{**}$  & 0.81  & 10.17 \\
    1. INFOSOURCE: General & 0.41  & 0.34  & 1.51  &       & $1.19^{***}$  & 0.31  & 3.30  &       & -$0.78^{*}$ & 0.40  & 0.46 \\
    2. INFOSOURCE: Government & $0.76^{*}$  & 0.36  & 2.14  &       & $1.08^{***}$  & 0.30  & 2.94  &       & -0.32 & 0.40  & 0.73 \\
    3. INFOSOURCE: Retailer Manufacturer & 0.55  & 0.39  & 1.74  &       & $0.77^{**}$  & 0.34  & 2.66  &       & -0.42 & 0.46  & 0.65 \\
    4. INFOSOURCE: Non Profit & $0.77^{*}$  & 0.38  & 2.16  &       & $1.09^{***}$  & 0.32  & 2.98  &       & -0.32 & 0.44  & 0.73 \\
    1. PREVENT: Too Expensive & -1.19 & 0.77  & 0.31  &       & -0.60 & 0.47  & 0.55  &       & -0.59 & 0.89  & 0.55 \\
    2. PREVENT: Inconvenient Location & -$1.73^{*}$ & 0.74  & 0.18  &       & -$1.06^{*}$ & 0.45  & 0.35  &       & -0.67 & 0.86  & 0.51 \\
    3. PREVENT: Unable to Transport & -1.13 & 0.75  & 0.32  &       & -0.22 & 0.47  & 0.81  &       & -0.91 & 0.88  & 0.40 \\
    4. PREVENT: Unaware of Location & -$1.57^{*}$ & 0.73  & 0.21  &       & -$0.87^{*}$ & 0.46  & 0.42  &       & -0.70 & 0.86  & 0.50 \\
    1. RURAL: Yes & -0.23 & 0.19  & 0.78  &       & -$0.37^{**}$ & 0.15  & 0.69  &       & 0.14  & 0.22  & 1.16 \\
    2. AGE: 36-45 & 0.35  & 0.29  & 1.43  &       & 0.05  & 0.20  & 2.95  &       & 0.31  & 0.32  & 0.58 \\
    3. AGE: 46-55 & 0.00  & 0.25  & 0.98  &       & $0.94^{***}$  & 0.23  & 2.55  &       & -$0.94^{**}$ & 0.31  & 0.39 \\
    4. AGE: 56-65 & 0.44  & 0.28  & 1.49  &       & $1.09^{***}$  & 0.24  & 2.95  &       & -$0.65^{*}$ & 0.33  & 0.52 \\
    5. AGE: 66+ & $0.60^{^}$  & 0.34  & 1.82  &       & $1.14^{***}$  & 0.29  & 3.13  &       & -0.54 & 0.41  & 0.58 \\
    2. DISTANCE: 1-5 miles & $0.61^{**}$  & 0.23  & 1.83  &       & 0.45  & 0.28  & 1.57  &       & -$0.47^{**}$ & 0.41  & 0.62 \\
    3. DISTANCE: 6-10 miles & 0.38  & 0.25  & 1.46  &       & 0.33  & 0.27  & 1.39  &       & 0.25  & 0.40  & 1.29 \\
    4. DISTANCE: 11-20 miles & $0.02^{^}$  & 0.34  & 1.02  &       & 0.54  & 0.29  & 1.42  &       & -0.19 & 0.42  & 0.83 \\
    \bottomrule
     \midrule
\textit{***p $<$ .001, ** p $<$.01, *p$<$.05, $^\wedge$ p$<$.1} &       &       &       &       &       &       &       &       &       &       &       &       &       &  \\
\end{tabular}}}
  \label{tab:results}%
\end{table}%
\end{landscape}
\end{document}

2 Answers 2

1

Then tex reports the error at

l.21     3. IMPORTANCE: Neutral & $1.03^{^}

I guess you intended ^{*} ?

then tex reports

! Extra alignment tab has been changed to \cr.
l.42 ... &       &       &       &       &       &

as you have too many & in that row.

It then runs without error but the markup is very poor (it may be better just to hand write the table rather than generate it)

\documentclass{article}

\usepackage{longtable,lscape,booktabs}

\begin{document}

% Table generated by Excel2LaTeX from sheet 'Sheet5'
\begin{landscape}
\begin{table}[h]\centering
   \caption{MNL Model with Grouped Disposal as DV}
   \scalebox{0.8}{
\begin{tabular}{lccccccccccc}
\cmidrule{2-12}          & \multicolumn{3}{c}{\textbf{Recycle vs. Trash }} &       & \multicolumn{3}{c}{\textbf{Recycle vs. Store }} &       & \multicolumn{3}{c}{\textbf{Store vs Trash }} \\
\cmidrule{2-12}          & \multicolumn{1}{c}{I} & \multicolumn{1}{c}{II} & \multicolumn{1}{c}{III} &       & \multicolumn{1}{c}{IV} & \multicolumn{1}{c}{V} & \multicolumn{1}{c}{VI} &       & \multicolumn{1}{c}{VII} & \multicolumn{1}{c}{VIII} & \multicolumn{1}{c}{IX} \\
          & \multicolumn{1}{c}{Coef.} & \multicolumn{1}{c}{Std. Error} & \multicolumn{1}{c}{Odds ratio} &       & \multicolumn{1}{c}{Coef.} & \multicolumn{1}{c}{Std. Error} & \multicolumn{1}{c}{Odds ratio} &       & \multicolumn{1}{c}{Coef.} & \multicolumn{1}{c}{Std. Error} & \multicolumn{1}{c}{Odds ratio} \\
\cmidrule{2-12}    1. EPR: Yes & $0.44^{*}$  & 0.21  & 1.55  &       & 0.06  & 0.18  & 1.06  &       & 0.38  & 0.24  & 1.46 \\
    1. LEGALAWARENESS: Yes & 0.07  & 0.22  & 1.07  &       & -$0.34^{*}$ & 0.16  & 0.71  &       & 0.41  & 0.25  & 1.50 \\
    1. LOCTAWARENESS: Maybe & $1.37^{***}$  & 0.23  & 3.92  &       & 1.17  & 0.19  & 3.92  &       & 0.20  & 0.28  & 1.22 \\
    2. LOCTAWARENESS: Yes & $1.67^{***}$  & 0.26  & 5.30  &       & $1.48^{***}$  & 0.20  & 4.41  &       & 0.18  & 0.30  & 1.20 \\
    2. IMPORTANCE: Not very & -0.08 & 0.66  & 0.95  &       & -0.65 & 0.95  & 0.52  &       & 0.56  & 0.88  & 1.76 \\
    3. IMPORTANCE: Neutral & $1.03^{*}$  & 0.58  & 2.80  &       & 0.25  & 0.87  & 1.28  &       & 0.78  & 0.82  & 2.18 \\
    4. IMPORTANCE: Somewhat Important & $1.95^{**}$  & 0.57  & 7.06  &       & -0.32 & 0.84  & 0.73  &       & $2.28^{**}$  & 0.80  & 9.74 \\
    5. IMPORTANCE: Very Important & $2.34^{***}$  & 0.57  & 10.41 &       & 0.02  & 0.85  & 10.41 &       & $2.32^{**}$  & 0.81  & 10.17 \\
    1. INFOSOURCE: General & 0.41  & 0.34  & 1.51  &       & $1.19^{***}$  & 0.31  & 3.30  &       & -$0.78^{*}$ & 0.40  & 0.46 \\
    2. INFOSOURCE: Government & $0.76^{*}$  & 0.36  & 2.14  &       & $1.08^{***}$  & 0.30  & 2.94  &       & -0.32 & 0.40  & 0.73 \\
    3. INFOSOURCE: Retailer Manufacturer & 0.55  & 0.39  & 1.74  &       & $0.77^{**}$  & 0.34  & 2.66  &       & -0.42 & 0.46  & 0.65 \\
    4. INFOSOURCE: Non Profit & $0.77^{*}$  & 0.38  & 2.16  &       & $1.09^{***}$  & 0.32  & 2.98  &       & -0.32 & 0.44  & 0.73 \\
    1. PREVENT: Too Expensive & -1.19 & 0.77  & 0.31  &       & -0.60 & 0.47  & 0.55  &       & -0.59 & 0.89  & 0.55 \\
    2. PREVENT: Inconvenient Location & -$1.73^{*}$ & 0.74  & 0.18  &       & -$1.06^{*}$ & 0.45  & 0.35  &       & -0.67 & 0.86  & 0.51 \\
    3. PREVENT: Unable to Transport & -1.13 & 0.75  & 0.32  &       & -0.22 & 0.47  & 0.81  &       & -0.91 & 0.88  & 0.40 \\
    4. PREVENT: Unaware of Location & -$1.57^{*}$ & 0.73  & 0.21  &       & -$0.87^{*}$ & 0.46  & 0.42  &       & -0.70 & 0.86  & 0.50 \\
    1. RURAL: Yes & -0.23 & 0.19  & 0.78  &       & -$0.37^{**}$ & 0.15  & 0.69  &       & 0.14  & 0.22  & 1.16 \\
    2. AGE: 36-45 & 0.35  & 0.29  & 1.43  &       & 0.05  & 0.20  & 2.95  &       & 0.31  & 0.32  & 0.58 \\
    3. AGE: 46-55 & 0.00  & 0.25  & 0.98  &       & $0.94^{***}$  & 0.23  & 2.55  &       & -$0.94^{**}$ & 0.31  & 0.39 \\
    4. AGE: 56-65 & 0.44  & 0.28  & 1.49  &       & $1.09^{***}$  & 0.24  & 2.95  &       & -$0.65^{*}$ & 0.33  & 0.52 \\
    5. AGE: 66+ & $0.60^{*}$  & 0.34  & 1.82  &       & $1.14^{***}$  & 0.29  & 3.13  &       & -0.54 & 0.41  & 0.58 \\
    2. DISTANCE: 1-5 miles & $0.61^{**}$  & 0.23  & 1.83  &       & 0.45  & 0.28  & 1.57  &       & -$0.47^{**}$ & 0.41  & 0.62 \\
    3. DISTANCE: 6-10 miles & 0.38  & 0.25  & 1.46  &       & 0.33  & 0.27  & 1.39  &       & 0.25  & 0.40  & 1.29 \\
    4. DISTANCE: 11-20 miles & $0.02^{*}$  & 0.34  & 1.02  &       & 0.54  & 0.29  & 1.42  &       & -0.19 & 0.42  & 0.83 \\
    \bottomrule
     \midrule
\textit{***p $<$ .001, ** p $<$.01, *p$<$.05, $^\wedge$ p$<$.1} &       &       &       &       &       &       &       &       &       &       &     \\
\end{tabular}}
  \label{tab:results}%
\end{table}%
\end{landscape}
\end{document}

Some notes on the markup:

using \scalebox on a table just forces font sizes inconsistent with the rest of the document, it is better to avoid that and use \small or whateverr size is needed.

All the entries should be in math mode, using -0.65 produces a hyphen which is too small and too low for a minus sign, you need ``$ -0.65$`

^{***}$ should be ^{*{*}*}$ as otherwise the middle 8 is taken as an infix binary operator and given extra space either side.

6-10 should be 6--10 to get an n-dash rather than a hyphen for a numeric range.

2
  • Thank you!! The ^ symbol is to illustrate results that are marginally significant. Is there a way for me to keep this symbol in the table without it erroring out? Jul 11, 2017 at 14:52
  • @OpsProfessor \hat{} for example Jul 11, 2017 at 17:19
0

I would code your table with siunitx to align numbers in columns on the decimal dot, and threeparttable to manage the table notes. I recued the intercolumn space and the font size and removed the \scalebox command:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage{lscape}
\usepackage[table, svgnames]{xcolor}
\usepackage{tabularx, caption, makecell, hhline, booktabs, threeparttable}
\usepackage{siunitx}
\newcommand*\tss[1]{\,\textsuperscript{#1}}

\begin{document}

\begin{landscape}
  \begin{table}[h]\centering
    \footnotesize\setlength\tabcolsep{4pt}
    \setlength\extrarowheight{2pt}
    \sisetup{table-number-alignment=center, range-phrase=--}
    \begin{threeparttable}
      \caption{MNL Model with Grouped Disposal as DV}
      \begin{tabular}{@{}l@{}*{3}{S[table-format=-1.2, table-space-text-post=\tss{***}]S[table-format=1.2]S[table-format=2.2]}@{}}
        \cmidrule[\heavyrulewidth]{2-10} & \multicolumn{3}{c}{\textbf{Recycle vs. Trash }} & \multicolumn{3}{c}{\textbf{Recycle vs. Store }} & \multicolumn{3}{c}{\textbf{Store vs Trash }} \\
        \cmidrule(lr){2-4}\cmidrule(lr){5-7}\cmidrule(l){8-10} %
                                                        & { \makecell{I \\Coef.}} & {\makecell{II\\Std. Error}} & {\makecell{III\\Odds ratio}} & {\makecell{IV\\Coef.}} & {\makecell{V\\Std. Error}} & {\makecell{VI\\Odds ratio}} & {\makecell{VIII\\Coef.}} & {\makecell{IX\\Std. Error}} & {\makecell{X\\Odds ratio}} \\%
        \cmidrule[\lightrulewidth](l){2-10} 1. EPR: Yes & 0.44$ \tnote{*} $ & 0.21 & 1.55 & 0.06 & 0.18 & 1.06 & 0.38 & 0.24 & 1.46 \\
        1. LEGALAWARENESS: Yes & 0.07 & 0.22 & 1.07 & -0.34\tnote{*} & 0.16 & 0.71 & 0.41 & 0.25 & 1.50 \\
        1. LOCTAWARENESS: Maybe & 1.37\tnote{***} & 0.23 & 3.92 & 1.17 & 0.19 & 3.92 & 0.20 & 0.28 & 1.22 \\
        2. LOCTAWARENESS: Yes & 1.67\tnote{***} & 0.26 & 5.30 & 1.48\tnote{***} & 0.20 & 4.41 & 0.18 & 0.30 & 1.20 \\
        2. IMPORTANCE: Not very & -0.08 & 0.66 & 0.95 & -0.65 & 0.95 & 0.52 & 0.56 & 0.88 & 1.76 \\
        3. IMPORTANCE: Neutral & 1.03\tnote{$ ∧ $} & 0.58 & 2.80 & 0.25 & 0.87 & 1.28 & 0.78 & 0.82 & 2.18 \\
        4. IMPORTANCE: Somewhat Important & 1.95\tnote{**} & 0.57 & 7.06 & -0.32 & 0.84 & 0.73 & 2.28\tnote{**} & 0.80 & 9.74 \\
        5. IMPORTANCE: Very Important & 2.34\tnote{***} & 0.57 & 10.41 & 0.02 & 0.85 & 10.41 & 2.32\tnote{**} & 0.81 & 10.17 \\
        1. INFOSOURCE: General & 0.41 & 0.34 & 1.51 & 1.19\tnote{***} & 0.31 & 3.30 & -0.78\tnote{*} & 0.40 & 0.46 \\
        2. INFOSOURCE: Government & 0.76\tnote{*} & 0.36 & 2.14 & 1.08\tnote{***} & 0.30 & 2.94 & -0.32 & 0.40 & 0.73 \\
        3. INFOSOURCE: Retailer Manufacturer & 0.55 & 0.39 & 1.74 & 0.77\tnote{**} & 0.34 & 2.66 & -0.42 & 0.46 & 0.65 \\
        4. INFOSOURCE: Non Profit & 0.77\tnote{*} & 0.38 & 2.16 & 1.09\tnote{***} & 0.32 & 2.98 & -0.32 & 0.44 & 0.73 \\
        1. PREVENT: Too Expensive & -1.19 & 0.77 & 0.31 & -0.60 & 0.47 & 0.55 & -0.59 & 0.89 & 0.55 \\
        2. PREVENT: Inconvenient Location & -1.73\tnote{*} & 0.74 & 0.18 & -1.06\tnote{*} & 0.45 & 0.35 & -0.67 & 0.86 & 0.51 \\
        3. PREVENT: Unable to Transport & -1.13 & 0.75 & 0.32 & -0.22 & 0.47 & 0.81 & -0.91 & 0.88 & 0.40 \\
        4. PREVENT: Unaware of Location & -1.57\tnote{*} & 0.73 & 0.21 & -0.87\tnote{*} & 0.46 & 0.42 & -0.70 & 0.86 & 0.50 \\
        1. RURAL: Yes & -0.23 & 0.19 & 0.78 & -0.37\tnote{**} & 0.15 & 0.69 & 0.14 & 0.22 & 1.16 \\
        2. AGE: \numrange{36}{45} & 0.35 & 0.29 & 1.43 & 0.05 & 0.20 & 2.95 & 0.31 & 0.32 & 0.58 \\
        3. AGE: \numrange{46}{55} & 0.00 & 0.25 & 0.98 & 0.94\tnote{***} & 0.23 & 2.55 & -0.94\tnote{**} & 0.31 & 0.39 \\
        4. AGE: \numrange{56}{65} & 0.44 & 0.28 & 1.49 & 1.09\tnote{***} & 0.24 & 2.95 & -0.65\tnote{*} & 0.33 & 0.52 \\
        5. AGE: 66\,+ & 0.60\tnote{$ ∧ $} & 0.34 & 1.82 & 1.14\tnote{***} & 0.29 & 3.13 & -0.54 & 0.41 & 0.58 \\
        2. DISTANCE: \numrange{1}{5} miles & 0.61\tnote{**} & 0.23 & 1.83 & 0.45 & 0.28 & 1.57 & -0.47\tnote{**} & 0.41 & 0.62 \\
        3. DISTANCE: \numrange{6}{10} miles & 0.38 & 0.25 & 1.46 & 0.33 & 0.27 & 1.39 & 0.25 & 0.40 & 1.29 \\
        4. DISTANCE: \numrange{11}{20} miles & 0.02\tnote{$ ∧ $} & 0.34 & 1.02 & 0.54 & 0.29 & 1.42 & -0.19 & 0.42 & 0.83 \\
        \bottomrule
        \midrule
      \end{tabular}%}%}
      \label{tab:results}%
      \begin{tablenotes}[para]
        \item[***]$ p < .001 $,
        \item[**] $ p <.01 $,
        \item[*] $ p<.05 $,
        \item[$ ^ ∧ $] $ p<.1 $.
      \end{tablenotes}
    \end{threeparttable}
  \end{table}%
\end{landscape}

\end{document} 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .