# lyx newcommand and newtheorem

I have two simple problems with preamble (Lyx 2.0.0rc3 on Ubuntu 11.04 or Debian Wheezy)

1. If I put in preamble the line

\newcommand{\gra}{\alpha}


then within the math formula when I type \gra I see \gra, not the greek symbol alpha (output is fine) I only get the symbol if I include a math macro in the Lyx file

2. If I put in preamble the line

\newtheorem{assm}{Assumption}


I can only enter the new environment by inserting Latex code with Ctrl-L (and it looks bad anyway), while I want to enter it just as I do with the default ones like "Theorem". Possibly I would also like to have the new environment in the pull-down menu (again output is fine)

-

That is the way it is supposed to work. LyX is not a LaTeX interpreter, it will not be able to parse your preamble and understand the new commands that you define there.

If you want LyX to understand new LaTeX commands and environments, you will need to create a new LyX layout or template file that will create an "interface" between your LaTeX commands and LyX. Read the Customization section of LyX Help, section on "Installing New Document Classes, ...".

-
I could try with a mypre.module like this #\DeclareLyXModule{mypre} #DescriptionBegin #collect stuff #DescriptionEnd Format 21 Style ??? LatexName assm LatexType Environment AddToPreamble \newcommand{\gra}{\alpha} EndPreamble End but what style? and, is the rest right? –  salvatore modica May 4 '11 at 13:07