I'm trying to define a \newcommand
with three arguments. I'd like to:
- compare the height of these arguments
- choose the largest height to create frames (with that height) around the arguments.
Question
How can I compare these three arguments to choose the tallest?
First Update
Following the advise by David Calister, I defined a command which insert all the arguments in a box and return the height of the box, and also defined a new lenght (called MyLen
).
The following code,
\documentclass{minimal}
\usepackage{calc}
\newcommand\zz[3]{\sbox0{\ensuremath{#1#2#3}}\the\ht0}
\newlength{\MyLen}
\begin{document}
\zz{1}{2}{\frac{3}{4}}
\zz{1}{2}{3}
\end{document}
results into
Well Done so far!
Then, I'd like to set MyLen
to be such result, using
\documentclass{minimal}
\usepackage{calc}
\newcommand\zz[3]{\sbox0{\ensuremath{#1#2#3}}\the\ht0}
\newlength{\MyLen}
\begin{document}
\zz{1}{2}{\frac{3}{4}}
\zz{1}{2}{3}
\settoheight\MyLen{\zz{1}{2}{\frac{3}{4}}}
\the\MyLen
\end{document}
but the result is wrong (the last value should be equal to the first one)
What is happening? Where is my mistake?
\settoheight\MyLen{\zz{1}{2}{\frac{3}{4}}}
measures the height of the output of\zz
which is the string 8.44843pt and that has height 6.44444 same as 123 ;-)\zz
and use\settoheight\MyLen{$1 2 \frac{3}{4}$}
as\zz
and\settoheight
have essentially the same definition except one uses box 0 and one uses\@tempboxa
for measuring