# \newcommand doesn't work with \section and \chapter

I have a newcommand defined as follows:

\newcommand{\met}{\cancel{\it{E}}_{T}}


When I try to place it into a \section like this:

\chapter{\met}


I get error messages like this:

! Undefined control sequence. \met ->{\cancel {\it {E}}_{T}}

I am using TeXworks with miktex 2.9 on Windows 7.

What is the cause of this error?

• Why is there a backslash in front of the closing brace? – Johannes_B Nov 13 '14 at 9:17
• Now that the aforementioned backslash is gone, the error message changed as well. Seems you didn't load package cancel or met isn't defined. Hard to tell without the needed information. – Johannes_B Nov 13 '14 at 9:22
• btw: the underscore will throw a missing math error, and the \it{<argument>} doesn't exist as well. – Johannes_B Nov 13 '14 at 9:24
• It might be easier, if you tell us, what you are trying to achieve. – Johannes_B Nov 13 '14 at 9:25
• My mistake, I've updated the post with the error I am seeing, it is actually an undefined control sequence. – user788171 Nov 13 '14 at 9:25

Please always post complete documents, as below, not just fragments.

\documentclass{report}

\begin{document}

\newcommand{\met}{\cancel{\it{E}}_{T}}

\chapter{\met}

\end{document}


I get

! Undefined control sequence.
\met ->\cancel


so change to

\documentclass{report}
\usepackage{cancel}
\begin{document}

\newcommand{\met}{\cancel{\it{E}}_{T}}

\chapter{\met}

\end{document}


I get

! You can't use \/' in vertical mode.
\@cancel ...ht \unitlength \p@ \canc@thinlines {\/


Which is maybe a bit harder to understand but \cancel is supposed to be in math mode, so not at the start of a paragraph in vertical mode. so

\documentclass{report}
\usepackage{cancel}
\begin{document}

\newcommand{\met}{$\cancel{\it{E}}_{T}$}

\chapter{\met}

\end{document}


which produces

Output written on file.pdf (1 page, 33145 bytes).


Which is sort of OK except that \it has been deprecated since LaTeX2e was introduced in 1993, and if it is used the syntax is {\it E} not \it{E} You could use \mathit{E} which is the correct markup to get the previous image but probably you want math italic for which you just need E

\documentclass{report}
\usepackage{cancel}
\begin{document}

\newcommand{\met}{$\cancel{E}_{T}$}

\chapter{\met}

\end{document}
`

Producing