1
\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\begin{document}

$P=\hat{U\cdot}\hat{I}\cdot \frac{1}{2} \cos\varphi$

\end{document}

I just looked at the hats enlarged on my top values. I am not satisfied with the alignment over the U. I think the example in the previous article \hat over italic letters is not centered horizontally is not that serious.

The a with that hat still works for me. In my example the hat on the U is clearly out of focus. The solutions already presented do not work for me and it is also not an issue to use a different font because the appearance has to be consistent. The previous answers also do not really address the technical cause of this problem. That is why I am submitting the question again here. The equation was originally generated with LyX.

enter image description here

3
  • 2
    Why do you want the hat over the pair U\cdot?
    – Bernard
    Commented Jan 30, 2021 at 20:43
  • 3
    the accent is centred over U<cdot> not U as that is what you have specified in the argument. Commented Jan 30, 2021 at 20:47
  • 3
    Did you try \hat{U}\cdot\hat{I}\cdot\cos\varphi? Or, possibly better, with no \cdot.
    – egreg
    Commented Jan 30, 2021 at 20:51

1 Answer 1

2

(posting this note so that the question may be considered to have received an "official" answer)

As others have already commented on, don't include \cdot in the argument of \hat. Separately, do consider getting rid of the \cdot directives entirely; trust me, they won't be missed.

In the following screenshot, the \cdot directives are gone from lines 4 and 5; they differ in the presence or absence of a \ "thinspace" spacer between \hat{U} and \hat{I}. In row 4, I added parentheses to help readers "parse" the full expression; in row 5, I moved the term \tfrac{1}{2} to the front as there's no good reason -- typographically speaking -- to stick it somewhere in the middle of the formula. Which solution is "better" is largely a matter of taste; some might prefer the tight look in row 5, while others might find it a bit too cramped. What really matters, in the end, is that you develop a consistent math writing style. If you do that, your readers will quickly adapt their reading approach to what you've written for them.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for 'alignat*' environment and '\text' macro
\begin{document}
\begin{alignat*}{2}
    P&=\hat{U\cdot}\hat{I}\cdot\tfrac{1}{2}\cos\varphi &\qquad&\text{bad}\\
     &=\hat{U}\cdot\hat{I}\cdot\tfrac{1}{2}\cos\varphi &&\text{ok}\\
     &=\hat{U}\,\hat{I}\cdot\tfrac{1}{2}\cos\varphi    &&\text{better}\\
     &=\hat{U}\,\hat{I}(\tfrac{1}{2}\cos\varphi)       &&\text{even better?}\\     
     &=\tfrac{1}{2}\hat{U}\hat{I}\cos\varphi    &&\text{too cramped?} % no '\,' spacer
\end{alignat*}
\end{document}
7
  • 2
    Yes, the wrong bracketing was the mistake. I use Lyx's math editor. I didn't notice this problem there. I know that I can display the source code window in Lyx and I have activated this setting. Unfortunately, I didn't think of this kind of bug and didn't look closely at the source code. I thank all supporters.
    – Michael.H
    Commented Jan 31, 2021 at 7:47
  • 1
    I believe you and I deleted all unnecessary \cdot s in my document.
    – Michael.H
    Commented Jan 31, 2021 at 7:58
  • @Michael.H - I'm not a lyx user myself, and you didn't set the lyx tag when you posted your query, so I had no inkling as to why -- or, as the case may be here, lyx -- would write \hat{U\cdot}. Glad it's all got sorted out. :-)
    – Mico
    Commented Jan 31, 2021 at 8:20
  • 1
    I didn't know anything about the tag lyx so far. I've added the tag now. Perhaps you could update your Answer with my first missing factor 1/2 in front of cos. See my updated question. The error in LyX happened to me because I carelessly marked the area with the mouse over which the hat should be.
    – Michael.H
    Commented Jan 31, 2021 at 10:36
  • 1
    Also \hat{U}\hat{I}\cdot\tfrac{1}{2}\cos\varphi if one needs to make a derivation clearer. I'd not use the parentheses around the expression.
    – egreg
    Commented Jan 31, 2021 at 10:54

You must log in to answer this question.

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