commit 0ae337014ec6cfbe7bb884c4f70b8e66764c22c8
Author: Uwe Stöhr <[email protected]>
Date:   Wed Nov 18 02:36:49 2015 +0100

    theorems-ams: add solution environment
    
     fixes bug #6363 now completely

diff --git a/lib/layouts/theorems-ams-bytype.inc 
b/lib/layouts/theorems-ams-bytype.inc
index 9862572..be61359 100644
--- a/lib/layouts/theorems-ams-bytype.inc
+++ b/lib/layouts/theorems-ams-bytype.inc
@@ -16,6 +16,7 @@
 # - Example
 # - Problem
 # - Exercise
+# - Solution
 # - Remark
 # - Claim
 # - Case (by inclusion)
@@ -42,6 +43,8 @@ Counter problem
 End
 Counter exercise
 End
+Counter solution
+End
 Counter remark
 End
 Counter claim
@@ -264,6 +267,25 @@ Style Exercise
 End
 
 
+Style Solution
+       CopyStyle             Definition
+       LatexName             sol
+       LabelString           "Solution \thesolution."
+       Preamble
+         \theoremstyle{definition}
+         \newtheorem{sol}{\protect\solutionname}
+       EndPreamble
+       Requires              amsthm
+       LangPreamble
+               \providecommand{\solutionname}{_(Solution)}
+       EndLangPreamble
+       BabelPreamble
+               \addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}}
+       EndBabelPreamble
+       LabelCounter          solution
+End
+
+
 Style Remark
        CopyStyle             Theorem
        LatexName             rem
diff --git a/lib/layouts/theorems-ams-bytype.module 
b/lib/layouts/theorems-ams-bytype.module
index 25388a5..1f40755 100644
--- a/lib/layouts/theorems-ams-bytype.module
+++ b/lib/layouts/theorems-ams-bytype.module
@@ -38,6 +38,8 @@ Counter definition
 End
 Counter example
 End
+Counter solution
+End
 Counter problem
 End
 Counter exercise
diff --git a/lib/layouts/theorems-ams.inc b/lib/layouts/theorems-ams.inc
index 85eb2b6..55e9466 100644
--- a/lib/layouts/theorems-ams.inc
+++ b/lib/layouts/theorems-ams.inc
@@ -14,6 +14,7 @@
 # - Example
 # - Problem
 # - Exercise
+# - Solution
 # - Remark
 # - Claim
 # - Proof
@@ -232,6 +233,23 @@ Style Exercise
 End
 
 
+Style Solution
+       CopyStyle             Definition
+       LatexName             sol
+       LabelString           "Solution \thetheorem."
+       Preamble
+         \theoremstyle{definition}
+         \newtheorem{sol}[thm]{\protect\solutionname}
+       EndPreamble
+       LangPreamble
+               \providecommand{\solutionname}{_(Solution)}
+       EndLangPreamble
+       BabelPreamble
+               \addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}}
+       EndBabelPreamble
+End
+
+
 Style Remark
        CopyStyle             Theorem
        DependsOn             Theorem
diff --git a/lib/layouts/theorems-order.inc b/lib/layouts/theorems-order.inc
index 754fa7f..d44fdb5 100644
--- a/lib/layouts/theorems-order.inc
+++ b/lib/layouts/theorems-order.inc
@@ -58,6 +58,12 @@ End
 Style Exercise*
 End
 
+Style Solution
+End
+
+Style Solution*
+End
+
 Style Remark
 End
 
diff --git a/lib/layouts/theorems-refprefix.inc 
b/lib/layouts/theorems-refprefix.inc
index 6c0104f..5d453e5 100644
--- a/lib/layouts/theorems-refprefix.inc
+++ b/lib/layouts/theorems-refprefix.inc
@@ -38,6 +38,10 @@ IfStyle Exercise
        RefPrefix exer
 End
 
+IfStyle Solution
+       RefPrefix solu
+End
+
 IfStyle Remark
        RefPrefix rem
 End
diff --git a/lib/layouts/theorems-starred-equivalents.inc 
b/lib/layouts/theorems-starred-equivalents.inc
index 2e9c550..a2e6788 100644
--- a/lib/layouts/theorems-starred-equivalents.inc
+++ b/lib/layouts/theorems-starred-equivalents.inc
@@ -52,6 +52,13 @@ Style Example
        EndPreamble
 End
 
+Style Solution
+       CopyStyle       Solution*
+       DependsOn       Solution*
+       Preamble
+       EndPreamble
+End
+
 Style Problem
        CopyStyle       Problem*
        DependsOn       Problem*
diff --git a/lib/layouts/theorems-starred.inc b/lib/layouts/theorems-starred.inc
index a1d57df..6946d8c 100644
--- a/lib/layouts/theorems-starred.inc
+++ b/lib/layouts/theorems-starred.inc
@@ -14,6 +14,7 @@
 # - Example
 # - Problem
 # - Exercise
+# - Solution
 # - Remark
 # - Claim
 # - Proof
@@ -225,6 +226,23 @@ Style Exercise*
 End
 
 
+Style Solution*
+       CopyStyle             Definition*
+       LatexName             sol*
+       LabelString           "Solution."
+       Preamble
+         \theoremstyle{definition}
+         \newtheorem*{sol*}{\protect\solutionname}
+       EndPreamble
+       LangPreamble
+         \providecommand{\solutionname}{_(Solution)}
+       EndLangPreamble
+       BabelPreamble
+         \addto\captions$$lang{\renewcommand{\solutionname}{_(Solution)}}
+       EndBabelPreamble
+End
+
+
 Style Remark*
        CopyStyle             Theorem*
        LatexName             rem*
diff --git a/lib/lyx2lyx/lyx_2_2.py b/lib/lyx2lyx/lyx_2_2.py
index e041a6b..e4d5387 100644
--- a/lib/lyx2lyx/lyx_2_2.py
+++ b/lib/lyx2lyx/lyx_2_2.py
@@ -2118,7 +2118,8 @@ def revert_solution(document):
     have_mod = False
     mods = document.get_module_list()
     for mod in mods:
-        if mod == "theorems-std" or mod == "theorems-bytype":
+        if mod == "theorems-std" or mod == "theorems-bytype" \
+        or mod == "theorems-ams" or mod == "theorems-ams-bytype":
             have_mod = True
             continue
     if not have_mod:
@@ -2146,10 +2147,10 @@ def revert_solution(document):
             document.body[j : j + 1] = put_cmd_in_ert("\\end{sol}") + 
["\\end_layout"]
         document.body[i : i + 1] = ["\\begin_layout Standard", ""] + begcmd
         add_to_preamble(document, "\\providecommand{\solutionname}{Solution}")
-        if mod == "theorems-std":
+        if mod == "theorems-std" or mod == "theorems-ams":
             add_to_preamble(document, "\\theoremstyle{plain}\n" \
                                       
"\\newtheorem{sol}[thm]{\\protect\\solutionname}")
-        if mod == "theorems-bytype":
+        if mod == "theorems-bytype" or mod == "theorems-ams-bytype":
             add_to_preamble(document, "\\theoremstyle{definition}\n" \
                                       
"\\newtheorem{sol}{\\protect\\solutionname}")
         i = j

Reply via email to