I am trying to write something similar to $\frac{a}{b} more words$ but using over (manim requires that it must be with over) but when writing $a\over b more words$ the "more words" appear in the denominator.

How can this issue be solved?

  • 2
    We can answer here, but there is a reason LaTeX uses \frac not \over: why must you use the latter?
    – Joseph Wright
    Jul 9 '20 at 16:22
  • for programming mathematical animations Jul 9 '20 at 16:23
  • That's too vague. Why must you use \over? \frac will help you avoid all sorts of strange occurrences like you've just found.
    – Teepeemm
    Jul 9 '20 at 16:27
  • 1
    yes but it is said (and I've seen some examples) that manim (the math animation tool) encounters even stranger occurences when using \frac Jul 9 '20 at 16:30

Well the solution is simply using { } brackets like so: {a \over b} some words

  • 3
    That is actually not sufficient in the general case. When using \over you should always write {{a} \over {b}}. Jul 9 '20 at 20:33
  • 1
    @HenriMenke Under what circumstances do you need those extra braces? I'm unaware of any case where they're necessary.
    – Don Hosek
    Oct 26 '21 at 3:48
  • @DonHosek The \frac macro adds \begingroup and \endgroup around the first argument, because local assignments in it might spill to the denominator.
    – egreg
    Oct 26 '21 at 8:27
  • @DonHosek Example: $a\let\x\relax\over b\show\x$. Without the grouping, something like \frac{\bf a}{b} would have both letters in boldface. Now \bf is deprecated, I know, but that's the rationale for adding the group.
    – egreg
    Oct 26 '21 at 10:17
  • That seems a bit questionable—both the use case and the effect. It carries with it an implication that in general for a command with two arguments that an assignment in the first argument would not be carried over to the second argument which is not going to be true in general. And to consider this a common enough situation that one should always write {{a}\over{b}} seems dubious.
    – Don Hosek
    Oct 26 '21 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.