On Sun, Mar 04, 2012 at 08:06:54AM -0500, Julien Rioux wrote: > On 01/03/2012 8:34 PM, Rav Chandra wrote: > >Hello all, firstly thanks for the great work on LyX. It is a superb > >piece of software. > > > >However, I've encountered a problem when using graphics (i.e. images) > >in-conjunction with the grammar environment of the syntax.sty package. > >Specifically, if I include both an image and a grammar environment > >then the document will fail to compile with "Undefined control > >sequence errors". What is extremely curious, however, is that if your > >export the same file fro LyX to LaTeX (pdflatex) you will then have a > >..tex file which compiles perfectly, without error! > > > >Unfortunately, I am not familiar enough with LyX to understand how to > >investigate this further. However, if useful, I can certainly follow > >instructions to diagnose/debug if pointed in the right direction. > > > >Reproducibility: > >- have tested using LyX 2.0.2 on Linux (Ubuntu 10.04), OS X 10.7, and > >Windows Vista > >- have tested using LyX 2.0.3 on Linux (Ubuntu 10.04) > > > >Steps: > >- make an empty document, insert 1 image > >- add "\usepackage{syntax}" to document preamble > >- insert lyx code: > >""" > >\begin{grammar} > ><hello> ::= "WORLD" > >\end{grammar} > >""" > >- view as pdflatex will produce error > >- export as .tex and then run command "$ pdflatex file.tex" will NOT have > >error > > > >Kind regards > >Rav > > > > When compiled from within LyX, the .tex file and the graphic file > are copied to a temporary directory where (pdf)latex compilation > occurs. In this process the file names are altered. That's just the > way LyX works. It seems that syntax.sty interferes with that > process, causing compilation to fail (for reproducing your bug, it > was sufficient to add a graphic and the \usepackage{syntax} line). > LyX cannot guarantee to support every latex package available. I > hope you can find a fix or an alternative on your end.
The problem here is that syntax.sty makes '_' an active character. A possible workaround is restoring its catcode after loading syntax.sty, i.e., something like this: \usepackage{syntax} \AtBeginDocument{\catcode`\_=8} -- Enrico