LyXAmsthm enviroment clash

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

Amsthm enviroment clash

Post by bloodymeli »

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 :

Code: Select all

\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:

Code: Select all

#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[ec-acmsmall]{ec-acmsmall}
 
# Input general definitions
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:

Code: Select all

\let\proof\relax
\let\endproof\relax
\let\example\relax
\let\endexample\relax
in the settings -> Latex preamble, it will only occur after the line

Code: Select all

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

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

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

Amsthm enviroment clash

Post by StarValkyrie »

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:

Code: Select all

#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[ec-acmsmall]{ec-acmsmall}
 
# Input general definitions
Input article.layout

Preamble
\let\proof\relax
\let\endproof\relax
\let\example\relax
\let\endexample\relax
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

Re: Amsthm enviroment clash

Post by bloodymeli »

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

Re: Amsthm enviroment clash

Post by StarValkyrie »

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