6

I use \over even though it is a bad practice (yes, yes, I know I shouldn't). Whenever I compile a LaTeX file using it, I get the message:

Foreign command \over; \frac or \genfrac should be used instead.

Is there a way to get LaTeX to ignore this warning, so that it doesn't appear in the output? I'm using the amsmath package, if that's relevant.

  • 1
    P.S. If there's a way to get the same syntax as \over that is considered less "evil," I'd be glad to hear about that as well. – jasonhansel Apr 25 '15 at 02:38
  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Symbol 1 Apr 25 '15 at 02:49
  • 1
    Two ways: ① unpack \over and repeat its definition without \message-relevant macros. ② pack \over with \def\message#1{}. – Symbol 1 Apr 25 '15 at 02:59
  • 1
    Can you give an example of how to do this properly? I'm relatively new to LaTeX. – jasonhansel Apr 25 '15 at 03:09
  • Read http://tex.stackexchange.com/questions/73822/what-is-the-difference-between-over-and-frac and from the three answers it is very clear why \over should be avoided in LaTeX. – R. Schumacher Apr 25 '15 at 03:10
  • You could use the plain package. – John Kormylo Apr 25 '15 at 03:16
  • @R.Schumacher I am aware of all of these reasons. However, I prefer to use \over because I find that, for instance, { 1 \over 2 } is much more readable than \frac{1}{2}. – jasonhansel Apr 25 '15 at 03:20
  • @JohnKormylo What do you mean by "the plain package"? A link would be helpful. – jasonhansel Apr 25 '15 at 03:21
  • 2
    The warning indeed comes from the amsmath package. The \over syntax causes technical difficulties for writers of math packages, so the amsmath folks are venting their frustration by redefining \over to print a message, and then act normal. The simplest way to stop this warning from appearing in the output is restore the original definition of \over. Luckily for us, LaTeX saved the original definition of over in @@over. So, near the end of your preamble, (in particular, after loading amsmath), just say \makeatletter\let\over@@over\makeatother – Mark Apr 25 '15 at 04:01
  • @Mark thanks! If you post this as an answer (rather than a comment), I can mark the question as solved – jasonhansel Apr 25 '15 at 04:02
  • @jasonhansel The plain package is an old package meant for resurrecting some Plain TeX macros that were not available in LaTeX or had been disabled by LaTeX2e. Mainly for easing porting code from Plain TeX to LaTeX, but it should be avoided. And also using \over is not recommended in LaTeX, which is why amsmath warns you. – egreg Apr 25 '15 at 09:23
  • @JohnKormylo I hope you were not seriously suggesting putting the whole document in that package's plain environment? It was more or less a joke package anyway and if intended for use at all, intended for typesetting small fragments of plain text markup within a latex file. apart from anything else it redefines \item to match plain's definition so would make all latex lists unusable. – David Carlisle Apr 25 '15 at 09:57

1 Answers1

8

The warning indeed comes from the amsmath package. The \over syntax causes technical difficulties for writers of math packages, so the amsmath folks are venting their frustration by redefining \over to print a message, and then act normal.

The simplest way to stop this warning from appearing in the output is restore the original definition of \over. Luckily for us, LaTeX saved the original definition of over in \@@over. So, near the end of your preamble, (in particular, after loading amsmath), just say

\makeatletter
\let\over\@@over
\makeatother
Werner
  • 603,163
Mark
  • 1,393
  • 1
    http://mirrors.ctan.org/macros/latex/required/amslatex/math/technote.pdf describes the specific details they are venting about. – Mark May 01 '15 at 07:18
  • 1
    Fixed link: https://ctan.math.utah.edu/ctan/tex-archive/macros/latex/required/amsmath/technote.pdf – inavda Jan 28 '22 at 17:27