Text FormattingCommand \' invalid in math mode on input line with 2^...

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Félix
Posts: 3
Joined: Wed May 25, 2011 3:52 pm

Command \' invalid in math mode on input line with 2^...

Post by Félix »

Hello,
I have a compilation problem with a specific command.
First, I have to mention that I do have the ams package.
Second, I also have all the babel french libraries to take punctuation into account.
Third, I use TeXnicCenter.

I first did this:

Code: Select all

\item Indiquez que la validité sera vérifiée pour 2^{\operatorname{ Nb. d'éléments } } 
then I had the warning: \ ' invalid in math mode on input line ...

So I changed it for:

Code: Select all

\item Indiquez que la validité sera vérifiée pour \begin{equation} \text{ 2^{\operatorname{ Nb. d'éléments } } }\end{equation}
But now the told me that I am missing $ signs!

! Missing $ inserted. <inserted text> $
and I still have LaTeX Warning: Command \' invalid in math mode on input line ...

See, this is a never ending problem!

What the trick with these kind of things?
Last edited by Stefan Kottwitz on Fri May 27, 2011 10:53 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Command \' invalid in math mode on input line with 2^...

Post by localghost »

Well, the error message is very clear. The „^“ command for superscripts is only allowed in math mode. For text mode you may use \textsuperscript{2}. Due to the lack of a minimal example this is all I can advise.


Best regards and welcome to the board
Thorsten
Félix
Posts: 3
Joined: Wed May 25, 2011 3:52 pm

Re: Command \' invalid in math mode on input line with 2^...

Post by Félix »

Thank you, it worked perfectly well. But you probably meant that I should write
2\textsuperscript{Nb. d'éléments}. Anyway, thank you again for that.
Post Reply