Am Mittwoch, 17. Mai 2006 09:57 schrieb John McCabe-Dansted:
> 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?

As always in such a case it's best to write a new layout file. 
Obviously, this layout file should be derived from the KOMA book layout 
file. For my thesis I've created a layout file for KOMA book with 
ntheorem and paralist package. I've attached the corresponding files. 
You have to put them into ~/.lyx/layouts (at least on Linux/Unix). Then 
you have to run Edit->Reconfigure... After restarting the new text 
class (called "book (Doktorarbeit koma)") should be available. If it 
works then switch the class of all files to this class. Make sure you 
make a backup of your thesis before you try this!

Regards,
Ingo

# Author: Ingo Kloecker <[EMAIL PROTECTED]>
# This defines the theorem styles environments provided by ntheorem.sty.
# Most of this stuff was adapted from the layout files for AMS document
# classes.
# This version has Theorems and other results numbered in one sequence, and all
# numbered environments (figures as well) containing the section number.
# (Theorem (1.1), Corollary (1.2) Theorem (1.3), etc.
# This is the english version.

# Due to a bug (?) in LyX the following has to be copied to the Preamble block
# of the layout file which includes this file. Changing it here doesn't have
# any effect.
Preamble
  \usepackage{amsmath}
  \usepackage[standard,amsmath,thmmarks]{ntheorem}
  \theoremstyle{plain}
  \newtheorem{thm}{Theorem}[chapter]
EndPreamble

# The environments defined are :
# - Proof
# - Theorem
# - Theorem*
# - Lemma
# - Lemma*
# - Proposition
# - Proposition*
# - Corollary
# - Corollary*
# - Definition
# - Definition*
# - Remark
# - Remark*
# - Example
# - Example*

# Proof style declaration
Style Proof
  Margin                First_Dynamic
  LatexType             Environment
  LatexName             proof
  NextNoIndent          1
  LabelSep              xx
  ParIndent             MMM  
  ParSkip               0.4
  ItemSep               0.2
  TopSep                0.7
  BottomSep             0.7
  ParSep                0.3
  Align                 Block
  AlignPossible         Block, Left
  LabelType             Static
  LabelString           "Proof."
  EndLabelType          Box
  
  # standard font definition
  Font
    Shape               Up
    Size                Normal
  EndFont

  # label font definition
  LabelFont
    Shape               Italic
  EndFont

  # We don't want the preamble from Theorem
  Preamble
  EndPreamble 
End  

# Theorem-numbered style declaration
Style Theorem
  Margin                First_Dynamic
  LatexType             Environment
  LatexName             thm
  NextNoIndent          1
  LabelSep              xx
  ParIndent             MMM  
  ParSkip               0.4
  ItemSep               0.2
  TopSep                0.7
  BottomSep             0.7
  ParSep                0.3
  Align                 Block
  AlignPossible         Block, Left
  LabelType             Static
  LabelString           "Theorem #."

  
  # standard font definition
  Font
    Shape               Italic
    Size                Normal
  EndFont

  # label font definition
  LabelFont
    Shape               Up
    Series              Bold
  EndFont

End  

# Theorem-unnumbered style declaration
Style Theorem*
  CopyStyle             Theorem
  LatexName             thmNN*
  LabelString           "Theorem."

  Preamble
    \theoremstyle{plain}    
    \newtheorem*{thmNN*}{Theorem} %% unnumbered; needed for LyX
  EndPreamble
End  

# Lemma-numbered style declaration
Style Lemma
  CopyStyle             Theorem
  LatexName             lem
  LabelString           "Lemma #."

  Preamble
    \theoremstyle{plain}    
    \newtheorem{lem}[thm]{Lemma} %%Delete [thm] to re-start numbering
  EndPreamble
End  

# Lemma-unnumbered style declaration
Style Lemma*
  CopyStyle             Theorem
  LatexName             lemNN*
  LabelString           "Lemma."

  Preamble
    \theoremstyle{plain}    
    \newtheorem*{lemNN*}{Lemma} %% unnumbered; needed for LyX
  EndPreamble
End  

# Proposition-numbered style declaration
Style Proposition
  CopyStyle             Theorem
  LatexName             prop
  LabelString           "Proposition #."

  Preamble
    \theoremstyle{plain}    
    \newtheorem{prop}[thm]{Proposition} %%Delete [thm] to re-start numbering
  EndPreamble
