I don't see this as a unary operator but more of a typesetting property of negative numerical values. Or as @tohecz pointed out in his comment to another answer:
the unary minus is a "part of the numeral"
In other words, the symbols "-" in "-3" and "-x" are unrelated typographically.
In light of this, I propose this solution. Which is very elegant if you get to the habit of using \num
(from siunitx
package) around all your numerical literals:
\documentclass{article}
\usepackage{siunitx}
\sisetup{bracket-negative-numbers, open-bracket={
{}^-% your custom hack here
}, close-bracket={}}
\begin{document}
\noindent
\num{-1}\\
\num{1}\\
\num{-1e3}\\
\num{1e-3}\\
$\num{-3} - \num{4}$\\
$[\num{1}\,\num{-1}\,\num{1}]
\end{document}

Note: I don't particularly advocate for using {}^-
, this seems quite extreme. It is just an example to show the difference and I didn't want to clutter the answer with more code. What I advocate is the use of siunitx
for fine control over typesetting of numbers.
Besides I wanted to have a code that works also for superscripts (for the exponent) (using hard code raisebox
produces weird effects on exponents or small fractions). If know of a short code that can do this elegantly please edit this answer.
-
as both a unary and a binary operator.