8

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?

6
  • Doesn't work as in "doesn't compile" or doesn't work as in "doesn't produce an arrow" or what?
    – blahdiblah
    Commented Nov 23, 2011 at 23:33
  • How exactly don't they work? Do you get an error or do they just not show up? Commented Nov 23, 2011 at 23:33
  • @blahdiblah: Heh, we asked exactly the same question within 10 seconds of each other. Commented Nov 23, 2011 at 23:33
  • I get an error I think something about not being in math mode ? ! Missing $ inserted. it says
    – Cemre
    Commented Nov 23, 2011 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
    Commented Nov 24, 2011 at 0:09

2 Answers 2

21

\leftarrow is a math mode symbol. Try $\leftarrow$ if you're using it inline in regular text.

3
  • ah so thats what missing $ means after all.. thanks it worked. How do I switch to math mode ?
    – Cemre
    Commented Nov 23, 2011 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. Commented Nov 23, 2011 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
    Commented Nov 23, 2011 at 23:38
2

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 \( \).

4
  • 1
    still doest work but just discovered that \ensuremath{\leftarrow} works but dont know how I can do that with out \ensuremath tag
    – Cemre
    Commented Nov 23, 2011 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? Commented Nov 23, 2011 at 23:34
  • trying to use them in an \enumarate along with an \item
    – Cemre
    Commented Nov 23, 2011 at 23:35
  • As I said, you need to be in math mode. Try using $\rightarrow$ or \(\rightarrow\) when you want an arrow. Commented Nov 23, 2011 at 23:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .