I found the following command for increasing the space between an \underline and its corresponding text:


This command works well e.g. in


By trying to overline a term that needs a math environment it works as well, e.g.


However I want to use my command in an equation, e.g.


Neither the first nor the second line works for me but I couldn't find any reason for this yet. I got the assumption that the predefined math mode of the equation brings me some issues. Therefore I tried to understand those issues by using this command without the equation in a math mode.


Also none of them worked. For all of them I get the same Error message:

! Missing $ inserted.<inserted text>$

So my question is: What should I do/change to use my command in a math environment, especially in a equation? Did I make something wrong?

I am sorry if I made any mistakes. I am new to this board and its my first question.

  • 4
    get rid of the $ signs in the \ovF definition (then it will work exclusively in math mode). If you, instead, want it to work in both math and non math modes, replace the $...$ instead with \ensuremath{...}. Oct 13, 2016 at 16:00
  • Wow, that was easy.. thank you :) However it doesn't work for \ovF{\varphi}. How can I handle this issue?
    – Peter Wita
    Oct 13, 2016 at 16:02
  • @PeterWita: One would assume you're only using this in math mode, and therefore should use $#1$ rather than #1.
    – Werner
    Oct 13, 2016 at 16:05
  • @Werner: Thank you for your answer. This worked well for me! :)
    – Peter Wita
    Oct 13, 2016 at 16:06
  • That is because the \varphi (corresponding to #1, shows up inside a \raisebox, the contents of which are isolated from the surrounding environment by the box. Thus, as it stands, #1 is always set in text mode. Oct 13, 2016 at 16:07

1 Answer 1


Generally, a function should be targeted for either math or text mode. However, since you seem to want something that functions in all modes, I give it a spin, with a bit of overkill. It obeys math styles, etc.

\parskip 1em

\ovF{\varphi} {\LARGE\ovF{\varphi}}



$\ovF{\varphi} \scriptscriptstyle \ovF{\varphi} $


enter image description here

  • Thank you for this detailed answer. I understand all of it :)
    – Peter Wita
    Oct 13, 2016 at 16:22

You must log in to answer this question.

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