On Wed, Nov 10, 1999 at 09:36:21PM -0800, Ken Miller wrote: > I'm running reLyX Revision date 1999/05/02 on red hat 6.0 linux on an > intel machine (dual pentium) with "perl, version 5.005_03 built for > i386-linux". The following simple tex file test.tex causes reLyX to fail: > > %-------------------------------------------------------------- > > \documentclass[12pt]{article} > \begin{document} > > \newcommand{\beq}{\begin{equation}} > > will lyx work on this file? > > \end{document} > > %-------------------------------------------------------------- If you look at BUGS in the reLyX directory, you'll see that \end in a \newcommand breaks reLyX. So does \begin, for the same reason. The TeX parser thinks when it sees "\begin" that you're going to start a new environment. When you don't, it breaks. Unfortunately, it's not too easy to change reLyX to work around this problem. (Besides which, I haven't been working on reLyX much lately, and noone else has stepped in.) If you put the \newcommand into the preamble (i.e., before \begin{document}), then reLyX won't break on that command. Unfortunately, reLyX won't realize that \beq means \begin{equation}, so it won't handle your equations as math, so it may break anyway. It would be even harder to change reLyX to handle that. One way would be to use a macro expander that automatically took every \newcommand in your program and changed it to its definition. There's a program that does that (called "TeX Macro Expander") and it was suggested that that be part of reLyX. However, you then lose all your macros if you want to write the file out as LaTeX. Another fix would be to look for just the special macros that started new environments and things. But I'm sure you can see this would be Hard. I think the best fix might just be to use search-and-replace in a text editor. Or: perl -wpe 's/\\beq\b/\begin{equation}/g' file.tex > newfile.tex and run reLyX on that. (The extra \b after \\beq is so that "\bequeath" doesn't get translated.) Sorry that it doesn't work better. Unfortunately, this is one of reLyX's real weaknesses. Things like \newcommand can have *anything* in the command definition, so there's no way reLyX could understand all of it. We could make reLyX not crash, but it probably wouldn't handle things correctly anyway :( -Amir Karger