diff options
author | Karl Berry <karl@freefriends.org> | 2008-11-17 01:22:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-11-17 01:22:36 +0000 |
commit | 7501fa1170fbcbcbaad8364cc865a056a9aa90c0 (patch) | |
tree | 2681f29f09177b0e38437d6d7d82dd733ee1c6b5 /Master/texmf-dist/tex/latex/easylist | |
parent | 9b28381167cbb008caf200df2868564c4d454c66 (diff) |
new package easylist (16nov08)
git-svn-id: svn://tug.org/texlive/trunk@11311 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/easylist')
-rw-r--r-- | Master/texmf-dist/tex/latex/easylist/easylist.sty | 358 |
1 files changed, 358 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/easylist/easylist.sty b/Master/texmf-dist/tex/latex/easylist/easylist.sty new file mode 100644 index 00000000000..8ee03bd1403 --- /dev/null +++ b/Master/texmf-dist/tex/latex/easylist/easylist.sty @@ -0,0 +1,358 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% easylist.sty v.1.0 by Paul Isambert %% +%% This set of macros is published under the LaTeX Project Public License: %% +%% %% +%% Do whatever you want to that software, %% +%% but if you modify it, change its name to avoid confusion, %% +%% and if you copy part of the code please mention where it comes from. %% +%% %% +%% Comments, suggestions and bugs: %% +%% %% +%% zappathustra@free.fr %% +%% %% +%% http://paulisambert.free.fr/ %% +%% %% +%% Enjoy! %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{easylist}[2008/11/16 Numbered items with a single command.] + +\RequirePackage{keyval} + +\newif\ifpilcrow +\pilcrowfalse +\newif\ifat +\atfalse +\newif\ifsharp +\sharpfalse +\newif\ifampersand +\ampersandfalse + +\DeclareOption{pilcrow}{\pilcrowtrue} +\DeclareOption{at}{\attrue} +\DeclareOption{sharp}{\sharptrue} +\DeclareOption{ampersand}{\ampersandtrue} +\ProcessOptions\relax + +\makeatletter + +\define@key{ListProperties}{Mark1}{\def\Markone{#1}} +\define@key{ListProperties}{Mark2}{\def\Marktwo{#1}} +\define@key{ListProperties}{Mark3}{\def\Markthree{#1}} +\define@key{ListProperties}{Mark4}{\def\Markfour{#1}} +\define@key{ListProperties}{Mark}{\def\Markone{#1}\def\Marktwo{#1}\def\Markthree{#1}\def\Markfour{#1}\def\FinalMark{#1}} +\define@key{ListProperties}{FinalMark}{\def\FinalMark{#1}} + +\define@key{ListProperties}{Style1}{\def\CtrStyleone{#1}\def\Styleone{#1}} +\define@key{ListProperties}{Style2}{\def\CtrStyletwo{#1}\def\Styletwo{#1}} +\define@key{ListProperties}{Style3}{\def\CtrStylethree{#1}\def\Stylethree{#1}} +\define@key{ListProperties}{Style4}{\def\CtrStylefour{#1}\def\Stylefour{#1}} +\define@key{ListProperties}{Style5}{\def\CtrStylefive{#1}\def\Stylefive{#1}} +\define@key{ListProperties}{Style}{\def\CtrStyleone{#1}\def\CtrStyletwo{#1}\def\CtrStylethree{#1}\def\CtrStylefour{#1}\def\CtrStylefive{#1}\def\Styleone{#1}\def\Styletwo{#1}\def\Stylethree{#1}\def\Stylefour{#1}\def\Stylefive{#1}} + +\define@key{ListProperties}{Style1*}{\def\CtrStyleone{#1}} +\define@key{ListProperties}{Style2*}{\def\CtrStyletwo{#1}} +\define@key{ListProperties}{Style3*}{\def\CtrStylethree{#1}} +\define@key{ListProperties}{Style4*}{\def\CtrStylefour{#1}} +\define@key{ListProperties}{Style5*}{\def\CtrStylefive{#1}} +\define@key{ListProperties}{Style*}{\def\CtrStyleone{#1}\def\CtrStyletwo{#1}\def\CtrStylethree{#1}\def\CtrStylefour{#1}\def\CtrStylefive{#1}} + +\define@key{ListProperties}{Style1**}{\def\Styleone{#1}} +\define@key{ListProperties}{Style2**}{\def\Styletwo{#1}} +\define@key{ListProperties}{Style3**}{\def\Stylethree{#1}} +\define@key{ListProperties}{Style4**}{\def\Stylefour{#1}} +\define@key{ListProperties}{Style5**}{\def\Stylefive{#1}} +\define@key{ListProperties}{Style**}{\def\Styleone{#1}\def\Styletwo{#1}\def\Stylethree{#1}\def\Stylefour{#1}\def\Stylefive{#1}} + +\define@key{ListProperties}{Margin1}{\def\@hangfromone{#1}} +\define@key{ListProperties}{Margin2}{\def\@hangfromtwo{#1}} +\define@key{ListProperties}{Margin3}{\def\@hangfromthree{#1}} +\define@key{ListProperties}{Margin4}{\def\@hangfromfour{#1}} +\define@key{ListProperties}{Margin5}{\def\@hangfromfive{#1}} +\define@key{ListProperties}{Margin}{\def\@hangfromone{#1}\def\@hangfromone{#1}\def\@hangfromtwo{#1}\def\@hangfromthree{#1}\def\@hangfromfour{#1}\def\@hangfromfive{#1}} + +\define@key{ListProperties}{Indent1}{\def\Indentone{#1}} +\define@key{ListProperties}{Indent2}{\def\Indenttwo{#1}} +\define@key{ListProperties}{Indent3}{\def\Indentthree{#1}} +\define@key{ListProperties}{Indent4}{\def\Indentfour{#1}} +\define@key{ListProperties}{Indent5}{\def\Indentfive{#1}} +\define@key{ListProperties}{Indent}{\def\Indentone{#1}\def\Indenttwo{#1}\def\Indentthree{#1}\def\Indentfour{#1}\def\Indentfive{#1}} + +\define@key{ListProperties}{Start1}{\setcounter{Listone}{#1}\addtocounter{Listone}{-1}} +\define@key{ListProperties}{Start2}{\setcounter{Listtwo}{#1}\addtocounter{Listtwo}{-1}} +\define@key{ListProperties}{Start3}{\setcounter{Listthree}{#1}\addtocounter{Listthree}{-1}} +\define@key{ListProperties}{Start4}{\setcounter{Listfour}{#1}\addtocounter{Listfour}{-1}} +\define@key{ListProperties}{Start5}{\setcounter{Listfive}{#1}\addtocounter{Listfive}{-1}} + +\define@key{ListProperties}{Numbers1}{\def\@char{#1}% + \if\@char r \def\Numbersone{\roman}% + \else\if\@char R \def\Numbersone{\Roman}% + \else\if\@char l \def\Numbersone{\alph}% + \else\if\@char L \def\Numbersone{\Alph} + \else\def\Numbersone{\arabic} + \fi + \fi + \fi + \fi} +\define@key{ListProperties}{Numbers2}{\def\@char{#1}% + \if\@char r \def\Numberstwo{\roman}% + \else\if\@char R \def\Numberstwo{\Roman}% + \else\if\@char l \def\Numberstwo{\alph}% + \else\if\@char L \def\Numberstwo{\Alph} + \else\def\Numberstwo{\arabic} + \fi + \fi + \fi + \fi} +\define@key{ListProperties}{Numbers3}{\def\@char{#1}% + \if\@char r \def\Numbersthree{\roman}% + \else\if\@char R \def\Numbersthree{\Roman}% + \else\if\@char l \def\Numbersthree{\alph}% + \else\if\@char L \def\Numbersthree{\Alph} + \else\def\Numbersthree{\arabic} + \fi + \fi + \fi + \fi} +\define@key{ListProperties}{Numbers4}{\def\@char{#1}% + \if\@char r \def\Numbersfour{\roman}% + \else\if\@char R \def\Numbersfour{\Roman}% + \else\if\@char l \def\Numbersfour{\alph}% + \else\if\@char L \def\Numbersfour{\Alph} + \else\def\Numbersfour{\arabic} + \fi + \fi + \fi + \fi} +\define@key{ListProperties}{Numbers5}{\def\@char{#1}% + \if\@char r \def\Numbersfive{\roman}% + \else\if\@char R \def\Numbersfive{\Roman}% + \else\if\@char l \def\Numbersfive{\alph}% + \else\if\@char L \def\Numbersfive{\Alph} + \else\def\Numbersfive{\arabic} + \fi + \fi + \fi + \fi} + +\define@key{ListProperties}{Numbers}{\def\@char{#1}% + \if\@char r \def\Numbersone{\roman}\def\Numberstwo{\roman}\def\Numbersthree{\roman}\def\Numbersfour{\roman}\def\Numbersfive{\roman}% + \else\if\@char R \def\Numbersone{\Roman}\def\Numberstwo{\Roman}\def\Numbersthree{\Roman}\def\Numbersfour{\Roman}\def\Numbersfive{\Roman}% + \else\if\@char l \def\Numbersone{\alph}\def\Numberstwo{\alph}\def\Numbersthree{\alph}\def\Numbersfour{\alph}\def\Numbersfive{\alph}% + \else\if\@char L \def\Numbersone{\Alph}\def\Numberstwo{\Alph}\def\Numbersthree{\Alph}\def\Numbersfour{\Alph}\def\Numbersfive{\Alph}% + \else\def\Numbersone{\arabic}\def\Numberstwo{\arabic}\def\Numbersthree{\arabic}\def\Numbersfour{\arabic}\def\Numbersfive{\arabic}% + \fi + \fi + \fi + \fi} + + +\def\ListProperties(#1){\setkeys{ListProperties}{#1}} + +\newcounter{Listone} +\newcounter{Listtwo} +\newcounter{Listthree} +\newcounter{Listfour} +\newcounter{Listfive} +\newcounter{ctrlevel} +\setcounter{ctrlevel}{1} + +\def\Markone{.} +\def\Marktwo{.} +\def\Markthree{.} +\def\Markfour{.} +\def\FinalMark{.} + +\def\NormalStyle{\normalsize\upshape\rmfamily\mdseries} + +\def\CtrStyleone{} +\def\CtrStyletwo{} +\def\CtrStylethree{} +\def\CtrStylefour{} +\def\CtrStylefive{} + +\def\Styleone{} +\def\Styletwo{} +\def\Stylethree{} +\def\Stylefour{} +\def\Stylefive{} + +\def\Numbersone{\arabic} +\def\Numberstwo{\arabic} +\def\Numbersthree{\arabic} +\def\Numbersfour{\arabic} +\def\Numbersfive{\arabic} + +\def\@hangfromone{0mm} +\def\@hangfromtwo{0mm} +\def\@hangfromthree{0mm} +\def\@hangfromfour{0mm} +\def\@hangfromfive{0mm} + +\def\Indentone{\noindent} +\def\Indenttwo{\noindent} +\def\Indentthree{\noindent} +\def\Indentfour{\noindent} +\def\Indentfive{\noindent} + +\def\ResetCounters{% +\ifnum\thectrlevel=1{\setcounter{Listtwo}{0}\setcounter{Listthree}{0}\setcounter{Listfour}{0}\setcounter{Listfive}{0}}% + \else\ifnum\thectrlevel=2{\setcounter{Listthree}{0}\setcounter{Listfour}{0}\setcounter{Listfive}{0}}% + \else\ifnum\thectrlevel=3{\setcounter{Listfour}{0}\setcounter{Listfive}{0}}% + \else\ifnum\thectrlevel=4{\setcounter{Listfive}{0}}\fi + \fi + \fi + \fi +} + +\def\StepCurrentCounter{% +\ifnum\thectrlevel=1\stepcounter{Listone}% + \else\ifnum\thectrlevel=2\stepcounter{Listtwo}% + \else\ifnum\thectrlevel=3\stepcounter{Listthree}% + \else\ifnum\thectrlevel=4\stepcounter{Listfour}% + \else\ifnum\thectrlevel=5\stepcounter{Listfive}\fi + \fi + \fi + \fi + \fi} + +\def\CounterStyle{% +\ifnum\thectrlevel=1\CtrStyleone% + \else\ifnum\thectrlevel=2\CtrStyletwo% + \else\ifnum\thectrlevel=3\CtrStylethree% + \else\ifnum\thectrlevel=4\CtrStylefour% + \else\ifnum\thectrlevel=5\CtrStylefive\fi + \fi + \fi + \fi + \fi} + +\def\Style{% +\ifnum\thectrlevel=1\Styleone% + \else\ifnum\thectrlevel=2\Styletwo% + \else\ifnum\thectrlevel=3\Stylethree% + \else\ifnum\thectrlevel=4\Stylefour% + \else\ifnum\thectrlevel=5\Stylefive\fi + \fi + \fi + \fi + \fi} + +\def\@Margin{% +\ifnum\thectrlevel=1\@hangfrom{\hskip \@hangfromone}% + \else\ifnum\thectrlevel=2\@hangfrom{\hskip \@hangfromtwo}% + \else\ifnum\thectrlevel=3\@hangfrom{\hskip \@hangfromthree}% + \else\ifnum\thectrlevel=4\@hangfrom{\hskip \@hangfromfour}% + \else\ifnum\thectrlevel=5\@hangfrom{\hskip \@hangfromfive}\fi + \fi + \fi + \fi + \fi} + +\def\@Indent{% +\ifnum\thectrlevel=1\Indentone% + \else\ifnum\thectrlevel=2\Indenttwo% + \else\ifnum\thectrlevel=3\Indentthree% + \else\ifnum\thectrlevel=4\Indentfour% + \else\ifnum\thectrlevel=5\Indentfive\fi + \fi + \fi + \fi + \fi} + +\def\PrintAllCounters{% +\ifnum\thectrlevel=1{\Numbersone{Listone}}% + \else\ifnum\thectrlevel=2{\Numbersone{Listone}\Markone\Numberstwo{Listtwo}}% + \else\ifnum\thectrlevel=3{\Numbersone{Listone}\Markone\Numberstwo{Listtwo}\Marktwo\Numbersthree{Listthree}}% + \else\ifnum\thectrlevel=4{\Numbersone{Listone}\Markone\Numberstwo{Listtwo}\Marktwo\Numbersthree{Listthree}\Markthree\Numbersfour{Listfour}}% + \else\ifnum\thectrlevel=5{\Numbersone{Listone}\Markone\Numberstwo{Listtwo}\Marktwo\Numbersthree{Listthree}\Markthree\Numbersfour{Listfour}\Markfour\Numbersfive{Listfive}}% + \fi + \fi + \fi + \fi + \fi} + +\def\NextToken{} +\def\reserved@lab{} + + +\def\IfNextSpace{% +\ifx\NextToken\@sptoken% + \ifnum\thectrlevel>5\PackageError{easylist}{Too many § -- or whatever your symbol; counting interrupted}{}\par\noindent\fbox{!!!}% + \else + \StepCurrentCounter% + \xdef\reserved@lab{\PrintAllCounters}% + \par\@Indent\ResetCounters% + \NormalStyle\@Margin{\CounterStyle\PrintAllCounters\FinalMark}\Style\fi% + \setcounter{ctrlevel}{1}% + \else\stepcounter{ctrlevel}\fi} + +\xdef\SectionCatcode{\number\catcode`§} +\xdef\PilcrowCatcode{\number\catcode`¶} +\xdef\SharpCatcode{\number\catcode`#} +\xdef\AtCatcode{\number\catcode`@} +\xdef\AmpersandCatcode{\number\catcode`&} + +\catcode`§=\active +\catcode`¶=\active +\catcode`@=\active +\catcode`#=\active +\catcode`&=\active + +\ifpilcrow% + \def\eList{% + \catcode`¶=\active% + \def¶{\futurelet\NextToken\IfNextSpace}} + \newcommand{\eListend}{\catcode`¶=\PilcrowCatcode} + \def\Activate{\catcode`¶=\active} + \def\Deactivate{\catcode`¶=\PilcrowCatcode} +\else% + \ifat + \def\eList{% + \catcode`@=\active% + \def@{\futurelet\NextToken\IfNextSpace}} + \newcommand{\eListend}{\catcode`@=\AtCatcode} + \def\Activate{\catcode`@=\active} + \def\Deactivate{\catcode`@=\AtCatcode} + \else + \ifsharp + \def\eList{% + \catcode`#=\active% + \def#{\futurelet\NextToken\IfNextSpace}} + \newcommand{\eListend}{\catcode`#=\SharpCatcode} + \def\Activate{\catcode`#=\active} + \def\Deactivate{\catcode`#=\SharpCatcode} + \else + \ifampersand + \def\eList{% + \catcode`&=\active% + \def&{\futurelet\NextToken\IfNextSpace}} + \newcommand{\eListend}{\catcode`&=\AmpersandCatcode} + \def\Activate{\catcode`&=\active} + \def\Deactivate{\catcode`&=\AmpersandCatcode} + \else + \def\eList{% + \catcode`§=\active% + \def§{\futurelet\NextToken\IfNextSpace}} + \newcommand{\eListend}{\catcode`§=\SectionCatcode} + \def\Activate{\catcode`§=\active} + \def\Deactivate{\catcode`§=\SectionCatcode} + \fi + \fi + \fi +\fi + +\catcode`&=\AmpersandCatcode +\catcode`#=\SharpCatcode +\catcode`@=\AtCatcode +\catcode`¶=\PilcrowCatcode +\catcode`§=\SectionCatcode + +\def\Llabel#1{\expandafter\xdef\csname #1\endcsname{\reserved@lab}% +\expandafter\xdef\csname page@#1\endcsname{\thepage}} +\def\Lref#1{\@nameuse{#1}} +\def\Pref#1{\@nameuse{page@#1}} + +\makeatother |