# Mixed superscript, subscript and widehat

What is the correct way to write this equation and make both L_s matrices look the same? I tried this but the widehat and superscript L_s matrix' subscript is positioned slightly lower than the no-widehat no-superscript L_s.

\dot{\mathcal{L}} = - \lambda \mathbf{e}^\mathrm{T} \mathbf{L}_\mathbf{s} \widehat{\mathbf{L}_s^{+}} \mathbf{e}


UPDATE:

This is the code output for me. Note that the first subscript s is higher than the second.

This is more noticeable when regular font size is used:

This minimal example seem to produce correct output.

\documentclass{article}
\usepackage{mathtools}
\begin{document}
$\cramped{\mathbf{L}_\mathbf{s}} \widehat{\mathbf{L}_\mathbf{s}^{+}}$
\end{document}


But when used inside my document (thesis) it produces the output described above. I have no idea what causes this, but it's probably some other obscure configuration of the cls file I'm using (from the thesis reference model).

-

The slight difference is in the fact that TeX uses "cramped display style" when typesetting the argument to \widehat, which is characterized by reduced lowering of subscripts and raising of superscripts.

This is one of the cases where TeX needs help; here's a way:

\documentclass{article}
\usepackage{mathtools}
\begin{document}
$\cramped{\mathbf{L}_\mathbf{s}} \widehat{\mathbf{L}_\mathbf{s}^{+}}$
\end{document}


Alternatively, don't let the wide hat cover also the superscript and subscript:

\documentclass{article}
\begin{document}
$\mathbf{L}^{}_\mathbf{s} \widehat{\mathbf{L}}_\mathbf{s}^{+}$
\end{document}


Notice the empty superscript.

-
First time seeing the use of that command cramped. Could you elaborate on what it is doing, that is go a little bit deeper? –  azetina Nov 28 '12 at 16:03
The first suggestion made no changes to me. But even if I could make it work like it did for you, for text-wide consistency, I'd have to use \cramped in all other matrices in my text. Your second suggestion, with wide hat covering only the L makes them look the same, but may imply different meanings. The hat is for estimation, so estimating L and then pseudo-inverting it is different from estimating the pseudo-invert directly. –  perr0 Nov 28 '12 at 16:08
I also tried removing the wide hat and keeping only the superscript + and their indices look different too. So it might not be related to the wide hat at all, but with the use of super- and subscript together. –  perr0 Nov 28 '12 at 16:11
@perr0 Did you notice the empty superscript in the first one? –  egreg Nov 28 '12 at 16:26
@egreg I think you misplaced the empty superscript. It's actually part of the second one. Yes, it really works and I've noticed that with the empty superscript I don't even have to use \cramped. Anyway, I'd still have the text-wide consistency problem. But it definitely makes them look better, as the problem is much more apparent when both are together. So it might be a good workaround. What about the \cramped? As I see it's not really necessary here. –  perr0 Nov 28 '12 at 16:51

You could also construct superscripts/subscripts independent from one another:

\documentclass{article}
\begin{document}
$\mathbf{L}_\mathbf{s} \widehat{\rlap{\phantom{\mathbf{L}}_{\mathbf{s}}}\mathbf{L}^{+}}% Subscript then superscript \mathbf{L}^{+}% For comparison \widehat{\mathbf{L}^{+}}% For comparison$
\end{document}

-

You could try adding a phantom superscript "+" to the no superscript L:

$$\mathbf{L}_\mathbf{s}^{\phantom{+}} \widehat{\mathbf{L}_\mathbf{s}^{+}}$$

-
It makes them look the same, but for text-wide consistency, I'd have to use this phantom superscript in all other matrices in my text. I really don't want to do that. –  perr0 Nov 28 '12 at 16:09