I would like to create commands to produce overlines (respectively wide hats or arrows) with a subscript at the end. The commands
\overline{X}^{1} \widehat{X}^{2} \overrightarrow{X}^{3}
do not suit my needs since the subscripts should be controlled by the overline (respectively wide hat, right arrow). Ideally I would like to have a command like
\myoverline_{1}{X} \mywidehat_{2}{X} \myoverrightarrow_{3}{X}
What would be the cleanest way to do so?
P.S. The closest thing I was able to find is this question.
Update Here is a picture of what I wish to obtain:
Best Answer
This approach gives the subscript to the "overline" as you seemed to indicate. With this implementation, the overline thickness is .4pt which can be changed. The bottom of the subscript is 1.5pt below the top of the argument. The 2pt setting determines the vertical location of the overbar relative to the subscript.
For the widehat, I adopt a bit of a different approach, making added use of the
scalerel
package. The parameter\hatgap
gives the vertical gap between item and hat, and\subdown
gives the relative placement of the subscript relative to the hat.The widehat EDIT is very loosely based on my solution at Really wide hat symbol, though this implementation is superior to that one.