1
\documentclass{article}
\usepackage{unicode-math}
\setmainfont{Times New Roman}
\setmathfont{STIX Two Math}
\usepackage{tikz}
\usepackage[reset-math-version = false]{siunitx}
    
\begin{document}

\tikz \node[draw=red, ultra thick, font=\bfseries, text width=4cm, text centered] (a) {Some 
text\\ size is $\qty{5}{\milli\meter} \times \qty{5}{\milli\meter}$};

\end{document}

How to make qty print number and unit in bold as surrounding text? I also tried {\boldmath $...$}, doesn't work.

Thank you.

EDIT

With suggestion from Joseph Wright's answer I get:

\documentclass{standalone}
\usepackage{unicode-math}
\setmainfont{Times New Roman}
\setmathfont{STIX Two Math}
\usepackage{tikz}
\usepackage[text-series-to-math]{siunitx}

\begin{document}
    
\tikz \node[draw=red, ultra thick, font=\bfseries, text width=4cm, text 
centered] (a) {Some text\\ size is $\qty{5}{\milli\meter} \times \qty{5} 
{\milli\meter}$\\ 5\,mm and $\mathbf{5}\,\text{mm}$};
    
\end{document}

enter image description here

I can only get all in bold by hand, as in the last row. Probably I don't understand the suggestion of text-series-to-math.

1
  • Your font choice here means the 5 doesn't look all that bold even though it is :)
    – Joseph Wright
    Aug 27, 2021 at 7:09

2 Answers 2

1

Try this:

\documentclass{article}
\usepackage{unicode-math}
\setmainfont{Times New Roman}
%\setmathfont{STIX Two Math}    % I haven't this font
\usepackage{tikz}
\usepackage{siunitx}

\begin{document}

\tikz   \sisetup{detect-weight, mode=text} 
        \node[draw=red, ultra thick, font=\bfseries, text width=4cm, align=center] (a) 
                {Some text\\ size is \qtyproduct{5x10}{\milli\metre}};

\end{document}

enter image description here

Note: I'm still not familiar with siunitx syntax introduced by version 3.0, so there may be more appropriate option as are used in above MWE.

1

You are sending bold from text to math mode: you want text-series-to-math. In contrast, reset-math-version = false is about 'carrying forward' for example sansmath.


Your edit suggests you want siunitx to print in text mode. For that, you set mode = text, then also apply reset-text-series = false so the series (bold, etc.) carries through.


In general, siunitx starts off using math mode, and unless you request it doesn't print in text mode. When you request text mode printing, it does it's best to make sure all symbols are 'safe', so for example replacing \times by \texttimes.

3
  • I edited question with your suggested option, still doesn't work for me :(.
    – Alx
    Aug 27, 2021 at 7:53
  • @Alx You are getting bold math mode, but it sounds like you actually want to print in text mode: I've edited my answer to reflect that
    – Joseph Wright
    Aug 27, 2021 at 8:12
  • yes now it works, thanks! But could you elaborate a bit about the difference between math and text modes in siunitx, for newbie like me. I'm honestly confused what I need: I thought, if I have times sign it should be printed via math mode. When one should use one or the other mode, and why there is so difficult to get bold in math mode?
    – Alx
    Aug 27, 2021 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.