Skip to content

Instantly share code, notes, and snippets.

@Rovanion
Last active December 23, 2015 04:58
Show Gist options
  • Save Rovanion/6583499 to your computer and use it in GitHub Desktop.
Save Rovanion/6583499 to your computer and use it in GitHub Desktop.
Small fix for easylist
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% easylist.sty v.1.3 by Paul Isambert %%
%% See the documentation for a comment on the implementation. %%
%% %%
%% This set of macros is published under the LaTeX Project Public License. %%
%% %%
%% Comments, suggestions and bugs: %%
%% %%
%% [email protected] %%
%% %%
%% http://paulisambert.free.fr/ %%
%% %%
%% Enjoy! %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{easylist}[2010/02/28 v.1.3 Numbered items with a single command.]
\makeatletter
\newif\ifPilcrow
\newif\ifAt
\newif\ifSharp
\newif\ifAmpersand
\newif\ifDubiousFigure
\newcount\el@CounterTotal
\el@CounterTotal10
\newcount\el@Scratch
\def\el@Advance#1{\advance#1 by 1\relax}
\def\el@NumberCheck#1{%
\expandafter\if#1?%
\el@Scratch0
\def\e@synext##1{\relax}%
\else
\ifnum\el@Scratch=10
\el@Scratch0
\def\e@synext##1?{\relax}%
\DubiousFiguretrue
\else
\expandafter\if#1\the\el@Scratch
\el@Scratch0
\def\e@synext##1{\el@NumberCheck}%
\else
\el@Advance\el@Scratch
\let\e@synext\el@NumberCheck
\fi
\fi
\fi\e@synext{#1}}
\DeclareOption{pilcrow}{\Pilcrowtrue}
\DeclareOption{at}{\Attrue}
\DeclareOption{sharp}{\Sharptrue}
\DeclareOption{ampersand}{\Ampersandtrue}
\DeclareOption*{%
\expandafter\el@NumberCheck\CurrentOption?%
\ifDubiousFigure
\PackageError{easylist}{%
^^J==> `\CurrentOption' is not a valid number (in package options).
^^J==> It is ignored and there are only 10 counters}{}%
\else
\el@CounterTotal\CurrentOption
\fi\DubiousFigurefalse}
\ProcessOptions\relax
\newcount\el@ControlCounter
\el@ControlCounter1
\newcount\el@CounterLevel
\el@CounterLevel1
\def\el@GenericCounter{%
\ifnum\el@ControlCounter>\el@CounterTotal
\el@ControlCounter1
\else
\newcounter{List\the\el@ControlCounter}%
\el@Advance\el@ControlCounter
\expandafter\el@GenericCounter
\fi}
\el@GenericCounter
\newcommand{\el@GenericDef}[3][]{%
\ifnum\el@ControlCounter>\el@CounterTotal
\def\easynext[##1]##2##3{\relax}%
\el@ControlCounter1
\else
\expandafter\gdef\csname #2\the\el@ControlCounter#1\endcsname{#3}%
\el@Advance\el@ControlCounter
\let\easynext\el@GenericDef
\fi
\easynext[#1]{#2}{#3}}
\def\el@PreviousItem{0}
\el@GenericDef{FinalMark}{NA}
\el@GenericDef{Mark}{.}
\el@GenericDef{Margin}{0cm}
\el@GenericDef{Numbers}{a}
\el@GenericDef{Style}{}
\el@GenericDef[*]{Style}{}
\el@GenericDef[**]{Style}{}
\el@GenericDef{Indent}{0cm}
\el@GenericDef{Start}{NA}
\el@GenericDef[*]{Start}{NA}
\el@GenericDef{CtrCom}{}
\el@GenericDef{Space}{0cm}
\el@GenericDef[*]{Space}{0cm}
\el@GenericDef{Hide}{0}
\el@GenericDef{Hang}{false}
\el@GenericDef{FinalSpace}{.3em}
\el@GenericDef{Align}{false}
\newif\ifProgressiveStar
\newdimen\el@ProgressiveDimension
\def\el@ProgressiveMargin{%
\@ifstar
{\ProgressiveStartrue\el@ProgressiveM@rgin}%
{\ProgressiveStarfalse\el@ProgressiveM@rgin}}
\def\el@ProgressiveM@rgin#1{%
\ifnum\el@ControlCounter>\el@CounterTotal
\def\easynext##1{\relax}%
\el@ControlCounter1
\else
\el@ProgressiveDimension#1%
\multiply\el@ProgressiveDimension by \el@ControlCounter
\ifProgressiveStar
\advance\el@ProgressiveDimension by -#1%
\fi
\expandafter\xdef\csname Margin\the\el@ControlCounter\endcsname{%
\the\el@ProgressiveDimension}%
\el@Advance\el@ControlCounter
\let\easynext\el@ProgressiveM@rgin
\fi
\easynext{#1}}
\def\ListProperties(#1){%
\el@ListProperties A=A,#1,Z=Z,%
\el@GenericNumberCheck{Hide}%
\el@GenericNumberCheck{Start}%
\el@GenericNumberCheck[*]{Start}%
\el@GenericLetterCheck
\el@GenericUnitSearch{Margin}%
\el@GenericUnitSearch{Indent}%
\el@GenericUnitSearch{Space}%
\el@GenericUnitSearch[*]{Space}%
\el@GenericUnitSearch{FinalSpace}}
\def\NewList{%
\@ifnextchar(%
{\el@NewList\ListProperties}%
{\el@NewList}}
\def\el@NewList{%
\el@ControlCounter0
\el@ResetCounters
\gdef\el@PreviousItem{0}%
\el@GenericDef{FinalSpace}{.3em}
\el@GenericDef{FinalMark}{NA}%
\el@GenericDef{Mark}{.}%
\el@GenericDef{Margin}{0cm}%
\el@GenericDef{Numbers}{a}%
\el@GenericDef{Style}{}%
\el@GenericDef[*]{Style}{}%
\el@GenericDef[**]{Style}{}%
\el@GenericDef{Indent}{0cm}%
\el@GenericDef{Start}{NA}%
\el@GenericDef[*]{Start}{NA}%
\el@GenericDef{CtrCom}{}%
\el@GenericDef{Space}{0cm}
\el@GenericDef[*]{Space}{0cm}%
\el@GenericDef{Hide}{0}%
\el@GenericDef{Hang}{false}%
\el@GenericDef{Align}{false}}
\def\el@MarginTest{Margin}
\def\el@MarkTest{Mark}
\def\el@FinalMarkTest{FinalMark}
\def\el@NumbersTest{Numbers}
\def\el@IndentTest{Indent}
\def\el@StyleTest{Style}
\def\el@CtrStyleTest{Style*}
\def\el@ParStyleTest{Style**}
\def\el@CounterCommandTest{CtrCom}
\def\el@ProgressiveTest{Progressive}
\def\el@ProgressiveStarTest{Progressive*}
\def\el@StartTest{Start}
\def\el@StartStarTest{Start*}
\def\el@SpaceTest{Space}
\def\el@SpaceStarTest{Space*}
\def\el@HideTest{Hide}
\def\el@HangTest{Hang}
\def\el@FinalSpaceTest{FinalSpace}
\def\el@AlignTest{Align}
\def\el@True{true}
\def\el@False{false}
\def\el@Fixed{fixed}
\def\el@AlreadyFixed{alreadyfixed}
\def\el@Move{move}
\def\el@AlreadyMoved{alreadymoved}
\newcommand{\el@Error}[4][]{%
\PackageError{easylist}{^^J==> `#3' is not a valid #4 (#2=#3). It is ignored#1}{}}
\def\el@DimenError#1#2{%
\el@Error[.^^J==> Note that true TeX dimensions should be prefixed with%
^^J==> \string\the\space in \string\ListProperties]{#1}{#2}{dimension}}
\def\el@ListProperties#1=#2,{%
\DubiousFigurefalse
\DubiousLetterfalse
\DubiousNumberfalse
\DubiousParameterfalse
\Pointfalse
\Signfalse
\def\el@Parameter{}%
\def\el@ParameterNumber{}%
\let\easynext@Properties\el@ListProperties
\def\el@TempParameter{#1}%
\def\el@TempValue{#2}%
\if#1Z%
\let\easynext@Properties\relax
\else\if#1A%
\else\ifx\el@TempParameter\el@MarginTest
\expandafter\el@UnitSearch#2?
\ifDubiousFigure
\el@DimenError{#1}{#2}%
\else
\el@GenericDef{Margin}{#2}%
\fi
\else\ifx\el@TempParameter\el@ProgressiveTest
\expandafter\el@UnitSearch#2?%
\ifDubiousFigure
\el@DimenError{#1}{#2}%
\else
\el@ProgressiveMargin{#2}%
\fi
\else\ifx\el@TempParameter\el@ProgressiveStarTest
\expandafter\el@UnitSearch#2?%
\ifDubiousFigure
\el@DimenError{#1}{#2}%
\else
\el@ProgressiveMargin*{#2}%
\fi
\else\ifx\el@TempParameter\el@IndentTest
\expandafter\el@UnitSearch#2?%
\ifDubiousFigure
\el@DimenError{#1}{#2}%
\else
\el@GenericDef{Indent}{#2}%
\fi
\else\ifx\el@TempParameter\el@SpaceTest
\expandafter\el@UnitSearch#2?%
\ifDubiousFigure
\el@DimenError{#1}{#2}%
\else
\el@GenericDef{Space}{#2}%
\fi
\else\ifx\el@TempParameter\el@SpaceStarTest
\expandafter\el@UnitSearch#2?%
\ifDubiousFigure
\el@DimenError{#1}{#2}%
\else
\el@GenericDef[*]{Space}{#2}%
\fi
\else\ifx\el@TempParameter\el@FinalSpaceTest
\expandafter\el@UnitSearch#2?%
\ifDubiousFigure
\el@DimenError{#1}{#2}%
\else
\el@GenericDef{FinalSpace}{#2}%
\fi
\else\ifx\el@TempParameter\el@HideTest
\expandafter\el@NumberCheck#2?%
\ifDubiousFigure
\el@Error{#1}{#2}{number}%
\else
\el@GenericDef{Hide}{#2}%
\fi
\else\ifx\el@TempParameter\el@NumbersTest
\el@LetterCheck{#2}%
\ifDubiousLetter
\el@Error
{#1}{#2}{number denotation}%
\else
\el@GenericDef{Numbers}{#2}%
\fi
\else\ifx\el@TempParameter\el@AlignTest
\ifx\el@TempValue\el@Fixed
\el@GenericDef{Align}{fixed}%
\else\ifx\el@TempValue\el@Move
\el@GenericDef{Align}{move}%
\else\ifx\el@TempValue\el@False
\else
\expandafter\el@UnitSearch\el@TempValue?%
\ifDubiousFigure
\el@Error
[.^^J==> Admissible values are `false', `fixed', `move' or a dimension]%
{#1}{#2}{value for `Align'}%
\DubiousFigurefalse
\else
\el@GenericDef{Align}{#2}%
\fi
\fi\fi\fi
\else\ifx\el@TempParameter\el@HangTest
\ifx\el@TempValue\el@True
\el@GenericDef{Hang}{true}%
\else\ifx\el@TempValue\el@False
\el@GenericDef{Hang}{false}%
\else
\el@Error
[.^^J==> Admissible values are `true' or `false']%
{#1}{#2}{value for `Hang'}%
\fi\fi
\else\ifx\el@TempParameter\el@StartTest
\PackageError{easylist}%
{^^J==> `Start' can't be used without a number, so it is ignored}{}%
\else\ifx\el@TempParameter\el@StartStarTest
\PackageError{easylist}%
{^^J==> `Start*' can't be used without a number, so it is ignored}{}%
\else\ifx\el@TempParameter\el@MarkTest
\el@GenericDef{Mark}{#2}%
\else\ifx\el@TempParameter\el@FinalMarkTest
\el@GenericDef{FinalMark}{#2}%
\else\ifx\el@TempParameter\el@StyleTest
\el@GenericDef{Style}{#2}%
\else\ifx\el@TempParameter\el@CtrStyleTest
\el@GenericDef[*]{Style}{#2}%
\else\ifx\el@TempParameter\el@ParStyleTest
\el@GenericDef[**]{Style}{#2}%
\else\ifx\el@TempParameter\el@CounterCommandTest
\el@GenericDef{CtrCom}{#2}%
\else\expandafter\ifx\csname #1\endcsname\relax
\el@DubiousParameter#1?%
\ifDubiousParameter
\ifDubiousNumber
\PackageError{easylist}{^^J==> `#1' is not a valid parameter. It is ignored.%
^^J==> Besides, you don't have \el@ParameterNumber\space counters}{}%
\else
\PackageError{easylist}{^^J==> `#1' is not a valid parameter. It is ignored}{}%
\fi
\else
\ifDubiousNumber
\PackageError{easylist}{^^J==> You don't have \el@ParameterNumber\space
counters, so `#1' is ignored.%
^^J==> Ask for more of them}{}%
\else
\PackageError{easylist}{^^J==> Something is wrong with `#1' but I don't know what.%
^^J==> Maybe you put stars before numbers or you specified a number%
^^J==> to Progressive. Anyway, it is ignored}{}%
\fi
\fi
\else
\expandafter\gdef\csname #1\endcsname{#2}%
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\el@CommaKiller}
\def\el@Comm@Killer#1{\el@CommaKiller}
\def\el@CommaKiller{\@ifnextchar,{\el@Comm@Killer}{\easynext@Properties}}
\newif\ifDubiousLetter
\newif\ifDubiousParameter
\newif\ifDubiousNumber
\newif\ifPoint
\newif\ifSign
\def\el@Parameter{}
\def\el@ParameterNumber{}
\def\el@Void{}
\def\el@DubiousParameter#1{%
\let\el@P@rameter\el@Parameter
\let\el@P@rameterNumber\el@ParameterNumber
\DubiousFigurefalse
\if#1?%
\def\easynext{\el@ParameterNumberTest\el@ParameterTest}%
\else
\let\easynext\el@DubiousParameter
\ifcat#1a%
\edef\el@Parameter{\el@P@rameter#1}%
\else
\el@ParameterTest
\if#1*
\edef\el@Parameter{\el@P@rameter#1}%
\else
\el@NumberCheck#1?
\ifDubiousFigure
\DubiousParametertrue
\else
\edef\el@ParameterNumber{\el@P@rameterNumber#1}%
\fi
\fi
\fi
\fi\easynext}
\def\el@ParameterTest{%
\ifx\el@Parameter\el@MarginTest
\else\ifx\el@Parameter\el@MarkTest
\else\ifx\el@Parameter\el@FinalMarkTest
\else\ifx\el@Parameter\el@NumbersTest
\else\ifx\el@Parameter\el@IndentTest
\else\ifx\el@Parameter\el@StyleTest
\else\ifx\el@Parameter\el@CtrStyleTest
\else\ifx\el@Parameter\el@ParStyleTest
\else\ifx\el@Parameter\el@CounterCommandTest
\else\ifx\el@Parameter\el@ProgressiveTest
\DubiousNumberfalse
\else\ifx\el@Parameter\el@ProgressiveStarTest
\DubiousNumberfalse
\else\ifx\el@Parameter\el@StartTest
\else\ifx\el@Parameter\el@StartStarTest
\else\ifx\el@Parameter\el@HideTest
\else\ifx\el@Parameter\el@SpaceTest
\else\ifx\el@Parameter\el@SpaceStarTest
\else\ifx\el@Parameter\el@HangTest
\else\ifx\el@Parameter\el@FinalSpaceTest
\else\ifx\el@Parameter\el@AlignTest
\else\DubiousParametertrue
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
\def\el@ParameterNumberTest{%
\ifx\el@ParameterNumber\el@Void
\else
\ifnum\el@ParameterNumber>\el@CounterTotal
\DubiousNumbertrue
\fi
\fi}
\def\el@UnitSearch#1{%
\let\easynext\el@UnitSearch
\if#1-%
\ifSign
\DubiousFiguretrue
\def\easynext##1?{\relax}%
\else
\Signtrue
\fi
\else
\if#1+%
\ifSign
\DubiousFiguretrue
\def\easynext##1?{\relax}%
\else
\Signtrue
\fi
\else
\Signtrue
\if#1?%
\DubiousFiguretrue
\let\easynext\relax
\else
\if#1.%
\ifPoint
\DubiousFiguretrue
\def\easynext##1?{\relax}%
\else
\Pointtrue
\fi
\else
\if#1,%
\ifPoint
\DubiousFiguretrue
\def\easynext##1?{\relax}%
\else
\Pointtrue
\fi
\else
\ifcat#1a%
\def\easynext{\el@UnitCheck#1}%
\else
\el@NumberCheck#1?%
\ifDubiousFigure
\def\easynext{\el@DimenUnitCheck#1}%
\fi
\fi
\fi
\fi
\fi
\fi
\fi\easynext}
\def\el@Em{em}
\def\el@Ex{ex}
\def\el@Centimetre{cm}
\def\el@Millimetre{mm}
\def\el@Inch{in}
\def\el@Pica{pc}
\def\el@Point{pt}
\def\el@Didot{dd}
\def\el@Cicero{cc}
\def\el@BigPoint{bp}
\def\el@ScaledPoint{sp}
\def\el@UnitCheck#1?{%
\def\el@TempUnit{#1}%
\ifx\el@TempUnit\el@Em
\else\ifx\el@TempUnit\el@Ex
\else\ifx\el@TempUnit\el@Centimetre
\else\ifx\el@TempUnit\el@Millimetre
\else\ifx\el@TempUnit\el@Inch
\else\ifx\el@TempUnit\el@Pica
\else\ifx\el@TempUnit\el@Point
\else\ifx\el@TempUnit\el@Didot
\else\ifx\el@TempUnit\el@Cicero
\else\ifx\el@TempUnit\el@BigPoint
\else\ifx\el@TempUnit\el@ScaledPoint
\else\DubiousFiguretrue\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
\def\el@DimenUnitCheck#1#2?{%
\if#1p%
\if#2t%
\DubiousFigurefalse
\fi
\fi}
\newcommand{\el@GenericUnitSearch}[2][]{%
\Pointfalse
\Signfalse
\ifnum\el@ControlCounter>\el@CounterTotal
\el@ControlCounter1
\def\easynext[##1]##2{\relax}%
\else
\edef\el@TempTestable{\csname #2\the\el@ControlCounter#1\endcsname}%
\expandafter\el@UnitSearch\el@TempTestable?%
\ifDubiousFigure
\def\el@Name{#2}%
\ifx\el@Name\el@FinalSpace
\el@Error[^^J==> and #2\the\el@ControlCounter#1\space is set to .3em.%
^^J==> Note that true TeX dimensions should be prefixed with%
^^J==> \string\the\space in \string\ListProperties]%
{#2\the\el@ControlCounter#1}{\el@TempTestable}{dimension}%
\expandafter\gdef\csname #2\the\el@ControlCounter#1\endcsname{.3em}%
\else
\el@Error[^^J==> and #2\the\el@ControlCounter#1\space is set to 0cm.%
^^J==> Note that true TeX dimensions should be prefixed with%
^^J==> \string\the\space in \string\ListProperties]%
{#2\the\el@ControlCounter#1}{\el@TempTestable}{dimension}%
\expandafter\gdef\csname #2\the\el@ControlCounter#1\endcsname{0cm}%
\fi
\fi
\DubiousFigurefalse
\el@Advance\el@ControlCounter
\let\easynext\el@GenericUnitSearch
\fi\easynext[#1]{#2}}%
\def\el@LetterCheck#1{%
\if#1a%
\else\if#1r%
\else\if#1R%
\else\if#1l%
\else\if#1L%
\else\if#1z%
\else\DubiousLettertrue
\fi\fi\fi\fi\fi\fi}
\def\el@GenericLetterCheck{%
\ifnum\el@ControlCounter>\el@CounterTotal
\el@ControlCounter1
\def\easynext{\relax}%
\else
\edef\el@TempTestable{\csname Numbers\the\el@ControlCounter\endcsname}%
\expandafter\el@LetterCheck\el@TempTestable
\ifDubiousLetter
\PackageError{easylist}%
{^^J==> `\el@TempTestable' is not a valid number denotation %
(Numbers\the\el@ControlCounter=\el@TempTestable).%
^^J==> It is ignored and those numbers will be arabic numbers}{}%
\expandafter\gdef\csname Numbers\the\el@ControlCounter\endcsname{a}%
\fi
\DubiousLetterfalse
\el@Advance\el@ControlCounter
\let\easynext\el@GenericLetterCheck
\fi\easynext}%
\newcommand{\el@GenericNumberCheck}[2][]{%
\ifnum\el@ControlCounter>\el@CounterTotal
\el@ControlCounter1
\def\easynext[##1]##2{\relax}%
\else
\edef\el@TempTestable{\csname #2\the\el@ControlCounter#1\endcsname}%
\ifx\el@TempTestable\el@NA
\else
\expandafter\el@NumberCheck\el@TempTestable?%
\ifDubiousFigure
\def\el@Name{#2}%
\ifx\el@Name\el@HideTest
\el@Error[^^J==> and no counter will be hidden for items of level \the\el@ControlCounter]%
{#2\the\el@ControlCounter#1}{\el@TempTestable}{number}%
\expandafter\gdef\csname #2\the\el@ControlCounter#1\endcsname{0}%
\else
\if#1*%
\el@Error[^^J==> and this counter will continue its progression]%
{#2\the\el@ControlCounter#1}{\el@TempTestable}{counter}%
\else
\el@Error[^^J==> and this counter will continue its progression]%
{#2\the\el@ControlCounter#1}{\el@TempTestable}{number}%
\fi
\expandafter\gdef\csname #2\the\el@ControlCounter#1\endcsname{NA}%
\fi
\fi
\fi
\DubiousFigurefalse
\el@Advance\el@ControlCounter
\let\easynext\el@GenericNumberCheck
\fi\easynext[#1]{#2}}%
\def\el@ResetCounters{%
\el@Scratch\el@ControlCounter
\el@Advance\el@Scratch
\el@@ResetCounters}
\def\el@@ResetCounters{%
\ifnum\el@Scratch>\el@CounterTotal
\let\easynext\relax
\el@Scratch0
\else
\setcounter{List\the\el@Scratch}{0}%
\ifnum\el@ControlCounter=\el@CounterLevel
\expandafter\gdef\csname Start\the\el@Scratch\endcsname{NA}%
\fi
\el@Advance\el@Scratch
\let\easynext\el@@ResetCounters
\fi\easynext}
\def\el@ItemCounter{}
\def\el@NA{NA}
\font\el@ZapfDingbats=pzdr
\expandafter\def\csname el@NumberDenotation:a\endcsname{\arabic}%
\expandafter\def\csname el@NumberDenotation:l\endcsname{\alph}%
\expandafter\def\csname el@NumberDenotation:L\endcsname{\Alph}%
\expandafter\def\csname el@NumberDenotation:r\endcsname{\roman}%
\expandafter\def\csname el@NumberDenotation:R\endcsname{\Roman}%
\expandafter\def\csname el@NumberDenotation:z\endcsname{\el@ZapfDingbats\arabic}%
\def\el@PrintCounters{%
\ifnum\el@ControlCounter<\el@CounterLevel
\expandafter\ifx\csname Start\the\el@ControlCounter*\endcsname\el@NA
\expandafter\ifx\csname Start\the\el@ControlCounter\endcsname\el@NA
\else
\setcounter{List\the\el@ControlCounter}{\csname Start\the\el@ControlCounter\endcsname}%
\expandafter\gdef\csname Start\the\el@ControlCounter\endcsname{NA}%
\el@ResetCounters
\fi
\else
\expandafter\ifnum\csname theList\the\el@ControlCounter\endcsname=%
\csname Start\the\el@ControlCounter*\endcsname
\else
\el@ResetCounters
\fi
\setcounter{List\the\el@ControlCounter}{\csname Start\the\el@ControlCounter*\endcsname}%
\fi
\ifnum\el@ControlCounter>\csname Hide\the\el@CounterLevel\endcsname
\xdef\el@ItemCounter{\el@ItemCounter
\bgroup
\csname el@NumberDenotation:\csname Numbers\the\el@ControlCounter\endcsname\endcsname{List\the\el@ControlCounter}%
\egroup
\csname Mark\the\el@ControlCounter\endcsname}%
\fi
\el@Advance\el@ControlCounter
\let\easynext\el@PrintCounters
\else
\stepcounter{List\the\el@CounterLevel}%
\el@ResetCounters
\expandafter\ifx\csname Start\the\el@ControlCounter*\endcsname\el@NA
\expandafter\ifx\csname Start\the\el@ControlCounter\endcsname\el@NA
\else
\setcounter{List\the\el@ControlCounter}{\csname Start\the\el@ControlCounter\endcsname}%
\expandafter\gdef\csname Start\the\el@ControlCounter\endcsname{NA}%
\fi
\else
\setcounter{List\the\el@ControlCounter}{\csname Start\the\el@ControlCounter*\endcsname}%
\fi
\ifnum\el@ControlCounter>\csname Hide\the\el@CounterLevel\endcsname
\xdef\el@ItemCounter{\el@ItemCounter
\bgroup
\csname el@NumberDenotation:\csname Numbers\the\el@ControlCounter\endcsname\endcsname{List\the\el@ControlCounter}%
\egroup
\expandafter\ifx\csname FinalMark\the\el@ControlCounter\endcsname\el@NA
\csname Mark\the\el@ControlCounter\endcsname
\else
\csname FinalMark\the\el@ControlCounter\endcsname
\fi}%
\fi
\el@ControlCounter1
\let\easynext\relax
\fi
\easynext}
\newbox\el@CounterBox
\newbox\el@ControlBox
\newdimen\el@TotalMargin
\newdimen\el@LeftMove
{\def\:{\global\let\el@Space= }\: }
\catcode`#=12
\def\elCreateItem{%
\ifx\elNextToken\el@Space
\global\el@LeftMove=0pt%
\endgroup
\ifnum\el@CounterLevel>\el@CounterTotal
\PackageError{easylist}{^^J==> Too many %
\ifAmpersand&\else\ifAt @\else\ifPilcrow^^b6\else\ifSharp#\else^^a7\fi\fi\fi\fi's.%
^^J==> You can't use more than \the\el@CounterTotal\space
\ifAmpersand&\else\ifAt @\else\ifPilcrow^^b6\else\ifSharp#\else^^a7\fi\fi\fi\fi's%
^^J==> unless you specify it when calling the package}{}
\par\noindent\fbox{!!!}\begingroup
\else
\par
\expandafter\ifnum\el@PreviousItem=0%
\else
\expandafter\ifnum\el@PreviousItem=\el@CounterLevel
\vskip\csname Space\the\el@CounterLevel*\endcsname
\else
\vskip\csname Space\the\el@CounterLevel\endcsname
\fi
\fi
\el@PrintCounters
\el@TotalMargin\csname Margin\the\el@CounterLevel\endcsname
\setbox\el@CounterBox=\hbox{{%
\csname CtrCom\the\el@CounterLevel\endcsname{%
\csname Style\the\el@CounterLevel\endcsname
\csname Style\the\el@CounterLevel*\endcsname
\el@ItemCounter}%
\ifnum\el@CounterLevel>\csname Hide\the\el@CounterLevel\endcsname
\hskip\csname FinalSpace\the\el@CounterLevel\endcsname
\fi}}%
\expandafter\ifx\csname Align\the\el@CounterLevel\endcsname\el@False
\else\expandafter\ifx\csname Align\the\el@CounterLevel\endcsname\el@Fixed
\expandafter\xdef\csname CounterBoxWidth\the\el@CounterLevel\endcsname{%
\the\wd\el@CounterBox}%
\expandafter\gdef\csname Align\the\el@CounterLevel\endcsname{alreadyfixed}%
\else\expandafter\ifx\csname Align\the\el@CounterLevel\endcsname\el@AlreadyFixed
\setbox\el@CounterBox=\hbox to \csname CounterBoxWidth\the\el@CounterLevel\endcsname{{%
\csname CtrCom\the\el@CounterLevel\endcsname{%
\csname Style\the\el@CounterLevel\endcsname
\csname Style\the\el@CounterLevel*\endcsname
\el@ItemCounter}%
\hfil}}%
\setbox\el@ControlBox=\hbox{\unhcopy\el@CounterBox}%
\expandafter\ifdim\wd\el@ControlBox>\csname CounterBoxWidth\the\el@CounterLevel\endcsname
\PackageWarning{easylist}{%
^^J==> This counter is to wide and will spread on%
^^J==> the item text. You should increase FinalSpace%
^^J==> if you use `fixed' or increase the dimension%
^^J==> if you specified one.
^^J==>}%
\fi
\else\expandafter\ifx\csname Align\the\el@CounterLevel\endcsname\el@Move
\expandafter\xdef\csname CounterBoxWidth\the\el@CounterLevel\endcsname{%
\the\wd\el@CounterBox}%
\expandafter\gdef\csname Align\the\el@CounterLevel\endcsname{alreadymoved}%
\else\expandafter\ifx\csname Align\the\el@CounterLevel\endcsname\el@AlreadyMoved
\el@LeftMove=\wd\el@CounterBox
\advance\el@LeftMove by -\csname CounterBoxWidth\the\el@CounterLevel\endcsname
\else
\edef\el@TempTestable{\csname Align\the\el@CounterLevel\endcsname}%
\DubiousFigurefalse
\Signfalse
\Pointfalse
\expandafter\el@UnitSearch\el@TempTestable?%
\ifDubiousFigure
\el@Error
[.^^J==> Admissible values are `false', `fixed', `move' or a dimension]%
{Align\the\el@CounterLevel}{\csname Align\the\el@CounterLevel\endcsname}%
{value for `Align'}%
\expandafter\gdef\csname Align\the\el@CounterLevel\endcsname{false}%
\else
\expandafter\xdef\csname CounterBoxWidth\the\el@CounterLevel\endcsname{%
\csname Align\the\el@CounterLevel\endcsname}%
\setbox\el@CounterBox=\hbox to \csname CounterBoxWidth\the\el@CounterLevel\endcsname{{%
\csname CtrCom\the\el@CounterLevel\endcsname{%
\csname Style\the\el@CounterLevel\endcsname%
\csname Style\the\el@CounterLevel*\endcsname%
\el@ItemCounter}%
\hfil}}%
\expandafter\gdef\csname Align\the\el@CounterLevel\endcsname{alreadyfixed}%
\setbox\el@ControlBox=\hbox{\unhcopy\el@CounterBox}%
\expandafter\ifdim\wd\el@ControlBox>\csname CounterBoxWidth\the\el@CounterLevel\endcsname
\PackageWarning{easylist}{%
^^J==> This counter is to wide and will spread on%
^^J==> the item text. You should increase FinalSpace%
^^J==> if you use `fixed' or increase the dimension%
^^J==> if you specified one.
^^J==>}%
\fi
\fi
\fi\fi\fi\fi\fi
\expandafter\ifx\csname Hang\the\el@CounterLevel\endcsname\el@True
\expandafter\ifx\csname Align\the\el@CounterLevel\endcsname\el@AlreadyMoved
\advance\el@TotalMargin by \csname CounterBoxWidth\the\el@CounterLevel\endcsname
\parindent=-\csname CounterBoxWidth\the\el@CounterLevel\endcsname
\else
\advance\el@TotalMargin by \wd\el@CounterBox
\parindent=-\wd\el@CounterBox
\fi
\else
\parindent=\csname Indent\the\el@CounterLevel\endcsname
\fi
\hangafter0\hangindent\el@TotalMargin
\hskip-\el@LeftMove\box\el@CounterBox
\begingroup
\edef\@currentlabel{\el@ItemCounter}%
\gdef\el@ItemCounter{}%
\parindent=\csname Indent\the\el@CounterLevel\endcsname
\everypar{\hangafter0\hangindent\el@TotalMargin}%
\csname Style\the\el@CounterLevel\endcsname
\csname Style\the\el@CounterLevel**\endcsname
\fi
\xdef\el@PreviousItem{\the\el@CounterLevel}%
\global\el@CounterLevel1
\else
\global\el@Advance\el@CounterLevel
\fi\ignorespaces}
\catcode`#=6
\def\el@Tractatus{tractatus}
\def\el@CheckList{checklist}
\def\el@BookToc{booktoc}
\def\el@ArticleToc{articletoc}
\def\el@Enumerate{enumerate}
\def\el@Itemize{itemize}
\def\elPredefinedStyle{\@ifnextchar[{\el@PredefinedStyle}{}}
\def\el@PredefinedStyle[#1]{%
\def\el@TempStyle{#1}%
\ifx\el@TempStyle\el@Tractatus
\NewList(Mark=,Mark1=.)%
\else\ifx\el@TempStyle\el@CheckList
\NewList(%
Hide=1000,Progressive*=1em,Hang=true,%
Style*={\framebox(7,7){}}\hskip.6em,
Style1**=\bfseries)
\else\ifx\el@TempStyle\el@BookToc
\NewList(%
Hang=true,FinalMark=,Hide=1,%
Style1=\large\bfseries,Numbers1=R,Space1=2.25em,Space1*=2.25em,Hide1=0,Hang1=false,Align1=2em,%
Style2=\bfseries,Space2=1em,Space2*=1em,Align2=1.5em,%
Margin3=1.5em,Margin4=3.8em,Margin5=7em,Margin6=10em,Margin7=12em,%
Align3=2.3em,Align4=3.2em,Align5=4.1em,Align6=5em,Align7=6em)%
\else\ifx\el@TempStyle\el@ArticleToc
\NewList(%
Hang=true,FinalMark=,%
Align1=1.5em,Style1=\bfseries,Space1=1em,Space1*=1em,%
Margin2=1.5em,Margin3=3.8em,Margin4=7em,Margin5=10em,%
Align2=2.3em,Align3=3.2em,Align4=4.1em,Align5=5em)%
\else\ifx\el@TempStyle\el@Enumerate
\NewList(%
FinalSpace=.5em,Hang=true,Mark=.,Space=4pt,Space*=4pt,Align=move,%
Margin1=1.2em,%
Margin2=2.9em,Style2*={(},Mark2={)},Numbers2=l,Hide2=1,%
Margin3=5.6em,Numbers3=r,Hide3=2,%
Margin4=6.8em,Numbers4=L,Hide4=3)%
\else\ifx\el@TempStyle\el@Itemize
\NewList(%
Hang=true,Space=4pt,Space*=4pt,Hide=1000,%
Margin1=1.5em,Style1*=\textbullet\hskip .5em,%
Margin2=3.7em,Style2*=--\hskip .5em,%
Margin3=5.9em,Style3*=$\ast$\hskip .5em,%
Margin4=7.8em,Style4*=$\cdot$\hskip .5em)%
\else
\PackageError{easylist}{^^J==> `\el@TempStyle' is not a valid predefined style}{}%
\fi\fi\fi\fi\fi\fi}
\makeatother
\edef\SectionCatcode{\number\catcode`^^a7}
\edef\PilcrowCatcode{\number\catcode`^^b6}
\edef\SharpCatcode{\number\catcode`#}
\edef\AtCatcode{\number\catcode`@}
\edef\AmpersandCatcode{\number\catcode`&}
\catcode`^^a7=\active
\catcode`^^b6=\active
\catcode`@=\active
\catcode`#=\active
\catcode`&=\active
\ifAt
\def\easylist{%
\catcode`@=\active
\def@{\futurelet\elNextToken\elCreateItem}%
\begingroup\elPredefinedStyle}
\def\endeasylist{\endgroup\par}
\gdef\Activate{%
\xdef\AtCatcode{\number\catcode`@}%
\catcode`@=\active}
\gdef\Deactivate{\catcode`@=\AtCatcode}
\else
\ifPilcrow
\def\easylist{%
\catcode`^^b6=\active
\def^^b6{\futurelet\elNextToken\elCreateItem}%
\begingroup\elPredefinedStyle}
\def\endeasylist{\endgroup\par}
\gdef\Activate{%
\xdef\PilcrowCatcode{\number\catcode`^^b6}%
\catcode`^^b6=\active}
\gdef\Deactivate{\catcode`^^b6=\PilcrowCatcode}
\else
\ifSharp
\def\easylist{%
\catcode`#=\active
\def#{\futurelet\elNextToken\elCreateItem}%
\begingroup\elPredefinedStyle}
\def\endeasylist{\endgroup\par}
\gdef\Activate{%
\xdef\SharpCatcode{\number\catcode`#}%
\catcode`#=\active}
\gdef\Deactivate{\catcode`#=\SharpCatcode}
\else
\ifAmpersand
\def\easylist{%
\catcode`&=\active
\def&{\futurelet\elNextToken\elCreateItem}%
\begingroup\elPredefinedStyle}
\def\endeasylist{\endgroup\par}
\gdef\Activate{%
\xdef\AmpersandCatcode{\number\catcode`&}%
\catcode`&=\active}
\gdef\Deactivate{\catcode`&=\AmpersandCatcode}
\else
\def\easylist{%
\catcode`^^a7=\active
\def^^a7{\futurelet\elNextToken\elCreateItem}%
\begingroup\elPredefinedStyle}%
\def\endeasylist{\endgroup\par}
\gdef\Activate{%
\xdef\SectionCatcode{\number\catcode`^^a7}%
\catcode`^^a7=\active}
\gdef\Deactivate{\catcode`^^a7=\SectionCatcode}
\fi
\fi
\fi
\fi
\catcode`&=\AmpersandCatcode
\catcode`#=\SharpCatcode
\catcode`@=\AtCatcode
\catcode`^^b6=\PilcrowCatcode
\catcode`^^a7=\SectionCatcode
@Rovanion
Copy link
Author

This patch is now included in the default easylist package on CTAN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment