And after clicking all the dialog boxes, you actually get the document
processed correctly? I wouldn't think you would, since the theorem
environment simply isn't defined in the koma-script book class, and I've
run a short test here with just one included document. (I've attached
the test files.) Even if I include the AMS math packages, I get the
LaTeX error: Environment theorem undefined. The problem isn't that the
LyX GUI isn't allowing you to enter the theorem environment in
koma-script: It's that the theorem environment doesn't exist in koma-script.

LyX is trying to warn you about exactly this problem: When you include
the Book(AMS) documents in the main Book(koma-script) documents, the
class of the included document is irrelevant. The class has already been
set by the main document, and it cannot be changed mid-stream: It's a
document-global property. LyX will allow you to create and edit the
included documents with whatever class you wish, since it doesn't know
they're included documents. It will only complain when you try to
process the master document. (Maybe LyX should complain when you try to
include a document with a different class?) So the solution you mention
isn't a solution to your problem: It won't work.

If you want to use Book(koma-script) for the main document, then the
only way you can use the theorem environment is to define it yourself in
the preamble. (Maybe you've already done so. If so, see below.) If
you're using other environments from the AMS book class, such as proof,
then those will have to be defined, too. Maybe someone somewhere along
the way wrote a style file to do this: Check CTAN. But another, simpler
option may be to use the AMS book class and then make whatever changes
you need to make to it (using packages like titlesec, titletoc, and
tocloft, if there are issues about how section headings and the like are
set).

Now maybe you've already figured out this issue and just want to know
how to be allowed to enter the theorem environment you've already
defined. In that case, the answer is to modify the koma-script book
layout. That's in scrbook.layout, and you should be able simply to
cut-and-paste from amsbook.layout to get whatever other environments you
want into the new layout. You will also want to change the second line
(the one you're warned not to change!) in your local copy, so you can
use both it and the original koma-script book layout.

Richard

John McCabe-Dansted wrote:
> When writting my thesis I found that I needed komascript to format a
> Thesis correctly, but that LyX would only allow me to enter Theorems
> in a AMS class. My solution to this was to have a Book(koma-script)
> main document that included Book(AMS) LyX documents which contained
> the theorems, lemmas etc.
>
> However with 1.4.1 LyX now generates a prompt
>  "LyX: Different textclasses
>  Included file `afile.lyx'
>  has textclass `amsbook'
>  while parent file has textclass `scrbook'."
> for each included file. As I have a dozen included files, just
> clicking OK can take a while. Does anyone know of a way to suppress
> these dialogs or otherwise allow theorems to be entered via the LyX
> GUI into a komascript document?
>

Attachment: test.lyx
Description: application/lyx

Attachment: thm.lyx
Description: application/lyx

Reply via email to