Repairs to case environment, from Paul Rubin. Modified by me to use

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
This commit is contained in:
Richard Heck 2011-12-13 19:50:36 +00:00
parent 9b8773826c
commit 4663e5ec88
6 changed files with 70 additions and 165 deletions

View File

@ -1473,6 +1473,7 @@ dist_layouts_DATA =\
layouts/theorems-ams-bytype.module \ layouts/theorems-ams-bytype.module \
layouts/theorems-ams-extended.module \ layouts/theorems-ams-extended.module \
layouts/theorems-ams-extended-bytype.module \ layouts/theorems-ams-extended-bytype.module \
layouts/theorems-case.inc \
layouts/theorems-chap.module \ layouts/theorems-chap.module \
layouts/theorems.inc \ layouts/theorems.inc \
layouts/theorems-bytype.inc \ layouts/theorems-bytype.inc \

View File

@ -5,7 +5,7 @@
# Modularized Jan 08 by Richard Heck <rgheck@comcast.net> # Modularized Jan 08 by Richard Heck <rgheck@comcast.net>
# Hacked June '09 by Paul Rubin <rubin@msu.edu> to use separate counters # Hacked June '09 by Paul Rubin <rubin@msu.edu> to use separate counters
# The environnements defined are : # The environments defined are :
# - Theorem # - Theorem
# - Corollary # - Corollary
# - Lemma # - Lemma
@ -18,7 +18,7 @@
# - Exercise # - Exercise
# - Remark # - Remark
# - Claim # - Claim
# - Case (regular only -- defined as an enumeration) # - Case (by inclusion)
# We need separate counters for each theorem-like style. # We need separate counters for each theorem-like style.
Format 36 Format 36
@ -304,46 +304,4 @@ Style Claim
LabelCounter claim LabelCounter claim
End End
Input theorems-case.inc
# 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

View File

@ -4,7 +4,7 @@
# Tinkered with Sep. '07 by Paul Rubin <rubin@msu.edu> # Tinkered with Sep. '07 by Paul Rubin <rubin@msu.edu>
# Modularized Jan 08 by Richard Heck <rgheck@comcast.net> # Modularized Jan 08 by Richard Heck <rgheck@comcast.net>
# The environnements defined are : # The environments defined are :
# - Theorem # - Theorem
# - Corollary # - Corollary
# - Lemma # - Lemma
@ -17,7 +17,7 @@
# - Remark # - Remark
# - Claim # - Claim
# - Proof # - Proof
# - Case (regular only -- defined as an enumeration) # - Case (by inclusion)
Format 36 Format 36
@ -270,48 +270,5 @@ Style Claim
EndBabelPreamble EndBabelPreamble
End End
Input theorems-case.inc
# 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-refprefix.inc Input theorems-refprefix.inc

View File

@ -5,7 +5,7 @@
# Modularized Jan 08 by Richard Heck <rgheck@comcast.net> # Modularized Jan 08 by Richard Heck <rgheck@comcast.net>
# Hacked June '09 by Paul Rubin <rubin@msu.edu> to use separate counters # Hacked June '09 by Paul Rubin <rubin@msu.edu> to use separate counters
# The environnements defined are : # The environments defined are :
# - Theorem # - Theorem
# - Corollary # - Corollary
# - Lemma # - Lemma
@ -19,7 +19,7 @@
# - Remark # - Remark
# - Claim # - Claim
# - Proof # - Proof
# - Case (regular only -- defined as an enumeration) # - Case (by inclusion)
Format 36 Format 36
@ -280,39 +280,5 @@ Style Claim
LabelCounter claim LabelCounter claim
End End
Input theorems-case.inc
# 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-refprefix.inc Input theorems-refprefix.inc

View File

@ -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

View File

@ -4,7 +4,7 @@
# Tinkered with Sep. '07 by Paul Rubin <rubin@msu.edu> # Tinkered with Sep. '07 by Paul Rubin <rubin@msu.edu>
# Modularized Jan 08 by Richard Heck <rgheck@comcast.net> # Modularized Jan 08 by Richard Heck <rgheck@comcast.net>
# The environnements defined are : # The environments defined are :
# - Theorem # - Theorem
# - Corollary # - Corollary
# - Lemma # - Lemma
@ -17,7 +17,7 @@
# - Exercise # - Exercise
# - Remark # - Remark
# - Claim # - Claim
# - Case (regular only -- defined as an enumeration) # - Case (by inclusion)
Format 36 Format 36
@ -270,39 +270,5 @@ Style Claim
EndBabelPreamble EndBabelPreamble
End End
Input theorems-case.inc
# 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-refprefix.inc Input theorems-refprefix.inc