I need to redefine the \percent unit in siunitx so that it reads "percent" in running text but remains as "%" in tables and equations. I assume there must be an option for this, but I looked into the package documentation and couldn't find any.

  • Hmmm... I am not sure that it is possible to say if you are in a table or not. So maybe math mode - no math mode is possible, but the other one is difficult.
    – Rmano
    May 25, 2020 at 16:59
  • I once defined a \light command as \newcommand{\light}[1][per-mode = symbol-or-fraction]{\SI[#1]{299792458}{\meter\per\second}}, which chooses whether to write the m/s units as an inline or a displayed fraction according to context, and I thought something similar might be possible here.
    – nemarona
    May 25, 2020 at 17:20
  • That command is simply a command with an optional argument and a default... so that \light use the indicated per-mode by default, and you can override it. No automatic switching.
    – Rmano
    May 25, 2020 at 17:34

1 Answer 1


I do not know if there is a method to decide if you are in a table or not. What does exist is a way to check if your are in math mode or not; you can do something like this:




This is in text: 12~\autopercent; and you have to use \verb|{}| after the 
command as in 5~\autopercent{} if you have a space after. In equation:
A = 14\autopercent


enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .