2

I'm using siunitx's S columntype to align numbers in a table. The numbers are percentage values which should all have a preceding sign (some - and some +).

The numbers with a "-" are shown with a sign, the "+" sign vanishes as siunitx processes the numbers.

How can I keep the sign of the numbers including the "+" sign?

  • 3
    \sisetup{retain-explicit-plus} (as detailed in the manual) – Joseph Wright Jul 15 '15 at 10:17
  • that doesn't work in table environment as it seems... I found another way to do that! – Knigge46 Jul 15 '15 at 10:23
8

Pluses are retained is retain-explicit-plus is set

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{S[retain-explicit-plus]}
  +1.23 \\
  -4.56 \\
   7.89 \\
\end{tabular}
\end{doument}
2

Okay, seems that I've found a solution:

I tried retain-explicit-plus as an option for \num but that doesn't do any good in tables.

What I did is fairly similar to this question:

Just omit the "+" sign for numbers that are positive (which gives them the "+" sign stated in S[explicit-sign=+]) and write a minus sign for negative numbers. This makes it work for mixed sign columns!

  • okay, Joseph Wright's solution does also work... – Knigge46 Jul 15 '15 at 10:31

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.