On occasion, one has cause to compare two boxes and compute the maximum of the two widths. If the two boxes are 0 and 2, then the standard way to do that is something like
\ifdim\wd0>\wd2 \dimen0 \wd0 \else \dimen0 \wd2 \fi
Of course, this works perfectly well. But sometimes, you want something that's a little less easy to read. Thus, I propose
\dimen0 \wd\ifdim\wd0>\wd2 0 \else2 \fi
The spaces around the numbers are to keep TeX from reading more input looking for additional digits.
Note: The copyright belongs to the blog author and the blog. For the license, please see the linked original source blog.
Leave a Reply
You must be logged in to post a comment.