# Texworks crash when compiling or "LaTeX Error: Command \bfseries invalid in math mode" after attempting to

I'm experiencing a weird error which, being new to LaTeX, I have much trouble understanding, so I'll describe it chronologically.

I first experienced a crash of TeXworks when compiling. I was drawing a table using the tabular environment for the first time, it worked when compiling, then I tried to embed it in a theorem environment successfully, then tried to add text in the theorem before the table, and it crashed when compiling.

After this, I deleted all files except for the `.tex` and the `.bib` files, opened the `.tex` file again, and when compiling, I got :

LaTeX Error: Command \bfseries invalid in math mode.

Then if I close, re-open and try to compile, crash again.

I removed the code for the table, same problems cycle.

I tried removing as much code as possible and noticed it compiles correctly ONLY IF I do not use `\cite{bibkey}` (while before this incident it worked perfectly well).

So I tried to do the same by first compiling the `.bib` file again, which worked fine, but then got the same error when compiling the `.tex` file.

Here I am, this is the chronological description of the issue. What would you advise?

• without any other evidence to the contrary, the most likely reason to get a `\bfseries invalid in math mode` error when you `\cite` something is that the citation text has `\bfseries` in math mode (which is an error) Sep 8, 2016 at 21:20
• Good evening David. As it turns out, there was such an error, and now that it's corrected it works. Thank you for your advice. (Now that I think of it, I'm convinced I compiled successfully after the mistake, but I'm obviously wrong). Sep 8, 2016 at 21:56

``````\bfseries invalid in math mode
error when you `\cite` something is that the citation text has `\bfseries` in math mode (which is an error)