]> git.lyx.org Git - features.git/commitdiff
Repairs to case environment, from Paul Rubin. Modified by me to use
authorRichard Heck <rgheck@comcast.net>
Tue, 13 Dec 2011 19:50:36 +0000 (19:50 +0000)
committerRichard Heck <rgheck@comcast.net>
Tue, 13 Dec 2011 19:50:36 +0000 (19:50 +0000)
enumitem, since we already have a module for that, and I am a bit
worried about conflicts between enumerate.sty and enumitem.sty.

A side effect of this, however, is that we will load enumitem.sty
whenver we use case environments.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40492 a592a061-630c-0410-9148-cb99ea01b6c8

lib/Makefile.am
lib/layouts/theorems-ams-bytype.inc
lib/layouts/theorems-ams.inc
lib/layouts/theorems-bytype.inc
lib/layouts/theorems-case.inc [new file with mode: 0644]
lib/layouts/theorems.inc

index b20b62f33d8876749d713da6acdbc55c785eb4f8..ade50ffb967b54b18d88f0f63ae10d996e86986a 100644 (file)
@@ -1473,6 +1473,7 @@ dist_layouts_DATA =\
        layouts/theorems-ams-bytype.module \
        layouts/theorems-ams-extended.module \
        layouts/theorems-ams-extended-bytype.module \
+       layouts/theorems-case.inc \
        layouts/theorems-chap.module \
        layouts/theorems.inc \
        layouts/theorems-bytype.inc \
index e6af1d29f2803acc1510db299fde9b38486c8439..ab81a75ffd94448c30b43d1387c83af246b1975e 100644 (file)
@@ -5,7 +5,7 @@
 # Modularized Jan 08 by Richard Heck <rgheck@comcast.net>
 # Hacked June '09 by Paul Rubin <rubin@msu.edu> to use separate counters
 
-# The environnements defined are :
+# The environments defined are :
 # - Theorem
 # - Corollary
 # - Lemma
@@ -18,7 +18,7 @@
 # - Exercise
 # - Remark
 # - Claim
-# - Case (regular only -- defined as an enumeration)
+# - Case (by inclusion)
 
 # We need separate counters for each theorem-like style.
 Format 36
@@ -304,46 +304,4 @@ Style Claim
        LabelCounter          claim
 End
 
-
-# Define Case as an enumeration environment
-Style Case
-       Category              Theorem
-       Margin                Static
-       LatexType             Item_Environment
-       LatexName             caseenv
-       LabelType             Itemize
-       NextNoIndent          1
-       LeftMargin            "Case ###."
-       ParSkip               0.0
-       ItemSep               0.2
-       TopSep                0.7
-       BottomSep             0.7
-       ParSep                0.3
-       Align                 Block
-       AlignPossible         Block, Left
-       LabelSep              xx
-       LabelString           "Case #."
-       LabelFont
-         Series              Medium
-         Shape               Italic
-       EndFont
-       Preamble
-         \newcounter{casectr}
-         \newenvironment{caseenv}
-         {\begin{list}{{\itshape\ \protect\casename} \arabic{casectr}.}{%
-          \setlength{\leftmargin}{\labelwidth}
-          \addtolength{\leftmargin}{\parskip}
-          \setlength{\itemindent}{\listparindent}
-          \setlength{\itemsep}{\medskipamount}
-          \setlength{\topsep}{\itemsep}}
-          \setcounter{casectr}{0}
-          \usecounter{casectr}}
-         {\end{list}}
-       EndPreamble
-       LangPreamble
-         \providecommand{\casename}{_(Case)}
-       EndLangPreamble
-       BabelPreamble
-         \addto\captions$$lang{\renewcommand{\casename}{_(Case)}}
-       EndBabelPreamble
-End
+Input theorems-case.inc
index 651565a91baa2dac6b1e37f49aa1c29816cc345c..54f7a351db522259260d09ce5082524beee99b06 100644 (file)
@@ -4,7 +4,7 @@
 # Tinkered with Sep. '07 by Paul Rubin <rubin@msu.edu>
 # Modularized Jan 08 by Richard Heck <rgheck@comcast.net>
 
-# The environnements defined are :
+# The environments defined are :
 # - Theorem
 # - Corollary
 # - Lemma
@@ -17,7 +17,7 @@
 # - Remark
 # - Claim
 # - Proof
-# - Case (regular only -- defined as an enumeration)
+# - Case (by inclusion)
 
 Format 36
 
@@ -270,48 +270,5 @@ Style Claim
        EndBabelPreamble
 End
 
-
-# Define Case as an enumeration environment
-Style Case
-       Category              Theorem
-       Margin                Static
-       LatexType             Item_Environment
-       LatexName             caseenv
-       LabelType             Static
-       NextNoIndent          1
-       LeftMargin            "Case ###."
-       ParSkip               0.0
-       ItemSep               0.2
-       TopSep                0.7
-       BottomSep             0.7
-       ParSep                0.3
-       Align                 Block
-       AlignPossible         Block, Left
-       LabelSep              xx
-       LabelString           "Case #."
-       LabelFont
-         Series              Medium
-         Shape               Italic
-       EndFont
-       Preamble
-         \newcounter{casectr}
-         \newenvironment{caseenv}
-         {\begin{list}{{\itshape\ \protect\casename} \arabic{casectr}.}{%
-          \setlength{\leftmargin}{\labelwidth}
-          \addtolength{\leftmargin}{\parskip}
-          \setlength{\itemindent}{\listparindent}
-          \setlength{\itemsep}{\medskipamount}
-          \setlength{\topsep}{\itemsep}}
-          \setcounter{casectr}{0}
-          \usecounter{casectr}}
-         {\end{list}}
-       EndPreamble
-       LangPreamble
-         \providecommand{\casename}{_(Case)}
-       EndLangPreamble
-       BabelPreamble
-         \addto\captions$$lang{\renewcommand{\casename}{_(Case)}}
-       EndBabelPreamble
-End
-
+Input theorems-case.inc
 Input theorems-refprefix.inc
index 0fffbd973e71ba97e6c68cf53e4ef1361709eeca..66effc72583cb50fa2f237ed3715be9a3b748f5f 100644 (file)
@@ -5,7 +5,7 @@
 # Modularized Jan 08 by Richard Heck <rgheck@comcast.net>
 # Hacked June '09 by Paul Rubin <rubin@msu.edu> to use separate counters
 
-# The environnements defined are :
+# The environments defined are :
 # - Theorem
 # - Corollary
 # - Lemma
@@ -19,7 +19,7 @@
 # - Remark
 # - Claim
 # - Proof
-# - Case (regular only -- defined as an enumeration)
+# - Case (by inclusion)
 
 Format 36
 
@@ -280,39 +280,5 @@ Style Claim
        LabelCounter          claim
 End
 
-
-# Define Case as an enumeration environment
-Style Case
-       Category              Theorem
-       CopyStyle             Enumerate
-       LatexName             caseenv
-       LabelType             Static
-       LeftMargin            "Case ###."
-       LabelString           "Case #."
-       LabelFont
-         Series              Medium
-         Shape               Italic
-       EndFont
-       Preamble
-         \newcounter{casectr}
-         \newenvironment{caseenv}
-         {\begin{list}{{\itshape\ \protect\casename} \arabic{casectr}.}{%
-          \setlength{\leftmargin}{\labelwidth}
-          \addtolength{\leftmargin}{\parskip}
-          \setlength{\itemindent}{\listparindent}
-          \setlength{\itemsep}{\medskipamount}
-          \setlength{\topsep}{\itemsep}}
-          \setcounter{casectr}{0}
-          \usecounter{casectr}}
-         {\end{list}}
-       EndPreamble
-       LangPreamble
-               \providecommand{\casename}{_(Case)}
-       EndLangPreamble
-       BabelPreamble
-               \addto\captions$$lang{\renewcommand{\casename}{_(Case)}}
-       EndBabelPreamble
-       RefPrefix OFF
-End
-
+Input theorems-case.inc
 Input theorems-refprefix.inc
