3

I am using the syntax package, and I want to define a grammar like:

Rule = Head -> Tail

but when I do this:

\begin{grammar}
<rule> ::=  <head> `$\rightarrow$' <tail>

I get an error saying that Missing $ was inserted.

How can I single-quote a math character?

Thanks

2
  • Ops sorry I'll update the question... This is within that syntax package it seems. – Andriy Drozdyuk Sep 5 '12 at 16:08
  • 1
    possibly \hbox{'$\rightarrow$'} (with a left quote on the left) but if that doesn't work please (always) edit your question to have a complete small document that shows the problem. – David Carlisle Sep 5 '12 at 16:19
3

The backquote ` is a special character in the grammar environment. Precede it by \string if you want an opening quote:

\documentclass{article}
\usepackage{syntax}
\begin{document}
\begin{grammar}
<rule> ::=  <head> \string`$\rightarrow$' <tail>
\end{grammar}
\end{document}
1
  • thanks, I found that lit{$\rightarrow$} also works! – Andriy Drozdyuk Sep 5 '12 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.