\leftarrow does not work

I am trying to write a document in which for some reason some of the things like \overleftarrow{example} works but \leftarrow and \rightarrow etc. does not work. Any suggestions?

-

migrated from stackoverflow.comNov 24 '11 at 0:06

This question came from our site for professional and enthusiast programmers.

Doesn't work as in "doesn't compile" or doesn't work as in "doesn't produce an arrow" or what? – blahdiblah Nov 23 '11 at 23:33
How exactly don't they work? Do you get an error or do they just not show up? – Tikhon Jelvis Nov 23 '11 at 23:33
@blahdiblah: Heh, we asked exactly the same question within 10 seconds of each other. – Tikhon Jelvis Nov 23 '11 at 23:33
I get an error I think something about not being in math mode ? ! Missing $inserted. it says – Cemre Nov 23 '11 at 23:34 Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. – Werner Nov 24 '11 at 0:09 2 Answers \leftarrow is a math mode symbol. Try $\leftarrow$ if you're using it inline in regular text. - ah so thats what missing$ means after all.. thanks it worked. How do I switch to math mode ? – Cemre Nov 23 '11 at 23:37
Math mode just means that the part of the document you're working on is an equation. $abc$ means the abc is in math mode. You can also use ; things like  and the various math environments (equation, align...etc) also put their contents into math mode but also have other effects. – Tikhon Jelvis Nov 23 '11 at 23:38
Using $s is one way, but there are others. Have a look at, e.g., math.uiuc.edu/~hildebr/tex/course/intro2.html for more information about LaTeX's various modes. – blahdiblah Nov 23 '11 at 23:38 EDIT: It sounds like you're not in math mode when you're trying to insert the arrows. If you're already in an equation, you might be using a command that makes a box. Try surrounding the arrow commands with $ or .

-
still doest work but just discovered that \ensuremath{\leftarrow} works but dont know how I can do that with out \ensuremath tag – Cemre Nov 23 '11 at 23:33
It sounds like you might be having issues with math mode. Are you trying to put the arrows inside some sort of box? – Tikhon Jelvis Nov 23 '11 at 23:34
trying to use them in an \enumarate along with an \item – Cemre Nov 23 '11 at 23:35
As I said, you need to be in math mode. Try using $\rightarrow$ or $$\rightarrow$$ when you want an arrow. – Tikhon Jelvis Nov 23 '11 at 23:36