End  

# Proposition-unnumbered style declaration
Style Proposition*
  CopyStyle             Theorem
  LatexName             propNN*
  LabelString           "Proposition."

  Preamble
    \theoremstyle{plain}    
    \newtheorem*{propNN*}{Proposition} %% unnumbered; needed for LyX
  EndPreamble
End  

# Corollary-numbered style declaration
Style Corollary
  CopyStyle             Theorem
  LatexName             cor
  LabelString           "Corollary #."

  Preamble
    \theoremstyle{plain}    
    \newtheorem{cor}[thm]{Corollary} %%Delete [thm] to re-start numbering
  EndPreamble
End  

# Corollary-unnumbered style declaration
Style Corollary*
  CopyStyle             Theorem
  LatexName             corNN*
  LabelString           "Corollary."

  Preamble
    \theoremstyle{plain}    
    \newtheorem*{corNN*}{Corollary} %% unnumbered; needed for LyX
  EndPreamble
End  

# Definition-numbered style declaration
Style Definition
  CopyStyle             Theorem
  LatexName             defn
  LabelString           "Definition #."
  
  # standard font definition
  Font
    Shape               Up
  EndFont

  # label font definition
  LabelFont
    Shape               Up
    Series              Bold
  EndFont
 
  Preamble
   \theoremstyle{definition}
   \newtheorem{defn}[thm]{Definition}
  EndPreamble
End  

# Definition-unnumbered style declaration
Style Definition*
  CopyStyle             Definition
  LatexName             defnNN*
  LabelString           "Definition."
  
  Preamble
   \theoremstyle{definition}
   \newtheorem*{defnNN*}{Definition} %% unnumbered; needed for LyX
  EndPreamble
End  

# Remark-numbered style declaration
Style Remark
  CopyStyle             Definition
  LatexName             rem
  LabelString           "Remark #."
  
  # standard font definition
  Font
    Shape               Up
    Size                Normal
  EndFont

  # label font definition
  LabelFont
    Series              Medium
    Shape               Italic
  EndFont

  Preamble
    \theoremstyle{definition}
    \newtheorem{rem}[thm]{Remark}
  EndPreamble
End  

# Remark-unnumbered style declaration
Style Remark*
  CopyStyle             Remark
  LatexName             remNN*
  LabelString           "Remark."

  Preamble
    \theoremstyle{definition}
    \newtheorem*{remNN*}{Remark} %% unnumbered; needed for LyX
  EndPreamble
End  

# Example-numbered style declaration
Style Example
  CopyStyle             Definition
  LatexName             exa
  LabelString           "Example #."

  Preamble
   \theoremstyle{definition}
    \newtheorem{exa}[thm]{Example}
  EndPreamble
End  

# Example-unnumbered style declaration
Style Example*
  CopyStyle             Definition
  LatexName             exaNN*
  LabelString           "Example."

  Preamble
   \theoremstyle{definition}
    \newtheorem*{exaNN*}{Example} %% unnumbered; needed for LyX
  EndPreamble
End  
#% Do not delete the line below; configure depends on this
#  \DeclareLaTeXClass[scrbook,ntheorem.sty,paralist.sty]{book (Doktorarbeit 
koma)}
# KOMA book textclass definition file for my Doktorarbeit
# Derived from scrbook.layout and scrclass.inc
# Author : Ingo Klöcker <[EMAIL PROTECTED]>

# General textclass parameters
Sides                   2
PageStyle               Headings
SecNumDepth             2
TocDepth                2
DefaultStyle            Standard

# Standard style definition
Style Standard
  LatexName             dummy
  ParIndent             MM
  ParSkip               0.4
  AlignPossible         Block, Left, Right, Center
End

# First the theorem environment definitions
Input ntheorem-en.inc

# Next my list definitions
Input iklists-en.inc

Input stdcounters.inc
Input stdfloats.inc

# Modify Description
Style Description
  LabelFont
    Family              Sans
  EndFont
End

# Labeling style definition
Style Labeling
  Margin                Manual
  LatexType             List_Environment
  LatexName             labeling
  NextNoindent          1
  LabelSep              xxx
  ParSkip               0.4
  TopSep                0.7
  BottomSep             0.7
  ParSep                0.5
  Align                 Block
  AlignPossible         Block, Left
  LabelType             Manual
  LabelString           00.00.0000
