In the table below, if I move the units in the square brackets to the next line in the header (e.g. [mg/g] on a new line), I get an error. However, if I use curved () brackets instead, there is no error. How can I use square [] brackets without an error? Thanks
\documentclass{article}
\usepackage[abbreviations=true,per-mode=symbol]{siunitx}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{caption}
\begin{document}
\begin{table}
\caption{Specific Acid Added to Samples}
\label{Acid_Added}
\centering
\begin{tabular}{c S[table-format=2.2] S[table-format=2.2] S[table-format=1.2] }
\toprule
\thead{ID} & {\thead{Specific Acid\\ Weight [\si{\mg}]}} & {\thead{Spread\\ Weight [\si{\g}]}} & {\thead{Specific Acid\\Conc [\si{\mg\per\g}]}} \\
\midrule
1 &0.20 &19.96 &0.01\\
2 &0.40 &20.00 &0.02\\
3 &1.00 &19.98 &0.05\\
4 &2.00 &20.00 &0.10\\
5 &4.00 &20.00 &0.20\\
6 &10.00 &20.00 &0.50\\
\bottomrule
\end{tabular}
\end{table}
\end{document}


Specific Acid Weight \\ [\si{\mg}]because\\can take an optional argument in square brackets. So LaTeX reads the[\si{\mg}]as optional argument of\\and not as text for the next line. Unfortunately,\si{\mg}is not something that would make sense as this optional argument. You can add\relaxafter the\\. See also https://tex.stackexchange.com/q/34466/35864 – moewe Oct 21 '19 at 05:35