So, I have a variable called number which I define like so:
\def\number{0.25}
I'd like to automatically define a number which will give me 1-number (in this case, which would give me 0.75). I tried doing this:
\def\othernumber{1-\number}
However, this didn't seem to work. It seems like the engine doesn't realize that I want to subtract \number from 1. Could anyone help me fix this syntax? Thanks :)


\def\number{0.25}is a very bad thing to do:\numberis a TeX primitive. Can you tell something more about the usage of these macros? – egreg May 26 '17 at 20:34\spanvalueinstead. Also, hello! – Skeleton Bow May 26 '17 at 20:36\def\spanvalue{0.25}, you should not read it as “\spanvalueis now equal to the number 0.25”. This is not what happens;\defis meant for text substitution, and what happens is that TeX simply records the replacement text for the macro\spanvalueas being the sequence of tokens0,.,2and5. TeX does have some rudimentary support for arithmetic, but\def(or even\newcommandin LaTeX) is not it. And the support from packages likexfpandpgf(as in the answers) is much greater. – ShreevatsaR May 26 '17 at 22:00