End

Input stdsections.inc

# Modify Part
Style Part
  Font
    Family              Sans
  EndFont
End

# Modify Chapter
Style Chapter
  LabelString           ""
  Font
    Family              Sans
    Size                Largest
  EndFont
End

# Modify Section
Style Section
  Font
    Family              Sans
  EndFont
End

# Modify Subsection
Style Subsection
  Font
    Family              Sans
  EndFont
End

# Modify Subsubsection
Style Subsubsection
  Font
    Family              Sans
  EndFont
End

# Modify Paragraph
Style Paragraph
  Font
    Family              Sans
  EndFont
End

# Modify Subparagraph
Style Subparagraph
  LeftMargin            ""
  Font
    Family              Sans
  EndFont
End

Input stdstarsections.inc

# Addpart Style Definition
Style Addpart
  CopyStyle             Part*
  LatexName             addpart
End

# Addchap Style Definition
Style Addchap
  CopyStyle             Chapter*
  LatexName             addchap
End

# Addsec Style Definition
Style Addsec
  CopyStyle             Section*
  LatexName             addsec
End

# Addchap* Style Definition
Style Addchap*
  CopyStyle             Chapter*
  LatexName             addchap*
End

# Addsec* Style Definition
Style Addsec*
  CopyStyle             Section*
  LatexName             addsec*
End

# Minisec style definition
Style Minisec
  LatexType             Command
  LatexName             minisec
  NeedProtect           1
  NextNoIndent          1
  LabelSep              xxx
  ParSkip               0.4
  TopSep                0.4
  ParSep                0.4
  AlignPossible         Block, Left

  Font
    Family              Sans
    Series              Bold
  EndFont
End

Input stdtitle.inc

# Modify Title
Style Title
  Font
    Family              Sans
    Series              Bold
  EndFont
End

# Modify Author
Style Author
  Font
    Size                Larger
  EndFont
End

# Modify Date
Style Date
  Font
    Size                Larger
  EndFont
End

# Subject style definition
Style Subject
  CopyStyle             Author
  LatexName             subject
End

# Publishers style definition
Style Publishers
  CopyStyle             Author
  LatexName             publishers
End

# Dedication style definition
Style Dedication
  CopyStyle             Author
  LatexName             dedication
End

# Titlehead style definition
Style Titlehead
  CopyStyle             Author
  LatexName             titlehead
  Align                 Left
  AlignPossible         Left

  Font
    Size                Normal
  EndFont
End

# Uppertitleback style definition
Style Uppertitleback
  CopyStyle             Titlehead
  LatexName             uppertitleback
End

# Lowertitleback style definition
Style Lowertitleback
  CopyStyle             Titlehead
  LatexName             lowertitleback
End

# Extratitle style definition
Style Extratitle
  CopyStyle             Titlehead
  LatexName             extratitle
End

Input stdstruct.inc

# Modify Abstract
Style Abstract
  LabelFont
    Family              Sans
  EndFont
End

# Modify Bibliography
Style Bibliography
  LabelFont
    Family              Sans
  EndFont
End

Input stdlayouts.inc

# Captionabove style definition
Style Captionabove
  CopyStyle            Caption
  LatexName            captionabove
End

# Captionbelow style definition
Style Captionbelow
  CopyStyle            Caption
  LatexName            captionbelow
End

# Dictum style definition
Style Dictum
  Margin               Right_Address_Box
  LatexType            Command
  LatexName            dictum
  ParSkip              0.4
  BottomSep            1.5
  ParSep               1.5
  Align                Left
  AlignPossible        Left
  OptionalArgs         1

  Font
    Size                Normal
  EndFont
End

Input lyxmacros.inc
Input scrmacros.inc
#----- end of scrclass.inc ----------------------------------------------------

NoStyle Abstract  # there are no abstract in a book.

# Modify bibliography
Style Bibliography
  TopSep                4
  LabelString           Bibliography

  LabelFont
    Series              Bold
    Size                Largest
  EndFont
End
#----- end of scrbook.layout --------------------------------------------------

# The first 4 lines should be defined in ntheorem-en.inc, but the
# Preamble section there is ignored.
Preamble
  \usepackage{amsmath}
  \usepackage[standard,amsmath,thmmarks]{ntheorem}
  \theoremstyle{plain}
  \newtheorem{thm}{Theorem}[chapter]
  \usepackage{paralist}
  %\usepackage{enumerate}
  %\renewcommand{\thechapter}{\Roman{chapter}:\hspace{-0.5em}}
  %\renewcommand{\thesection}{\alph{section})\hspace{-0.5em}}
  %\renewcommand{\thesubsection}{\arabic{subsection})\hspace{-0.5em}}
  [EMAIL PROTECTED]
  %                                      {\Large\upshape\bfseries Kapitel }}
  [EMAIL PROTECTED]
  %                                      {\large\upshape\bfseries}}
  [EMAIL PROTECTED]
  %                                         {\upshape\bfseries}}
  \numberwithin{equation}{chapter} %% Comment out for sequentially-numbered
  \numberwithin{figure}{chapter} %% Comment out for sequentially-numbered
EndPreamble
# Definitions for list environments
#
# This file defines the standard list environments and additionally some
# compact enumeration environments with defined counter layouts as provided
# by paralist.sty.
# Derived from stdlists.inc.
# Author: Ingo Kloecker <[EMAIL PROTECTED]>
# This is the English version.


# Itemize style definition
Style Itemize
  Margin                Static
  LatexType             Item_Environment
  LatexName             itemize
  NextNoIndent          1
  LeftMargin            MMN
  LabelSep              xx
  ItemSep               0.2
  TopSep                0.7
  BottomSep             0.7
  ParSep                0.3
  Align                 Block
  AlignPossible         Block, Left
  LabelType             Static
  LabelString           *
End

# Enumerate style definition
Style Enumerate
  Margin                Static
  LatexType             Item_Environment
  LatexName             enumerate
  NextNoIndent          1
  LeftMargin            MMN
  LabelSep              xx
  ParSkip               0.0
  ItemSep               0.2
  TopSep                0.7
  BottomSep             0.7
  ParSep                0.3
  Align                 Block
  AlignPossible         Block, Left
  LabelType             Counter_EnumI
End

# Enumerate style definitions
Style Enumeration_(a_b_c)
  CopyStyle             Enumerate
  LatexName             compactenum
  LatexParam            "[a)]"
  LabelType             Counter_EnumI
  ItemSep               0.0
  TopSep                0.0
  BottomSep             0.0
End

Style Enumeration_(i_ii_iii)
  CopyStyle             Enumerate
  LatexName             compactenum
  LatexParam            "[(i)]"
  LabelType             Counter_EnumI
  ItemSep               0.0
  TopSep                0.0
  BottomSep             0.0
End

Style Enumeration_(1_2_3)
  CopyStyle             Enumerate
  LatexName             enumerate
  LatexParam            "[\upshape (1)]"
  LabelType             Counter_EnumI
  ItemSep               0.0
  TopSep                0.0
  BottomSep             0.0
End

# The original Enumerate is not deleted to make the conversion
# easier.

# Description style definition
Style Description
  Margin                First_Dynamic
  LatexType             Item_environment
  LatexName             description
  NextNoIndent          1
  LeftMargin            MM
  LabelSep              xxx
  ParSkip               0.4
  ItemSep               0.2
  TopSep                0.7
  BottomSep             0.7
  ParSep                0.3
  Align                 Block
  AlignPossible         Block, Left
  LabelType             Manual
  LabelString           MM

  # label font definition
  LabelFont
    Series              Bold
  EndFont
End

# List style definition
Style List
  Margin                Manual
  LatexType             List_Environment
  LatexName             lyxlist
  NextNoindent          1
  LabelSep              xxx
  ParSkip               0.4
  TopSep                0.7
  BottomSep             0.7
  ParSep                0.5
  Align                 Block
  AlignPossible         Block, Left
  LabelType             Manual
  LabelString           00.00.0000

  #define the environment lyxlist
  Preamble
  \newenvironment{lyxlist}[1]
    {\begin{list}{}
      {\settowidth{\labelwidth}{#1}
       \setlength{\leftmargin}{\labelwidth}
       \addtolength{\leftmargin}{\labelsep}
       \renewcommand{\makelabel}[1]{##1\hfil}}}
    {\end{list}}
  EndPreamble

End

Reply via email to