[Tex/LaTex] Missing \endgroup inserted. \endgroup \end{tabular}} when using \scalebox

scaleboxtables

I have to reduce a table by using \scalebox. But When trying to compile, it's throwing me the following error message "Missing \endgroup inserted. \endgroup \end{tabular}}" on the ninety line of the code showed below.
I have closed the curly brackets but the error message is always there.
I need your help.

\documentclass[a4paper, 12]{article}
\usepackage{inputenc}
\usepackage{natbib}
\usepackage{adjustbox}
\usepackage{gensymb}
\usepackage{amssymb}
\usepackage{color}
\usepackage{booktabs}
\usepackage[flushleft]{threeparttable}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{array}
\renewcommand{\arraystretch}{1.3}
\usepackage[
paper=a4paper,
tmargin=2.5cm,
bmargin=2.5cm,
lmargin=2cm,
rmargin=2cm]{geometry}
\title{Study of weatherability}
\begin {document}
\maketitle
\begin{table}[h!]
\centering
\begin{threeparttable}
\caption{MTE composition.}
\scalebox{0.7}{
\begin{tabular}{c c c c c c c c c c c c c c c}
\toprule
\bf Elements&\multicolumn{3}{c}{A}&&\multicolumn{3}{c}{B}&&\multicolumn{3}{c}{C}&&Average&Limit value\\
\cmidrule{2-4} \cmidrule{6-8} \cmidrule{10-12} 
&Bulk&a&b&&Bulk&c&d&&Bulk&e&f&&& \textcolor{blue}{\citep{CCME_2018-1}}\\
\midrule
\bf Ba&&&&&&&&&&&&&&$750$\\
\bf Sr&$76664.67$&$69559.45^{\ast}$&$82517.09$&&$85085.05$&$76142.72$&$(90774.17)$&&$79018.35$&$70409.9$&$81375.31$&&$79057.08$\\
\bf Zn&$15287.57^{\ast}$&$16898.6$&$18599.23$&&$22164.76$&$20137.04$&$(29603.27$)&&$22072.44$&$21833.37$&$28277.09$&&$21652.6$&$250$\\
\bf Mn&$3385.67$&$3021.89$&$3098.31$&&$(4084.6)$&$3286.02$&$3906.73$&&$3453.22$&$2782.65^{\ast}$&$3283.29$&&$3386.93$\\
\bf Pb&$2795.84$&$1756.59^{\ast}$&$3131.18$&&$4766.84$&$3598.6$&$(4786.26)$&&$4421.35$&$3283.21$&$4132.84$&&$3630.30$&$70$\\
\bf Cd&$107.88^{\ast}$&$128.23$&$121.71$&&$147.38$&$135.35$&$(180.53)$&&$121.35$&$112.22$&$139.39$&&$132.67$&$1.4$\\
\bf Cr&$9882.88$&$8081.73^{\ast}$&$10681.22$&&$10110.72$&$8415.07$&$(11126.82)$&&$8837.55$&$8203.76$&$9235.53$&&$9397.25$&$64$\\
\bf Ag&$100.23$&$85.42$&$103.54$&&$(108.94)$&$106.10$&$97.81$&&$108.92$&$84.11^{\ast}$&$107.38$&&$100.27$&$20$\\
\bf As&$166.58^{\ast}$&$175.83$&$253.32$&&$(288.43)$&$211.62$&$241.7$&&$<LOD$&$220.2$&$<LOD$&&$222.53$&$12$\\
\bf Sb&$425.51$&$396.44^{\ast}$&$477.52$&&$(593.62)$&$454.35$&$562.12$&&$567.44$&$446.54$&$481.43$&&$489.44$&$40$\\
\bf Cu&$171.27$&$195.27$&$216.76$&&$162.51$&$167.19$&$(271.34)$&&$223.93$&$135.93^{\ast}$&$215.1$&&$195.47$&$20$\\
\bf Sn&$560.88^{\ast}$&$588.58$&$647.16$&&$738.89$&$591.3$&$(833.37)$&&$730.51$&$601.86$&$689.96$&&$664.77$&$5$\\
\bf Hg&$<LOD$&$42.28$&$<LOD$&&$(68.25)$&$41.8$&$<LOD$&&$46.39$&$39.27$&$<LOD$&&$47.6$&$6.6$\\
\bottomrule
\end{tabular}}
\vspace{0.1ex}
\begin{tablenotes}
\small
 \item 
() : Maximum value; $^{\ast}$ : Minimum value.
\end{tablenotes}
\end{threeparttable}
\end{table} 
\end{document}

