0

This question already has an answer here:

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.

marked as duplicate by David Carlisle, Qrrbrbirlbel, cmhughes, jub0bs, Benedikt Bauer Oct 1 '13 at 17:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • This is a duplicate of the question just asked: use {\SI{666}{\nm}} – David Carlisle Oct 1 '13 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 Oct 1 '13 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 Oct 1 '13 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. – David Carlisle Oct 1 '13 at 17:02
  • 2
    In simple cases \colorbox{red}{\parbox{\textwidth}{......}} is all you need. – David Carlisle Oct 1 '13 at 17:06

Browse other questions tagged or ask your own question.