2

I have a problem with the following code

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
    \operatorname{P}_{\widehat{Y}} \quad \operatorname{P}_{Y} \\
\end{align*}
\end{document}

The subscripts are different heights, meaning that the bottom of the hatted Y is lower than the bottom of the vanilla Y. I would like to have their bottoms at the same height.

My ignorant theory is that the subscripts are aligned in the middle of the character and that the hat on the Y counts as an additional horizontal space occupied by my Y.

Ideally, I would like to have a fix that enables me to define a command that incorporates the fix and leaves the vanilla behaviour of the other subscripts in my document untouched.

2
  • Welcome! If you declare an operator, you can use \adjustlimits from mathtools. See the documentation for details. (But I'm not sure if these are limits?)
    – cfr
    Commented May 31 at 2:33
  • Not related to your question, but if you only have one equation, it is better to use equation* instead of align*. Also, if you have two or more equations but without a point of alignment, use gather* instead of align*. The reason for the preference for equation and equation* is that these environments are able to adjust spacing if there is, say, a single word from the previous paragraph on one line right before it, whereas gather and align are always full width.
    – karlh
    Commented May 31 at 13:36

2 Answers 2

5

You can use \smash to remove the extra vertical spacing, like so:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
    \operatorname{P}_{\widehat{Y}} \quad \operatorname{P}_{Y} \\
    \operatorname{P}_{\smash{\widehat{Y}}} \quad \operatorname{P}_{Y}
\end{align*}
\end{document}

By the way, when posting, please post a minimal working example so we can just cut and paste without having to add preambles, packages, \begin{document}, and so forth. enter image description here

1
  • Thank you! And instructions are clear for future posts!
    – PoZa
    Commented May 31 at 10:25
4

You could use a \vphantom, which makes an object with the height of its argument, but having no width.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
    \operatorname{P}_{\widehat{Y}} \quad \operatorname{P}_{Y\vphantom{\widehat{Y}}} 
\end{align*}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .