%%
%% This is file `gatherenum.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% gatherenum.dtx  (with options: `package')
%% 
%% File: gatherenum.dtx (C) Copyright 2016-2018 RIVAUD Julien
%%
%% It may be distributed and/or modified under the conditions of the
%% General Public License (GPL), either version 3 of this
%% license or (at your option) any later version.
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\RequirePackage{expl3}[2016/01/19]
\def\ExplFileName{gatherenum}
\def\ExplFileDescription{Crossover between align* and enumerate}
\def\ExplFileDate{2018/06/19}
\def\ExplFileVersion{1.7}
\ProvidesExplPackage
  {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\RequirePackage{enumitem}
\RequirePackage{xparse}
\tl_set:Nn \enit@shortgatherenum {enum}
\newlist{gatherenum}{enumerate*}{3}
\tl_new:N \l__gatherenum_itemformat
\cs_new_protected_nopar:Nn \__gatherenum_boxitem: {
    \nobreak\skip_horizontal:n {\labelsep}
    \hbox_set:Nn \enit@inbox {
        \hbox:n {
            \l__gatherenum_itemformat{\hbox_unpack:N \enit@inbox}
        }
    }
}
\enitkv@key{enumitem}{gatherformat}{\tl_set:Nn\l__gatherenum_itemformat{#1}}
\let\__gatherenum_save_enumerate:w\enumerate
\let\__gatherenum_save_endenumerate:w\endenumerate
\RenewDocumentEnvironment{enumerate}{ O{} }{
    \clist_if_in:nnTF { #1 } { gathered } {
        \if@inlabel
            \leavevmode
        \fi
        \par
        \centering
        \int_set_eq:NN \enitdp@gatherenum \enitdp@enumerate
        \penalty \predisplaypenalty
        \begin{gatherenum}[
            itemjoin=\skip_horizontal:n{1em plus 1fil},
            #1,
            mode=boxed,
            align=none,
            afterlabel=\__gatherenum_boxitem:,
        ]
    }{
        \__gatherenum_save_enumerate:w[#1]
    }
}{
    \clist_if_in:nnTF { #1 } { gathered } {
        \end{gatherenum}
        \unskip
        \int_set_eq:NN \clubpenalty \interlinepenalty
        \int_set_eq:NN \widowpenalty \interlinepenalty
        \par
    }{
        \__gatherenum_save_endenumerate:w
    }
}
\SetEnumitemKey{gathered}{}
\SetLabelAlign{none}{#1}
\SetEnumitemKey{centered}{before*=\centering}
\SetEnumitemKey{alignleft}{before*=\raggedright}
%% 
%%
%% End of file `gatherenum.sty'.