Best Answer

scaling of tables should usually be avoided, but in threeparttab;e it interferes with the measuring that that environment does. It is almost always better to use a named font size so sizes are consistent in the document, \small seems OK here.

\documentclass[a4paper, 12]{article}
\usepackage{inputenc}
\usepackage{natbib}
\usepackage{adjustbox}
\usepackage{gensymb}
\usepackage{amssymb}
\usepackage{color}
\usepackage{booktabs}
\usepackage[flushleft]{threeparttable}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{array}
\renewcommand{\arraystretch}{1.3}
\usepackage[
paper=a4paper,
tmargin=2.5cm,
bmargin=2.5cm,
lmargin=2cm,
rmargin=2cm]{geometry}
\title{Study of weatherability}
\begin {document}
\maketitle
\begin{table}[h!]
\centering
\begin{threeparttable}
\caption{MTE composition.}
\small
\setlength\tabcolsep{1pt}
\begin{tabular}{@{}c c c c c c c c c c c c c c c@{}}
\toprule
\bfseries Elements&\multicolumn{3}{c}{A}&&\multicolumn{3}{c}{B}&&\multicolumn{3}{c}{C}&&Average&Limit value\\
\cmidrule{2-4} \cmidrule{6-8} \cmidrule{10-12} 
&Bulk&a&b&&Bulk&c&d&&Bulk&e&f&&& \textcolor{blue}{\citep{CCME_2018-1}}\\
\midrule
\bfseries Ba&&&&&&&&&&&&&&$750$\\
\bfseries Sr&$76664.67$&$69559.45^{\ast}$&$82517.09$&&$85085.05$&$76142.72$&$(90774.17)$&&$79018.35$&$70409.9$&$81375.31$&&$79057.08$\\
\bfseries Zn&$15287.57^{\ast}$&$16898.6$&$18599.23$&&$22164.76$&$20137.04$&$(29603.27$)&&$22072.44$&$21833.37$&$28277.09$&&$21652.6$&$250$\\
\bfseries Mn&$3385.67$&$3021.89$&$3098.31$&&$(4084.6)$&$3286.02$&$3906.73$&&$3453.22$&$2782.65^{\ast}$&$3283.29$&&$3386.93$\\
\bfseries Pb&$2795.84$&$1756.59^{\ast}$&$3131.18$&&$4766.84$&$3598.6$&$(4786.26)$&&$4421.35$&$3283.21$&$4132.84$&&$3630.30$&$70$\\
\bfseries Cd&$107.88^{\ast}$&$128.23$&$121.71$&&$147.38$&$135.35$&$(180.53)$&&$121.35$&$112.22$&$139.39$&&$132.67$&$1.4$\\
\bfseries Cr&$9882.88$&$8081.73^{\ast}$&$10681.22$&&$10110.72$&$8415.07$&$(11126.82)$&&$8837.55$&$8203.76$&$9235.53$&&$9397.25$&$64$\\
\bfseries Ag&$100.23$&$85.42$&$103.54$&&$(108.94)$&$106.10$&$97.81$&&$108.92$&$84.11^{\ast}$&$107.38$&&$100.27$&$20$\\
\bfseries As&$166.58^{\ast}$&$175.83$&$253.32$&&$(288.43)$&$211.62$&$241.7$&&$<LOD$&$220.2$&$<LOD$&&$222.53$&$12$\\
\bfseries Sb&$425.51$&$396.44^{\ast}$&$477.52$&&$(593.62)$&$454.35$&$562.12$&&$567.44$&$446.54$&$481.43$&&$489.44$&$40$\\
\bfseries Cu&$171.27$&$195.27$&$216.76$&&$162.51$&$167.19$&$(271.34)$&&$223.93$&$135.93^{\ast}$&$215.1$&&$195.47$&$20$\\
\bfseries Sn&$560.88^{\ast}$&$588.58$&$647.16$&&$738.89$&$591.3$&$(833.37)$&&$730.51$&$601.86$&$689.96$&&$664.77$&$5$\\
\bfseries Hg&$<LOD$&$42.28$&$<LOD$&&$(68.25)$&$41.8$&$<LOD$&&$46.39$&$39.27$&$<LOD$&&$47.6$&$6.6$\\
\bottomrule
\end{tabular}
\vspace{0.1ex}
\begin{tablenotes}
\small
 \item 
() : Maximum value; $^{\ast}$ : Minimum value.
\end{tablenotes}
\end{threeparttable}
\end{table} 
\end{document}