[Tex/LaTex] Texworks crash when compiling or “LaTeX Error: Command \bfseries invalid in math mode” after attempting to

citingerrorsmath-modetables

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?

Best Answer

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)