0

After using the dcolumn package in table I got this strange error of a missing } inserted. This is my code:

\usepackage{dcolumn}
\newcolumntype{L}{D{.}{.}{#1}}
\usepackage[flushleft]{threeparttable}
\usepackage{booktabs,caption}

\begin{sidewaystable}[h!]
\begin{threeparttable}
\centering
\caption{Background characteristics by gender and age group}
\label{my-label}
\begin{tabular}{l LLLLLL}
\hline
& \multicolumn{3}{l}{Female} & \multicolumn{3}{l}{Male} \\ \hline
& \multicolumn{1}{l}{Age \textless 60}    & \multicolumn{1}{l}{Age 60-65}   & \multicolumn{1}{l}{Age 65\textgreater}         &\multicolumn{1}{l} {Age \textless 60}      &\multicolumn{1}{l}{Age 60-65}       & \multicolumn{1}{l}{Age 65\textgreater}     \\\hline
\textbf{General}\\                                                
Age of respondent (avg) &    57.1   &    62.10 &      75.90 &  57.12   &   62.12    &  74.69\\
Age of Spouse (avg)    & 6.47   & 65.74   & 75.6  & 4.24  & 59.15  & 70.05  \\ 
                                                               \hline

\end{tabular}
\end{threeparttable}
\end{sidewaystable}

After running this code I got the error at the line of Age:.

Missing } inserted.
<inserted text> 
                }

Someone there who knows what the problem is?

Frank
  • 1

1 Answers1

3

Please always post complete examples not fragments.

The error is reported at the point you define L not the error that you give in the title.

! Illegal parameter number in definition of \NC@rewrite@L.
<to be read again> 
                   1
l.3 \newcolumntype{L}{D{.}{.}{#1}}

you have not defined L to take an argument so #1 is not allowed here.

Use for example

\newcolumntype{L}{D{.}{.}{-1}}
David Carlisle
  • 757,742