0

Using \hat on Greek letters in the equation environment results in a blank space.

The code I'm using is:

\begin{equation}
\begin{aligned}
\hat{\rho}_{non lin} = \frac{1}{2} \mathbf{ \hat{P}\cdot\hat{E} } = \frac{1}{2} \hat{P}_i\hat{E}_i
\approx \frac{1}{2} \epsilon_0 \chi_{ijk}^{(2)} \hat{E}_{i} \hat{E}_{j} \hat{E}_{k}
\end{aligned}
\end{equation}

Overleaf computes everything else correctly but doesn't show the Greek letter with the hat. EDIT: added an image to show the problem

image showing the problem

If I remove the \hat command, the code works fine but it's not what I want. Outside the equation environment, using $\hat{\rho}$ works without problems.

9
  • 6
    Can you please make a complete minimal example? Here I get nice hats also on greek letters.
    – mickep
    Commented Aug 23, 2022 at 9:55
  • 2
    Unrelated: _{\text{non lin}} is a very bad idea, \text is not for writing some text upright. Use \textup or \textnormal instead. Why? Try \itshape $X_{\text{max}}, \text{max} comes out in italic. Not what we want for a named index.
    – daleif
    Commented Aug 23, 2022 at 10:13
  • The equation number in the picture appears misplaced, which may denote some other problem. Are you getting any error message?
    – egreg
    Commented Aug 23, 2022 at 10:13
  • 3
    @a_dragon08 Please, report the exact code you're using, without attempting to format it.
    – egreg
    Commented Aug 23, 2022 at 10:22
  • 2
    Do not ignore error mssages! Overleaf will haave a red circle with an error count and a mark at the line number of your source. Also post your real code here, You have not posted any code with a blank line that would show the error. A blank line is end-of-paragraph and you can not end a paragraph in the middle of math. Commented Aug 23, 2022 at 10:36

1 Answer 1

4

From the output I would assume you have a blank line after \begin{equation}

This generates.

! Missing $ inserted.
<inserted text> 
                $
l.9 
    
? 

In Overleaf it will make a red error mark and you can check the log for the full error.

Do not ignore error messages! Overleaf will have a red circle with an error count and a mark at the line number of your source. Also post your real code here, You have not posted any code with a blank line that would show the error. A blank line is end-of-paragraph and you can not end a paragraph in the middle of math.

You must log in to answer this question.

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