%%
%% This is file `quoting.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% quoting.dtx  (with options: `package')
%% 
%% Copyright (C) 2011--2012 by Thomas Titz <thomas.titz@chello.at>
%% 
%% Permission is granted to distribute and/or modify this work under the
%% terms of the LaTeX Project Public License (LPPL), version 1.3c or
%% later.
%% 
%% The LPPL maintenance status of this work is "maintained".
%% 
%% This work consists of the files quoting.dtx, quoting.ins and README
%% and the derived files quoting.pdf and quoting.sty.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{quoting}
    [2012/02/21 v0.1b Consolidated environment for displayed text]
\RequirePackage{etoolbox,kvoptions}
\SetupKeyvalOptions{family=quo,prefix=quo@}
\def\quo@in@false{\def\quo@indentfirsttype{0}}
\def\quo@in@true{\def\quo@indentfirsttype{1}}
\def\quo@in@auto{\def\quo@indentfirsttype{2}}
\define@key{quo}{indentfirst}{%
  \ifcsname quo@in@#1\endcsname
    \csname quo@in@#1\expandafter\endcsname
  \else
    \PackageError{quoting}{Unknown value #1 for option indentfirst}%
  \fi
}
\setkeys{quo}{indentfirst=auto}
\newcommand*{\quotingfont}{}
\define@key{quo}{font}{%
  \def\quotingfont{}%
  \renewcommand*{\do}[1]{\appto{\quotingfont}{\csname ##1\endcsname}}%
  \docsvlist{#1}%
}
\define@key{quo}{font+}{%
  \renewcommand*{\do}[1]{\appto{\quotingfont}{\csname ##1\endcsname}}%
  \docsvlist{#1}%
}
\DeclareStringOption{begintext}
\DeclareStringOption{endtext}
\DeclareStringOption[\leftmargin]{leftmargin}
\DeclareStringOption[\quo@leftmargin]{rightmargin}
\newlength{\quo@toppartop}
\deflength{\quo@toppartop}{\topsep + \partopsep}
\DeclareStringOption[\quo@toppartop]{vskip}
\DeclareBoolOption{listvskip}
\DeclareBoolOption{noorphanfirst}
\DeclareBoolOption{noorphanafter}
\define@key{quo}{noorphans}[true]{%
  \setbool{quo@noorphanfirst}{#1}%
  \setbool{quo@noorphanafter}{#1}%
}
\ProcessKeyvalOptions*
\newcommand*{\quotingsetup}[1]{\setkeys{quo}{#1}}
\newbool{quo@afterquo}
\newbool{quo@afterquoclub}
\newcommand*{\quo@doendquoclub}{%
  \ifbool{quo@afterquoclub}{%
    \clubpenalty=\@clubpenalty
    \everypar{}%
  }{%
    \booltrue{quo@afterquoclub}%
    \clubpenalty=\@M
  }%
}
\newcommand*{\quo@doendquo}{%
  \booltrue{@endpe}%
  \def\par{%
    \@restorepar
    \everypar{\quo@doendquoclub}%
    \par
    \boolfalse{@endpe}%
    \global\boolfalse{quo@afterquo}%
   }%
  \everypar{%
    {\setbox\z@\lastbox}%
    \quo@doendquoclub
    \boolfalse{@endpe}%
    \global\boolfalse{quo@afterquo}%
  }%
}
\newenvironment{quoting}[1][]{%
  \setkeys{quo}{#1}%
  \list{}{%
    \ifbool{quo@listvskip}{%
    }{%
      \setlength{\topsep}{\quo@vskip}%
      \setlength{\partopsep}{\z@}%
    }%
    \ifcase\quo@indentfirsttype\relax
      \setlength{\itemindent}{\z@}%
    \or
      \setlength{\itemindent}{\parindent}%
    \or
      \setlength{\itemindent}{%
        \ifbool{vmode}{%
          \ifbool{quo@afterquo}{%
            \z@
          }{%
            \ifbool{@nobreak}{%
              \ifbool{@afterindent}{%
                \parindent
              }{%
                \z@
              }%
            }{%
              \parindent
            }%
          }%
        }{%
          \z@
        }%
      }%
    \fi
    \setlength{\leftmargin}{\quo@leftmargin}%
    \setlength{\rightmargin}{\quo@rightmargin}%
    \setlength{\listparindent}{\parindent}%
    \setlength{\parsep}{\parskip}%
  }%
  \item\relax
  \ifbool{quo@noorphanfirst}{%
    \global\booltrue{@nobreak}%
  }{%
  }%
  \quotingfont
  \quo@begintext\ignorespaces
}{%
  \unskip\quo@endtext
  \endlist
  \boolfalse{@endpe}%
  \ifbool{quo@noorphanafter}{%
    \aftergroup\quo@afterquoclubfalse
  }{%
    \aftergroup\quo@afterquoclubtrue
  }%
  \global\booltrue{quo@afterquo}%
  \aftergroup\quo@doendquo
}
\endinput
%%
%% End of file `quoting.sty'.
