%=====================================================================================================================================
% Package akkwidepage by Igor Akkerman (c) 2004, 2005
% Package providing wide pages.
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License (latest version).
%
% The latest version of this license can be found at
%     http://www.latex-project.org/lppl.txt
%
% This file may only be distributed together with the full 'AkkTeX' bundle.
%=====================================================================================================================================
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{akkwidepage}[2005/05/05 by Igor Akkerman (c) 2004, 2005 v1.1.1 Package providing wide pages.]
%=====================================================================================================================================

\makeatletter

% Initialisierungsteil
\RequirePackage{akkconditional}

\newboolean {akk@twoside}

% Deklaration von Optionen
\DeclareOption {twoside}  {\setboolean {akk@twoside} {true}}

% Ausfuehrung von Optionen
\ProcessOptions

% Laden von Paketen

%=====================================================================================================================================

\newlength   \akk@orig@oddsidemargin
\newlength   \akk@orig@evensidemargin
\newlength   \akk@orig@textwidth

\newlength   \akk@default@oddsidemargin
\newlength   \akk@default@evensidemargin
\newlength   \akk@default@textwidth

\setlength   \akk@orig@oddsidemargin     \oddsidemargin
\setlength   \akk@orig@evensidemargin    \evensidemargin
\setlength   \akk@orig@textwidth         \textwidth

\setlength   \akk@default@oddsidemargin  \oddsidemargin
\setlength   \akk@default@evensidemargin \evensidemargin
\setlength   \akk@default@textwidth      \textwidth

\ifbool{akk@twoside} {
    \addtolength \akk@default@oddsidemargin  {-3.00em}
    \addtolength \akk@default@evensidemargin {-5.50em}
}{
    \addtolength \akk@default@oddsidemargin  {-4.25em}
    \addtolength \akk@default@evensidemargin {-4.25em}
}
\addtolength \akk@default@textwidth      { 8.50em}  % = 3cm at 10 pt

\newcommand \akk@widepage@setorigvalues {%
    \setlength   \oddsidemargin              \akk@orig@oddsidemargin%
    \setlength   \evensidemargin             \akk@orig@evensidemargin%
}

\newcommand \akk@widepage@setdefaultvalues {%
    \setlength   \oddsidemargin              \akk@default@oddsidemargin%
    \setlength   \evensidemargin             \akk@default@evensidemargin%
}

\akk@widepage@setdefaultvalues
\setlength   \textwidth                      \akk@default@textwidth %textwidth can only be set in preamble

\makeatother
