# siunitx: bold single numeric cells + mathspec

I need to bold and align numeric values in a table while using both mathspec and siunitx packages. I've looked at siunitx: Bold single numeric cells for bold and alignment in a tabular environment with the siunitx package, however this breaks when specifying \setallmainfonts(Digits){Helvetica} with the mathspec package.

The MWE below shows proper numeric fonts in the displayed math (from the "Digits" specification), the 3.060 is properly aligned, the decimal is properly bold, but the digits are not bold. If the \setallmainfonts(Digits){Helvetica} is commented, then the table data is correctly bold and aligned, but then the display math digits revert to CM. Does anyone know how to reconcile these two?

\documentclass{article}
\usepackage{etoolbox}
\usepackage{siunitx}
\usepackage{booktabs}

\usepackage{mathspec}
\setallmainfonts(Latin,Greek)[Ligatures=TeX]{Helvetica}
\setallmainfonts(Digits){Helvetica}

\robustify\bfseries

\begin{document}

\begin{table}
\begin{tabular}{S[table-format=3.3,detect-weight]}
\toprule
{Header 35} \\
\midrule
\bfseries 3.060\\
100.59\\
0.64\\
0.52\\
\bottomrule
\end{tabular}
\end{table}

This is the number 2.
$\int_{-\infty}^{\infty} 2 x^{2}_{i} dx$

\end{document}

• Do you have "Helvetica Bold" installed? – karlkoeller Aug 24 '13 at 7:13
• Yes, I have Helvetica Bold installed. However, the problem is not unique to this font. – mrclary Aug 25 '13 at 2:45

## 1 Answer

I found the solution to my problem, though I think that there may be a bug in the way siunitx interacts with mathspec. It turns out that both the detect-weight and detect-mode options are required to induce the correct behavior -- bold and aligned -- whereas the detect-weight option alone does not.

I discovered the same behavior with italics (don't forget to \robustify\it), though the detect-shape option is required here, as opposed to detect-weight. The detect-all option also works, as one might expect, since this is merely a convenience option that sets detect-weight, detect-family, detect-shape, and detect-mode to true.

Below is a MWE and its output. The output shows the following:

• Proper font throughout, including digits in math mode
• Proper font weight and shape in the table
• Proper alignment of the numbers in the table

Note that I specified table-format=5.4 in order to ensure that proper alignment was not just coincident with a left or right aligned number.

I am not sure why the detect-mode option is required when using mathspec.

\documentclass{article}

\usepackage{etoolbox, siunitx, booktabs, mathspec}
\setallmainfonts(Digits,Latin,Greek)[Ligatures=TeX]{Helvetica}

\robustify\bfseries
\robustify\itshape

\begin{document}

\begin{table}
\begin{tabular}{S[table-format=5.4, detect-weight, detect-shape, detect-mode]}
\toprule
{Header 35}\\
\midrule
\bfseries 3.060\\
\itshape 100.59\\
0.64\\
0.52\\
\bottomrule
\end{tabular}
\end{table}

This is the number 2.
$\int_{-\infty}^{\infty} 2 x^{2}_{i} dx$

\end{document}


• Rather than \robustify\it don't use \it, which has been deprecated for more than fifteen years. Use \itshape. – egreg Aug 27 '13 at 19:52