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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
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