2

I would like to add a placeholder number in my text, to remind me that I still have to look it up, later. I usually just use something like "XYZ" or "???" for this. But when I'm using the \SI notation I get an error that "?" is not a number.

\documentclass{article} 
\usepackage{siunitx}

\begin{document}
    I don't know yet what number to place here: \SI{???}{\percent}.
\end{document}

The error I get is:

siunitx error: "invalid-token-in-number" Invalid token '?' in numerical input. For immediate help type H <return>. ...at number to place here: \SI{???}{\percent}

What is the best/suggested way to add a placeholder number or symbol in SI-notation?

  • 2
    My welcome into the site of TeX.SE. – Sebastiano Mar 28 at 22:04
5

You can pretend that ? is a valid input 'symbol' such as \pi.

\documentclass{article} 
\usepackage{siunitx}
\sisetup{
  input-symbols={?},
}

\begin{document}
    I don't know yet what number to place here: \SI{???}{\percent}.
\end{document}

"???\,%" in the output

The same works for XYZ

\documentclass{article}
\usepackage{siunitx}
\sisetup{
  input-symbols={XYZ},
}

\begin{document}
    I don't know yet what number to place here: \SI{XYZ}{\percent}.
\end{document}

Alternatively, you could stop siunitx from parsing numbers. Either globally with \sisetup{parse-numbers=false} or locally with \SI[parse-numbers=false]{???}{\percent}.

  • That works perfectly. Thanks for the quick answer! I'm curious, though. Can you explain why there is a small gap between the first and second character, when I use the 'input-symbols={?}' method? It looks something like "? ?? %" or "X YZ %". If I disable number parsing it looks as expected, like "??? %". – Vincent W. Mar 28 at 22:03
  • I have understood that the OP didn't know what to put in the place of the ??? – Sebastiano Mar 28 at 22:03
  • @VincentW. It seems that siunitx still groups the ? as if they were normal digits. In the MWE I get ?, ??, ???, ????, ??\,??? etc. pp. I do not get ?\,?? though... With parse-numbers=false that digit grouping does not happen. – moewe Mar 28 at 22:08
  • @moewe I get ?, ??, ?\,??, ?\,?\,??, ??\,?\,??. But regular 1234 when I use numbers. Strange... But also not really important. Maybe some language settings... – Vincent W. Mar 28 at 22:17
  • @VincentW. Would have been my guess as well, I didn't find anything in the docs on a quick read, though. Do you get that result with my MWE or in your larger document? – moewe Mar 28 at 22:19

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.