[Tex/LaTex] lyx newcommand and newtheorem

lyxmodulespreamble

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)

Best Answer

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, ...".