[Tex/LaTex] How to use \rightarrow in normal sentence construction

symbols

I want to use the \rightarrow without the \mathit command. Here is what I want to write:
[ID, List of symbols] \rightarrow Sequence of rules but when I write it using \mathit command all the spaces are collapsed.

(\mathit{[ID, List of symbols]  \rightarrow  Sequence of rules }\)

How do I correct this?

Best Answer

Make the text parts of your formula text instead of maths

$\hbox{[ID, List of symbols]} \rightarrow \hbox{Sequence of rules}$

or if you prefer "proper" LaTeX and you have the amsmath package loaded to give you the \text command

\(\text{[ID, List of symbols]} \rightarrow \text{Sequence of rules}\)

enter image description here