0

I'd like to write a macro that surrounds an argument with two round parentheses which are correctly sized to the argument. Currently I'm using the following macro,

\newcommand{\inpl}[1]{{\left(\kern-.2em\left({#1} \right)\kern-.2em\right)}}

This looks fine when #1 isn't tall, but when it is there's too much whitespace between the brackets.
$\inpl{\phi,\mathbf{i}\phi}$ vs.\ $\inpl{\hat{\phi},\mathbf{i}\hat{\phi}}$
Changing the kerning amount (e.g. to -.3em) does make the larger brackets look better at the expense of making the smaller ones look too close together. I think a proper solution would be to change the amount of kerning done depending on the vertical height of #1, effectively replicating what \left does, but I don't know how to write such a macro.

Could anyone tell me how to get the vertical height of the enclosed text as a value that I can compare against, or how macros that dynamically change depending on the vertical height are usually defined?

0 Answers0