Can someone give me a detailed starters' guide to \mathchoice
? I was trying to define commands for underscript and overscript (which I have found out to exist and be called \underset and \overset), and up till now I've been using scaled arrays (matrices) for that, i.e. compressing a column vector containing the line of text and the overscript/underscript stuff to avoid the matrix expanding and leaving space between itself and the surrounding environment, and rescaling its contents to normal size or to a smaller size for the overscript/underscript.
Problem is, as soon as the height of a "cell" of this column vector is altered, my text starts flying above the rest of the text or sinking below it. So I have to work on the scalings and it's often boring to find the exactly right scaling factors to align the text with overscript/underscript with nearby text. Working on this, I tried to define a command \lower
, and bumped into a Command \lower already defined
error. I looked \lower
up, and found out about the existence of something called \mathchoice. Problem is, what I found seems to be only troubleshooting, and to require a minimal knowledge of what \mathchoice
is, or at least of what certain lines of code (as \def\xfb#1#2{\fbox{$#1#2$}}
) do, which I don't have; or maybe what I've found (i.e. Proper use of \mathchoice) is meant to only give practical advice, i.e. to give you code that works, rather than explaining what one is doing with the recommended code.
To make an example unrelated to \mathchoice
, what I mean is what I found seems to either require the reader to know \newcommand{\norm}[1]{\left\|#1\right\|}
is defining a new command, which is invocated by \norm
, has one parameter, and places it between \left\|
and \right\|
, which are automatically resized double vertical bars, or to only give the reader the code without any intention of explaining it does that. \mathpalette
seems to be closely related to \mathchoice
, so it wouldn't be inappropriate to ask for help on both, I presume.