Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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)

share|improve this question

1 Answer 1

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

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.