Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

At the moment my report print currency values with siunitx with \$\numprint{12} But negative values displayed as $-12.00

I would like to display it as:

-$12.00

Or you think $-12.00 is ok too for US ?

share|improve this question
    
Welcome to TeX.SE! How is the macro \numprint defined? (It doesn't seem to be a macro that's set up by the siunitx package.) On the ways of displaying negative amounts of money: There are a quite a few conventions out there, and they depend in part on the currency ($, £, or some other currency unit) in use. The $-12.00 look is reminiscent of how some spreadsheets are set up for calculations with currencies. However, I do not think it's a common way of displaying negative amounts of dollars in running text. I honestly don't know if it's a common display form for other currency units. –  Mico Apr 21 at 4:59

1 Answer 1

If you're going to use a negative sign with dollars, I would definitely put the negative sign before the dollar sign.

Here's a MWE which takes advantage of the fact that siunitx uses expl3 syntax:

\documentclass{article}
\usepackage{siunitx}

\ExplSyntaxOn
\def\aecompareTF#1#2#3{\fp_compare:nTF{#1}{#2}{#3}}
\def\aeabs#1{\fp_abs:n{#1}}
\ExplSyntaxOff

\sisetup{%%
  group-separator={,},
  round-precision=2,
  round-mode=places,
  round-integer-to-decimal}

\def\mydollars#1{%%
  \aecompareTF{#1<0}
    {\SI{\aeabs{#1}}[-\$]{}}
    {\SI{#1}[\$]{}}}

\pagestyle{empty}
\begin{document}

  \mydollars{12350.30}

  \mydollars{-12350.30}

 The effect of \verb`round-integer-to-decimal`: 

 \mydollars{3}

\end{document}

enter image description here

share|improve this answer
    
Dear Mr. Ellett, Thank you very much for your fast reply. I'm using latex to generate PDF and it reports an error: ( FP-ROUND ) ( FP-MUL ) ( FP-ROUND ) ( FP-DIV ) ! Argument of \fp_compare_aux_v:w has an extra }. Is it possible to make changes for latex ? I tried to search myself, but there is very few information about fp_compare. –  Sergio Apr 22 at 8:40
    
@Sergio My first thought is that perhaps you need to update to the most current version of LaTeX. If the problem persists after updating, you might want to post a new question. –  A.Ellett Apr 22 at 12:26
    
@sergio You can find information about the expl3 code I've used by running texdoc interface3. –  A.Ellett Apr 22 at 12:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.