diff --git a/lib/layouts/theorems-case.inc b/lib/layouts/theorems-case.inc
new file mode 100644 (file)
index 0000000..9a29ed5
--- /dev/null
@@ -0,0 +1,57 @@
+# Original Author : Paul Rubin <rubin@msu.edu>
+# Modified by Richard Heck to use enumitem
+
+# Definition of case environment as an enumeration
+
+# Define Case as an enumeration environment
+# with its own counters
+
+Format 35
+
+Counter casei
+        LabelString "Case \arabic{casei}."
+End
+Counter caseii
+        Within casei
+        LabelString "Case \roman{caseii}."
+End
+Counter caseiii
+        Within caseii
+        LabelString "Case \alph{caseiii}."
+End
+Counter caseiv
+        Within caseiii
+        LabelString "Case \arabic{caseiv}."
+End
+
+Style Case
+  Category              Theorem
+  CopyStyle             Enumerate
+  LatexName             casenv
+  LabelType             Enumerate
+  LeftMargin            "Case ###."
+  LabelCounter          case
+  LabelFont
+    Series              Medium
+    Shape               Italic
+  EndFont
+       Requires enumitem
+       # It'd be easier to use \setlist[caseenv] here, but that causes problems
+       # if you nest an ordinary list inside a case environment. See discussion
+       # at bug #7611.
+  Preamble
+    \newlist{casenv}{enumerate}{4}
+    \setlist[casenv]{leftmargin=*,align=left,widest={iiii}}
+    \setlist[casenv,1]{label={{\itshape\ \casename} \arabic*.},ref=\arabic*}
+    \setlist[casenv,2]{label={{\itshape\ \casename} \roman*.},ref=\roman*}
+    \setlist[casenv,3]{label={{\itshape\ \casename\ \alph*.}},ref=\alph*}
+    \setlist[casenv,4]{label={{\itshape\ \casename} \arabic*.},ref=\arabic*}
+  EndPreamble
+  LangPreamble
+    \providecommand{\casename}{_(Case)}
+  EndLangPreamble
+  BabelPreamble
+    \addto\captions$$lang{\renewcommand{\casename}{_(Case)}}
+  EndBabelPreamble
+  RefPrefix OFF
+End
index bf657c985bf01a562b3bd64c98675f9d9904f1a0..6a578029c78793e159d6615d047a5e0fd54aff4d 100644 (file)
@@ -4,7 +4,7 @@
 # Tinkered with Sep. '07 by Paul Rubin <rubin@msu.edu>
 # Modularized Jan 08 by Richard Heck <rgheck@comcast.net>
 
-# The environnements defined are :
+# The environments defined are :
 # - Theorem
 # - Corollary
 # - Lemma
@@ -17,7 +17,7 @@
 # - Exercise
 # - Remark
 # - Claim
-# - Case (regular only -- defined as an enumeration)
+# - Case (by inclusion)
 
 Format 36
 
@@ -270,39 +270,5 @@ Style Claim
        EndBabelPreamble
 End
 
-
-# Define Case as an enumeration environment
-Style Case
-       Category              Theorem
-       CopyStyle             Enumerate
-       LatexName             caseenv
-       LabelType             Static
-       LeftMargin            "Case ###."
-       LabelString           "Case #."
-       LabelFont
-         Series              Medium
-         Shape               Italic
-       EndFont
-       Preamble
-               \newcounter{casectr}
-               \newenvironment{caseenv}
-               {\begin{list}{{\itshape\ \protect\casename} \arabic{casectr}.}{%
-               \setlength{\leftmargin}{\labelwidth}
-               \addtolength{\leftmargin}{\parskip}
-               \setlength{\itemindent}{\listparindent}
-               \setlength{\itemsep}{\medskipamount}
-               \setlength{\topsep}{\itemsep}}
-               \setcounter{casectr}{0}
-               \usecounter{casectr}}
-               {\end{list}}
-       EndPreamble
-       LangPreamble
-               \providecommand{\casename}{_(Case)}
-       EndLangPreamble
-       BabelPreamble
-               \addto\captions$$lang{\renewcommand{\casename}{_(Case)}}
-       EndBabelPreamble
-       RefPrefix OFF
-End
-
+Input theorems-case.inc
 Input theorems-refprefix.inc