0

I need to highlight some parts of code containing both text and numbers using the siunitxpackage but I get an invalid-token-in-number, the token being a number!

Here's my mwe:

\documentclass{article}

\usepackage{soul} % Enables highlighting
\usepackage{siunitx}

\begin{document}

    %% Error: 
    %% siunitx error: "invalid-token-in-number" and "Invalid token '6' in numerical input."
        \hl{
        Dummy text to avoid SI as very first argument of hl
        \SI{666}{\nm}
        Dummy text just in case}


\end{document}

Thanks for your help.

9
  • This is a duplicate of the question just asked: use {\SI{666}{\nm}} Commented Oct 1, 2013 at 16:47
  • Although I see this answers the question, I can't rewrite all the instances of \SI in my text when it needs to be (temporarily) highlighted. I love LaTeX but <Troll_mode> what is the use of it if one needs to deeply understand its way of doing things, just to do a simple thing as highlighting physics text.</Troll_mode>
    – Maugan
    Commented Oct 1, 2013 at 16:58
  • Also, it is not totally a duplicate since, in the other question, double braces can easily be added, since the \hl{{\textcolor{white}{Fail}}} is in fact a \newcommandwith Fail being an argument that is passed along... which cannot be done in this question.
    – Maugan
    Commented Oct 1, 2013 at 17:01
  • what \hl is doing can't remotely be described as simple:-) But you don't have to use it if you don't want you could use \colorbox to add the highlights or tikz or use Word. Commented Oct 1, 2013 at 17:02
  • 2
    In simple cases \colorbox{red}{\parbox{\textwidth}{......}} is all you need. Commented Oct 1, 2013 at 17:06

0

Browse other questions tagged .