Martin F Krafft <[EMAIL PROTECTED]> writes: MFK> how can you {add,multiply,negate,divide} two scalars in TeX/LaTeX? MFK> MFK> in a new command that i am writing (it places a \picture), i want to MFK> use one of the two arguments (width) and \linewidth or \textwidth to MFK> calculate the remaining horizontal space i have (for another picture). MFK> MFK> i know i can convert a #1 argument of a command into a \length with MFK> \newlength\setlength, but how can i mathematically combine multiple MFK> \lengths? i know it's possible, though maybe not on the LaTeX level.
(Looks through TeXbook) It looks like you can only do this if one of the things is a named length. But in that case you can do things like: % Make \mylen be the width of the page less 5ex. \setlength\mylen\textwidth \addtolength\mylen{-5ex} % Or, equivalently, \advance\mylen by -5ex % Make \mylen be 15ex. \setlength\mylen{5ex} \multiply\mylen by 3 % Doesn't look like there's a LaTeX equivalent for this one. You also want to be slightly careful when dealing with lengths. For example: \newcommand{\spacetext}[2]{\hskip#1#2} will do the wrong thing if you try to do, say, \spacetext{10ex}{plus 3ex foo bar bax quux}, since TeX will read "10ex plus 3ex" as stretchable length; you should put a \relax in between #1 and #2 in this case for safety. -- David Maze [EMAIL PROTECTED] http://people.debian.org/~dmaze/ "Theoretical politics is interesting. Politicking should be illegal." -- Abra Mitchell