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
|
In LaTeX2e,how can I sum two values and assign them to other variable? I want to compute something like:
And if both were constants:
|
||||
| show 3 more comments |
|
In regular LaTeX, the
The above deals with lengths. For basic arithmetic using numbers, the
|
||||
|
In classical Knuth TeX,
eTeX,
LaTeX with
LaTeX2e with
|
|||
|
|
|
Since LuaTeX is available, forget all that complicated stuff and do something like:
|
|||
|
|
|
In LaTeX, if you just want to subtract one known length (say,
|
|||||
|
|
With a fairly recent TeX distribution
It's not quite clear what's the framework you're interested in, though. |
|||
|
|
|
This is a bit overkill for the particular examples that you mention, but since this works for more complicated expressions I tend to use it:
Note that with If you want to minimize what gets loaded and still use |
||||
|
|
\textwidthis also constant. Or do you mean number vs. dimension? – Marco Daniel Sep 30 '11 at 17:05plain-textogether withlatex3? – Leo Liu Sep 30 '11 at 17:08latex3tag if you are not using it. – Leo Liu Sep 30 '11 at 17:27