## LaTeX forum ⇒ LyX ⇒ Amsthm 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

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 :

`\documentclass[prodmode,acmec]{ec-acmsmall}\usepackage[latin9]{inputenc}\let\proof\relax\let\endproof\relax\let\example\relax\let\endexample\relax \usepackage{amsthm}`

I would like to write this paper in lyx. In order to do so, I defined a layout file which contains only:
`#% Do not delete the line below; configure depends on this#  \DeclareLaTeXClass[ec-acmsmall]{ec-acmsmall} # Input general definitionsInput 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

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

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

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
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:
`#% Do not delete the line below; configure depends on this#  \DeclareLaTeXClass[ec-acmsmall]{ec-acmsmall} # Input general definitionsInput article.layout Preamble\let\proof\relax\let\endproof\relax\let\example\relax\let\endexample\relaxEndPreamble`

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

### Who is online

Users browsing this forum: No registered users and 5 guests