1

This question already has an answer here:

For a context free grammar I need to write:

A -> a | b 

My code for this is

$ A \rightarrow a | b $

however this gives me something like

A -> a|b // wanted: a | b, note the space before and after the |

meaning there is no space between a|b.

How can I fix this?

Thanks for any hint!

marked as duplicate by egreg, morbusg, David Carlisle, Claudio Fiandrino, cmhughes Mar 7 '13 at 16:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Use \mid that will produce the same spacing as \rightarrow – egreg Mar 7 '13 at 16:00
  • works perfect, thanks! Please add it as answer. – stefan.at.wpf Mar 7 '13 at 16:07