% clearpage.sty v1.0 2004/11/24
%
% Copyright 2004 Stephan Otto
%
% Contact software@stephan-otto.net
%
% 
% Package clearpage
% =================
%
%
% Description
% -----------
%
% This mini-package allows you to set the page style of extra pages
% inserted by LaTeX's '\cleardoublepage' command.
%
%
% License
% -------
%
% This file may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, either version 1.3 of this license
% or (at your option) any later version.  The latest version of this
% license is in http://www.latex-project.org/lppl.txt and version 1.3
% or later is part of all distributions of LaTeX version 2003/12/01 or
% later.
%
%
% Installation
% ------------
%
% Put this file somewhere TeX can find it. See http://faq.tug.org if
% you have questions.
%
%
% Usage
% -----
%
% Include this package with
%
%   \usepackage{clearpage}
%
% Set the extra page style with
%
%   \clearpagestyle{<style>}{<setup>}
%
% where <style> is an argument to the '\thispagestyle' command and
% <setup> contains any additional commands.
%
%

\NeedsTeXFormat{LaTeX2e}

\ProvidesPackage{clearpage}

\def\clearpagesetup{}

\def\clearpagestyle#1#2{%
  \def\clearpagesetup{%
    \if#1''\else\thispagestyle{#1}\fi#2%
  }%
}

\def\cleardoublepage{%
  \clearpage%
  \if@twoside%
    \ifodd%
      \c@page%
    \else%
      \hbox{}\clearpagesetup\newpage%
      \if@twocolumn%
        \hbox{}\newpage%
      \fi%
    \fi%
  \fi%
}
