# Why is a simple fraction not displaying properly?

This should be pretty basic, but I can't work out what I'm doing wrong here.

I'm trying to just write a = 1/6 with the fraction displayed the normal way, 1 over 6.

I've tried both a = \frac{1}{6} and a = \frac16.

In both cases, it's displaying a centred 1 next to a fraction with 6 as the denominator, and a blank space for the numerator.

Essentially a = 1.[empty space]/6

Also the 6 on the bottom is a smaller font size than the centred 1.

Any advice please? I feel I must be missing something fairly simple.

Edit: Just realised I can add an image. This is what it looks like:

• Welcome to TeX.SE! My crystal ball tells me that you haven't use math mode. For inline-math you should write $a=\frac{1}{6}$ (with the dollar signs), ore use a display math environment. Please have a look at What are good learning resources for a LaTeX beginner? and What is Math Mode. Dec 22, 2020 at 10:47
• never ignore error messages. If you get an error and want to ask for help, ask about the error The generated PDF after an error is not intended to be usable. Dec 22, 2020 at 10:52
• Ah it's exactly that: the math mode that @campa suggested. Adding the dollar sign fixed it. Thank you! And thank you for those two links too
– Matt
Dec 22, 2020 at 10:55
• Enlightenment: read the terminal output and/or the log output. There are error messages. Don't think about the output if there are errors in the log file. Do think about these error messages and modify the input in order to remove such messages. The output is random if the error messages are in the log. Dec 22, 2020 at 11:03
• I’m voting to close this question because is solved by comment. Dec 22, 2020 at 11:28

TeX distinguishes between text and math mode, because text and math follow very different typographic conventions. To "enforce" this distinction, math-mode commands yield errors when used in text mode. The short answer to your issue is thus "type math in math mode", i.e. $a=\frac{1}{6}$ or $$a=\frac{1}{6}$$ for inline math, or some display math environment.

As David and Wipet pointed out in their comments you should never ignore error messages; and the output you get after errors is just TeX trying to recover and hoping for the best. This output is usually rubbish. Just for fun, let us try to see what is going on wrong with the minimal code

\documentclass{article}
\begin{document}
a = \frac{1}{6}
\end{document}


When TeX encounters a it switches to horizontal mode and starts typesetting normal text. TeX goes on and finds the letter a, a space, the equal sign, another space (all in text mode). Now TeX finds \frac, which is a macro defined by LaTeX as

\def\frac#1#2{{\begingroup#1\endgroup\over#2}}


and after its expansion it's effectively like your code were

a = {\begingroup1\endgroup\over6}


TeX goes on: the opening brace, \begingroup, the number 1, and \endgroup (everything still in text mode) are sent to be typeset.

Now TeX finds \over: this is a math-mode primitive, which is allowed only in math mode, so TeX assumes you forgot to enter it. Therefore it spits out the error

! Missing $inserted. I've inserted a begin-math/end-math symbol since I think you left one out. Proceed, with fingers crossed.  and enters math mode by adding a $, which also starts a group; now \over recognizes what precedes it in the current group numerator, but in the math list which has been opened by the error recovery there is nothing before \over, so the numerator is empty. Then TeX goes on, finds 6 (the denominator), and then the closing brace. Now that's a problem: where is the opening brace? It was outside of math mode, but the inserted $ opened another one, so this brace is mismatched. Therefore TeX spits out the following error ! Extra }, or forgotten$.
I've deleted a group-closing symbol because it seems to be
spurious, [...]


TeX assumes that the } was wrong, deletes it, and still tries to go on (still being in math mode). Then in the expansion of \end{document} TeX finds a \par, which is allowed only in text mode, so it assumes that you forgot to exit math mode, and spits again a

! Missing $inserted. I've inserted a begin-math/end-math symbol since I think you left one out. Proceed, with fingers crossed.  Then it inserts a $ and somehow finishes the document. Basically TeX has behaved as if you had typed

\begin{document}
a = {\begingroup1\endgroup$\over6$
\end{document}


and prints

where the a = 1 is in text mode, and the error recovery mechanism has somehow managed to give you that weird-looking fraction. Oh, yes, at the end TeX also tells you

(\end occurred inside a group at level 1)
### simple group (level 1) entered at line 3 ({)


because the opening brace was never closed (the corresponding closing brace was eliminated during the error recovering).

• Very good analysis! Dec 22, 2020 at 12:15
• @egreg Thanks. I wasn't quite sure about posting it because it is likely a bit too advanced for the OP but maybe some casual lurker might enjoy it nonetheless. Dec 22, 2020 at 12:20