In LaTeX2e,how can I sum two values and assign them to other variable?
I want to compute something like:
var=\textwidth - 1cm
And if both were constants:
var=1+1
calculationsdimension-expressions
In LaTeX2e,how can I sum two values and assign them to other variable?
I want to compute something like:
var=\textwidth - 1cm
And if both were constants:
var=1+1
Best Answer
In regular LaTeX, the
calc
package allows for easy manipulation of length arithmetic:The above deals with lengths. For basic arithmetic using numbers, the
fp
package. Here is an example using infix notation (Reverse Polish Notation/RPN is also possible via\FPupn
):