i am trying to write some equations and have trouble with the formatting. I assumed that having a table would be good, but if anyone has a better idea, I wanna hear your suggestion. This is my code in latex.

\begin{tabular}{c c c}
$identifier ::$\\
$& identifier\_first\_character$ \\
$& \mid identifier$ & $identifier\_consecutive\_character$


The equation should be like this, in the image

  • First, your code is no for equations. Second, you can get the same result with verbatim environment
    – juanuni
    May 19 '15 at 4:21
  • @juanuni Verbatim doesnt give a good result. I get a lot of unneccessary quotes . May 19 '15 at 4:26
  • I am going to suggest that you look at this posting tex.stackexchange.com/questions/127618/… for formating BNF and EBNF syntax specifications. Before you use the package (or any package) read the documentation, best found at texdoc.net/texmf-dist/doc/latex/mdwtools/syntax.pdf This is what I required my CS students to use for a Survey of Programming Languages course. May 19 '15 at 4:58

With fancyvrb package you can get it




identifier ::
      | identifier identifier_consecutive_character


enter image description here

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.