# How to write gamma in latex

I want to use the symbol gamma in the following document. But whenever i type \gamma , i get the error:

! Undefined control sequence.
l.7 hello my boy!!!!!!!! \X
\gamma
?


The code is as follows:

\documentclass[12pt]{article}
\usepackage{amssymb}
\usepackage[a4paper, margin=1 in]{geometry}
\begin{document}
\title{title}
\maketitle
hello my boy!!!!!!!! \X\gamma
\end{document}


Can anyone tell me how to fix this problem?

• Put it in math mode: $\gamma$. – Michael Hardy Sep 11 '15 at 4:08
• What is \X by the way? – Au101 Sep 11 '15 at 4:09
• @Au101 i don't know, i googled it and i found that line for gamma, so tried it out, but didnt work – girl101 Sep 11 '15 at 4:10

The problem here is two-fold. Not only should \gamma be written using math-mode $\gamma$, but that \X is undefined.

\documentclass{article}
\begin{document}
Hello world! $\gamma$
\end{document}


How to interpret the error message style of TeX is obtained by reading Chapter 6: Running TeX (p 31) in the TeXbook:

! Undefined control sequence.
l.2 \vship
1in
?


TeX begins its error messages with ‘!’, and it shows what it was reading at the time of the error by displaying two lines of context. The top line of the pair (in this case ‘\vship’ ) shows what TeX has looked at so far, and where it came from (‘l.2’, i.e., line number 2); the bottom line (in this case ‘1in’ ) shows what TeX has yet to read.

In your case, TeX's already read \X (the undefined control sequence), but not yet \gamma.

\newcommand{\mygamma}{\ensuremath{\gamma{}}}

\begin{document}

\mygamma

\end{document}


or whatever you want to call it.