I am the author of the question: Problem with a table with special header: bolded numbers are badly aligned with the rest of the numbers
Following Zarko's advice, I have revised my code according to his suggestion to get my bolded number aligned in the right way. However, a new problem is popping up. I am making another post because I can't share the updated version of my code in my previous post. The previous post does not address the new problem I am facing.
I am trying to make a table with special header.
I tried the following code:
\documentclass[11pt,a4paper]{article}
\usepackage[hyperref]{NAACL2019}
\usepackage[skip=1ex,font=small]{caption}
\usepackage{times}
\usepackage{url}
\usepackage{latexsym}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{sectsty}
\usepackage{amssymb}
\usepackage{makecell}
\usepackage{multirow}
\usepackage{amsmath,epsfig,times}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{etoolbox}
\usepackage{subcaption}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{siunitx} % <---
\usepackage{etoolbox} % <---
\newrobustcmd\B{\DeclareFontSeriesDefault[rm]{bf}{b}\bfseries} % <===
\usepackage{hyperref} % load this package last
\begin{table}[ht]
\sisetup{detect-weight, mode=text, table-format=1.4}
\centering
\begin{tabular}{l SS
S[table-format=-1.2]
S[table-format=1.2] }
\toprule
& \multicolumn{2}{c}{M1}
& \multicolumn{2}{c}{M2} \
\cmidrule(lr){2-3} \cmidrule(l){4-5}
& {1-2} & {7-8} & {1-2} & {7-8} \
\midrule
A & \B{0.0021} & \B{0.0033} & -2.37 & 0.00 \
B & \B{0.0052} & \B{0.0042} & -1.23 & 0.67 \
C & 0.0960 & \B{0.0054} & -0.62 & 1.10 \
D & \B{0.0082} & \B{0.0057} & -0.21 & 1.08 \
E & 0.0107 & 0.0097 & 0.74 & 1.41 \
F & \B{0.0080} & 0.0088 & 5.05 & 5.05 \
G & 0.0140 & 0.0148 & -2.37 & 0.00 \
H & 0.0128 & 0.0176 & -1.23 & 0.67 \
I & 0.0157 & 0.0164 & -0.62 & 1.10 \
J & 0.0145 & 0.0155 & -0.21 & 1.08 \
K & 0.0205 & 0.0209 & 0.74 & 1.41 \
L & 0.0236 & 0.0225 & 5.05 & 5.05 \
\bottomrule
\end{tabular}%}
\smallskip
\caption{My Caption}
\label{tab:table1}
\end{table}
But it gives the following results:
More specifically, I am getting the following errors:
undefined control sequencefor the rows A, B, C, and D- and
overfull warningfor the entire table.
Also, the NAACL template that I am using can be found at: https://www.overleaf.com/latex/templates/instructions-for-naacl-hlt-2019-proceedings/xyyfwfkswhth
How can I resolve this issue?


! Undefined control sequence. \B ->\DeclareFontSeriesDefault [rm]{bf}{b}\bfseries– David Carlisle Oct 24 '20 at 14:18\DeclarFontSeriesDefaultonly applicable to LuaLaTeX and such? I am using overleafPDFLaTeX– chico0913 Oct 24 '20 at 14:20&\B{<some number>} & ...but only&\B <number> & .... Test of your MWE with repairing this errors and add missed \begin{document} and end{document} works fine! – Zarko Oct 24 '20 at 14:55