]> git.lyx.org Git - lyx.git/commitdiff
theorems-ams: add solution environment
authorUwe Stöhr <uwestoehr@lyx.org>
Wed, 18 Nov 2015 01:36:49 +0000 (02:36 +0100)
committerUwe Stöhr <uwestoehr@lyx.org>
Wed, 18 Nov 2015 01:36:49 +0000 (02:36 +0100)
 fixes bug #6363 now completely

lib/layouts/theorems-ams-bytype.inc
lib/layouts/theorems-ams-bytype.module
lib/layouts/theorems-ams.inc
lib/layouts/theorems-order.inc
lib/layouts/theorems-refprefix.inc
lib/layouts/theorems-starred-equivalents.inc
lib/layouts/theorems-starred.inc
lib/lyx2lyx/lyx_2_2.py

index 986257216b536a0c36011725fd17508e5906308f..be61359dc0c3e332348c830b92ce10d49c2369b9 100644 (file)
@@ -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
index 25388a5a43c6eb1fb13c41b4a7f41b8e7b6b86c5..1f407555d4ace4af2833dc4b9c4594dad5a7d9d6 100644 (file)
@@ -38,6 +38,8 @@ Counter definition
 End
 Counter example
 End
+Counter solution
+End
 Counter problem
 End
 Counter exercise
index 85eb2b6c4659a931820c391bcee9ef1d5925a4be..55e946671ff98f3aa240d151e019d6c29fd2232d 100644 (file)
@@ -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
index 754fa7f4dc8551a68e79ae485844108240f85310..d44fdb5811a3609925a21b5620d8a28ad706ee55 100644 (file)
@@ -58,6 +58,12 @@ End
 Style Exercise*
 End
 
+Style Solution
+End
+
+Style Solution*
+End
+
 Style Remark
 End
 
index 6c0104fed22f873f8ce50e7fc6814793da84158a..5d453e51bb24a0718e6447930281cb0b32fed948 100644 (file)
@@ -38,6 +38,10 @@ IfStyle Exercise
        RefPrefix exer
 End
 
+IfStyle Solution
+       RefPrefix solu
+End
+
 IfStyle Remark
        RefPrefix rem
 End
index 2e9c550324f5c7217856815eca8b68a426ce4e9a..a2e6788a045d9aa08a2586971406d1fb32d4eab5 100644 (file)
@@ -52,6 +52,13 @@ Style Example
        EndPreamble
 End
 
+Style Solution
+       CopyStyle       Solution*
+       DependsOn       Solution*
+       Preamble
+       EndPreamble
+End
+
 Style Problem
        CopyStyle       Problem*
        DependsOn       Problem*
index a1d57df08ca53f2218c8f7e6762de81299aad448..6946d8c356842416bf9ba2c9f26dc1ad55f805c3 100644 (file)
@@ -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*
index e041a6bfd91ca35092a9b45ac12da4dda85ee7f2..e4d5387d661d4b7322070a16a5689c38d6bebbb5 100644 (file)
@@ -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