%%
%% This is file `adjmulticol.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% adjmulticol.dtx  (with options: `style')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from adjmulticol.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file adjmulticol.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% Copyright 2011, Boris Veytsman <borisv@lk.net>
%% This work 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 the 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/06/01 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is Boris Veytsman
%%
%% This work consists of the file adjmulticol.dtx and the
%% derived file adjmulticol.sty,
%%
%%
%% Since this package is based on the multicol package,
%% Copyright 1989-2005 Frank Mittelbach, the following additional
%% condition is added to the licensing terms.  The term ``multicol''
%% here should be interpreted as ``multicol and/or adjmulticol''
%% package, as appropriate.
%%
%%  In addition to the terms of LPPL any distributed version
%%  (unchanged or modified) of multicol has to keep the statement
%%  about the moral obligation for using multicol. In case of major
%%  changes where this would not be appropriate the author of the
%%  changed version should contact the copyright holder.
%%
%%
%%  Moral obligation for using multicol:
%%  ------------------------------------
%%
%%  Users of multicol who wish to include or use multicol or a modified
%%  version in a proprietary and commercially market product are asked
%%  under certain conditions (see below) for the payment of a license
%%  fee.  The size of this fee is to be determined, in each instance,
%%  by the commercial user, depending on his/her judgment of the value of
%%  multicol for his/her product.
%%
%%
%%  The conditions for this are as follows:
%%
%%   The producer of a proprietary and commercially market product
%%   that involves typesetting using multicol is asked to determine
%%   the value of a license fee for using multicol if
%%
%%   - the product is a document and the producer has decided to
%%     include multicol to typeset (parts of) the document or has
%%     directed the author of the document to include multicol (for
%%     example, by providing a class file to be used by the author)
%%
%%   - the product is a LaTeX class or package that includes multicol
%%
%%
%%   There is no moral obligation in case
%%
%%   - the product is a document but producer has not directed
%%     the author to include multicol (in that case the moral obligation
%%     lies with the author of the document)
%%
%%   - the product does not involve typesetting, e.g., consists, for
%%     example, of distributing multicol and its documentation.
%%
%%   - the product is not proprietary, i.e., is made available as free
%%     software itself (which doesn't prohibit its commercial marketing)
%%
%%   - multicol is used for non-commercial purposes
%%
%%
%% Determinating a license fee might result in a license fee of zero
%% (i.e., no payment) in case a producer has determined that the use
%% of multicol has no enhancing effect on the product. This is a
%% plausible scenario, i.e., in the above two cases the producer is
%% only asked to evaluate the value of multicol for the product
%% not for the payment of a license fee per se (which might or might
%% not follow from this evaluation).
%%
%% The license fee, if any, can be payed either to the LaTeX3 fund
%% (see ltx3info.txt in the base LaTeX distribution) or to the author of
%% the program who can be contacted at
%%
%%     Frank.Mittelbach@latex-project.org
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{adjmulticol}
[2011/02/23 v1.0 Adjusted margins for multicolumn layout]
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{multicol}}
\ProcessOptions\relax
\RequirePackage{multicol}
\newdimen\adjmc@inner
\newdimen\adjmc@outer
\newdimen\adjmc@saved@leftmargin
\def\adjmulticols#1#2#3{\col@number#1\relax
  \def\@tempa{#2}%
  \ifx\@tempa\@empty\adjmc@inner\z@\else\adjmc@inner#2\fi
  \def\@tempa{#3}%
  \ifx\@tempa\@empty\adjmc@outer\z@\else\adjmc@outer#3\fi
  \ifnum\col@number<\@ne
     \PackageWarning{adjmulticol}%
      {Using `\number\col@number'
       columns doesn't seem a good idea.^^J
       I therefore use one columns instead}%
     \col@number\@ne\fi
  \ifnum\col@number>10
     \PackageError{adjmulticol}%
      {Too many columns}%
      {Current implementation doesn't
       support more than 10 columns.%
       \MessageBreak
       I therefore use 10 columns instead}%
     \col@number10 \fi
  \def\Needspace{\PackageWarning{adjmulticol}%
    {The command \noexpand\Needspace is disabled}%
    {The command \noexpand\Needspace is not compatible with our
      output routine}}
     \ifx\@footnotetext\mult@footnotetext\else
       \let\orig@footnotetext\@footnotetext
       \let\@footnotetext\mult@footnotetext
     \fi
  \@ifnextchar[\adjmult@cols{\adjmult@cols[]}}
\def\adjmult@cols[#1]{\@ifnextchar[%
  {\adjmult@@cols{#1}}%
  {\adjmult@@cols{#1}[\premulticols]}}
\def\adjmult@@cols#1[#2]{%
    \advance\linewidth by -\adjmc@inner\relax
    \advance\linewidth by -\adjmc@outer\relax
\let\page@sofar=\adjmc@page@sofar
   \mult@@cols#1[#2]}
\def\endadjmulticols{%
  \def\@currenvir{multicols}%
  \endmulticols}
\let\adjmc@page@sofar@orig=\page@sofar
\def\adjmc@page@sofar{%
  \ifnum\col@number=\@ne
  \setbox\mult@rightbox\box\mult@firstbox
  \fi
   \adjmc@saved@leftmargin=\multicol@leftmargin
   \if@twoside
      \ifodd\c@page
        \advance\multicol@leftmargin by \adjmc@inner\relax
     \else
        \advance \multicol@leftmargin by \adjmc@outer\relax
    \fi
   \else
      \advance \multicol@leftmargin by \adjmc@inner\relax
  \fi
   \adjmc@page@sofar@orig
   \multicol@leftmargin=\adjmc@saved@leftmargin}
\newenvironment{adjmulticols*}{%
   \ifinner
     \PackageWarning{multicol}%
       {multicols* inside a box does
        not make sense.\MessageBreak
        Going to balance anyway}%
   \else
     \let\balance@columns@out
         \multi@column@out
   \fi
   \adjmulticols}{%
   \vfill
  \endadjmulticols}
\endinput
%%
%% End of file `adjmulticol.sty'.
