10

I get error when I use the \percent macro in the siunitx package. Here is the code :

              \documentclass[]{beamer}
              \usetheme{CambridgeUS}
              \usepackage{siunitx}
              \setbeamercolor{title}{bg=red!65!black,fg=white}
              \begin{document}
              \title{Risk Management in Software Engineering}
              \author{S.Subham Soni}
              \institute[P.E.C]{Department of Computer Science and Engineering\\
 Pondicherry Engineering College}
              \date{January 6, 2014}     
              \begin{frame}
              \begin{tabular}{|r|r|}
              \hline
              \textbf{Risk}&\textbf{Percentage} \\
              \hline
               Very Low&$\textless10\%$ \\
               \hline
               Low&10\percent-25\percent \\
               \hline
             \end{tabular}
             \end{frame}
             \end{doccument}

Here the \percent is throwing the error as symbol not found. The code is a part of the full code so there might be some continuation gap....

2 Answers 2

20

You should use it like \si{\percent} (or \SI{10}{\percent})

          \documentclass[]{beamer}
          \usetheme{CambridgeUS}
          \usepackage{siunitx}
          \setbeamercolor{title}{bg=red!65!black,fg=white}
          \begin{document}
          \title{Risk Management in Software Engineering}
          \author{S.Subham Soni}
          \institute[P.E.C]{Department of Computer Science and Engineering\\
             Pondicherry Engineering College}
          \date{January 6, 2014}
          \begin{frame}
          \begin{tabular}{|r|r|}
          \hline
          \textbf{Risk}&\textbf{Percentage} \\
          \hline
           Very Low&$<\SI{10}{\percent}$ \\
           \hline
           Low& 10\si{\percent}--25\si{\percent} \\
           \hline
         \end{tabular}
         \end{frame}
         \end{document}

There was a typo in end{document}. Further, if you intend to put a range like 10-25%, better use \SIrange[range-phrase = --]{10}{25}{\percent}. And don't use \textless in math mode, use < instead.

3
  • Why should you use \percent at all? Is there any advantage of $\SI{12.3}{\percent}$ over $12.3\%$? Oct 14, 2014 at 15:45
  • 4
    @moose The spacing between the number and symbol. siunitx is good in keeping that correct space. See Joseph's answer about spacing below.
    – user11232
    Oct 14, 2014 at 16:07
  • Please note that ISO 80000-1 says you should use 10 % - 25 % as @user11232 and @Mico suggested with the \SIrange command.
    – skvery
    Aug 4, 2021 at 15:55
4

Harish has given what I would say is the 'standard position' answer: using the \si/\SI commands is by far the best way to use siunitx. However, you can use 'free standing' units, for example:

\documentclass{article}
\usepackage[free-standing-units, space-before-unit, use-xspace]{siunitx}
\begin{document}
\SI{10}{\percent} or perhaps 10\percent water.
\end{document}

Getting spacing correct in this case can be tricky: I would strongly recommend using Harish's approach if possible.

You must log in to answer this question.

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