Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
    
Ops sorry I'll update the question... This is within that syntax package it seems. –  drozzy 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
add comment

1 Answer

up vote 3 down vote accepted

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}
share|improve this answer
    
thanks, I found that lit{$\rightarrow$} also works! –  drozzy Sep 5 '12 at 17:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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