LaTeX forum ⇒ LyXAmsthm enviroment clash

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
bloodymeli
Posts: 2
Joined: Sun Feb 02, 2014 9:42 pm

Amsthm enviroment clash

Postby bloodymeli » Sun Feb 02, 2014 10:09 pm

Hi All,

I want to write a paper using the ec-acmsmall.cls style file. Unfortunately, this class already defined the proof and example enviroments, and therefore, in order to avoid an error, I have to add the following lines before the amsthm so the latex preample looks like :

  1. \documentclass[prodmode,acmec]{ec-acmsmall}
  2. \usepackage[latin9]{inputenc}
  3. \let\proof\relax
  4. \let\endproof\relax
  5. \let\example\relax
  6. \let\endexample\relax
  7.  
  8. \usepackage{amsthm}


I would like to write this paper in lyx. In order to do so, I defined a layout file which contains only:
  1. #% Do not delete the line below; configure depends on this
  2. # \DeclareLaTeXClass[ec-acmsmall]{ec-acmsmall}
  3.  
  4. # Input general definitions
  5. Input article.layout


However, in this case, I have no proof or example environment. On the other hand, if I add the ams theorem module, then I get an error
"command \proof already defined"

since lyx automatically load amsthm before the custom preamble, and therefore if I manually add:
  1. \let\proof\relax
  2. \let\endproof\relax
  3. \let\example\relax
  4. \let\endexample\relax

in the settings -> Latex preamble, it will only occur after the line
  1. \usepackage{amsthm}

which lyx automatically loads.

Any idea how do I avoid this?How do I make the \let lines before the definition of the amsthm? Alternatively, How do I make lyx recognize the built in enviroment in the ec-acmsmall.cls file?

If you have any other workaround method, please let me know. The paper contains a lot of definitions and theorems, and I would prefer a global solution, rather than manually fixing everything (if this is possible at all).

Tags:

StarValkyrie
Posts: 89
Joined: Fri Jan 24, 2014 12:42 am

Postby StarValkyrie » Sun Feb 02, 2014 11:11 pm

Wait, so I'm confused. Are you loading amsthm as a module or by typing it in to the preamble in Document Settings? If its the latter then since LyX loads the layout preamble before the user-specified preamble you'd just put your letter lines in the the layout file's Preamble declarations. Like:
  1. #% Do not delete the line below; configure depends on this
  2. # \DeclareLaTeXClass[ec-acmsmall]{ec-acmsmall}
  3.  
  4. # Input general definitions
  5. Input article.layout
  6.  
  7. Preamble
  8. \let\proof\relax
  9. \let\endproof\relax
  10. \let\example\relax
  11. \let\endexample\relax
  12. EndPreamble

That won't help if you're loading amsthm - the LyX module though since LyX loads modules right after is loads the class file.

If you wanted to get LyX to recognize the environments from ec-acmsmall.cls instead, then you'd have to ignore the Preamble mods above and instead define each of the special environemnts in the layout file instead. You still would not be able to use amsthm in this case.

bloodymeli
Posts: 2
Joined: Sun Feb 02, 2014 9:42 pm

Postby bloodymeli » Mon Feb 03, 2014 10:32 pm

Hi,

I don't manually load the amsthm package, it auto loads as I add the module "theorems" in lyx.
I've tried adding these lines in the layout file but it didn't work.

How can I manually define the proof and example enviroments?
Also, I need the lemma, thoerem, etc. enviroments.

StarValkyrie
Posts: 89
Joined: Fri Jan 24, 2014 12:42 am

Postby StarValkyrie » Tue Feb 04, 2014 12:22 am

What you'd need to get the ec-acmsmall environments working would depend on how they are implemented in the code and what they do. The class documentation can tell you that, then you have to match it up with the layout commands which you can read about in the LyX Help documentation.

Could you load the amsthm as a package instead of a module and then do what you need to do in ERT or is that too much pure LaTeX? Then I think the preamble in the layout might work.


Return to “LyX”

Who is online

Users browsing this forum: No registered users and 4 guests