%%
%% This is file `textpos.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% textpos.dtx  (with options: `package')
%% Textpos: absolute positioning of text on the page
%%%% File: textpos.dtx
%%%% Copyright 1999, 2001--2003, 2005-7, 2009-12, 2014, Norman Gray
%%
%% 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 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 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is Norman Gray <http://nxg.me.uk>
%%
%% This work consists of the files textpos.dtx and textpos.ins,
%% and the derived file textpos.cls.
%%
%% Author: Norman Gray, norman@astro.gla.ac.uk.
%% Department of Physics and Astronomy, University of Glasgow, UK
%%
%% See the file LICENCE for a copy of the LPPL.
%%
%% Mercurial ident: 41b12ce5565c, 2014-01-03 19:15 +0000
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{textpos}[2014/01/03 v1.7j]
\typeout{Package: textpos 2014/01/03 1.7j, absolute positioning of text on the page}
 
\newif\ifTPshowboxes
\TPshowboxesfalse
\DeclareOption{showboxes}{\TPshowboxestrue}
\newif\ifTP@showtext
\TP@showtexttrue
\DeclareOption{noshowtext}{\TP@showtextfalse}
\newif\ifTP@abspos
\TP@absposfalse
\DeclareOption{absolute}{\TP@abspostrue}
\newif\ifTP@overlay
\TP@overlayfalse
\DeclareOption{overlay}{\TP@overlaytrue}
\newif\ifTP@chatter
\TP@chattertrue
\DeclareOption{quiet}{\TP@chatterfalse}
\DeclareOption{verbose}{\TP@chattertrue}
\ProcessOptions
\ifTP@abspos
  \RequirePackage{everyshi}
\fi
\def\TP@xfloat#1[#2]{
  \par\def\@captype{#1}%
  \@floatpenalty\z@
  \color@vbox
    \normalcolor
    \vbox\bgroup
}
\def\TP@xympar{
  \PackageError{textpos}
    {You can't use \protect\marginpar\space within a textblock}
    {You're using textpos because you _don't_ want things to float around, yes?}}
\newbox\TP@textbox
\ifTP@abspos
  \newbox\TP@holdbox            % starts off void
  \AtEndDocument{\ifvoid\TP@holdbox \else \hbox{}\fi}
\fi
\newdimen\TPHorizModule
\newdimen\TPVertModule
\newdimen\TP@margin
\TP@margin=0pt
\newdimen\TP@absmargin
\TP@absmargin=0pt
\newcommand{\TPMargin}{%
  \@ifstar\TPMargin@outer\TPMargin@inner
}
\newcommand{\TPMargin@inner}[1]{%
  \TP@margin=#1\relax
  \ifdim\TP@margin < 0pt
    \PackageError{textpos}
      {\protect\TPMargin\space must have a positive argument}
      {\protect\TPMargin\space must have a positive argument}
  \fi
  \TP@absmargin=\TP@margin
}
\newcommand\TPMargin@outer[1]{%
  \TP@margin=-#1\relax
  \ifdim\TP@margin > 0pt
    \PackageError{textpos}
      {\protect\TPMargin*\space must have a positive argument}
      {\protect\TPMargin*\space must have a positive argument}
  \fi
  \TP@absmargin=-\TP@margin
}
\def\TPGrid{%
  \@ifnextchar[{\@tempswatrue\TP@Grid}{\@tempswafalse\TP@Grid[0pt,0pt]}}
\def\TP@Grid[#1,#2]#3#4{
  \setlength{\@tempdima}{#1}
  \multiply\@tempdima by 2
  \TPHorizModule=\paperwidth
  \advance\TPHorizModule by -\@tempdima
  \divide\TPHorizModule by #3
  \setlength{\@tempdima}{#2}
  \multiply\@tempdima by 2
  \TPVertModule=\paperheight
  \advance\TPVertModule by -\@tempdima
  \divide\TPVertModule by #4
  \ifTP@chatter
    \typeout{Grid set #3 x #4 = \the\TPHorizModule\space x \the\TPVertModule}%
  \fi
  \ifTP@abspos\if@tempswa \textblockorigin{#1}{#2}\fi\fi
}
\TPGrid{16}{16}
\newdimen\TPboxrulesize
\setlength{\TPboxrulesize}{0.4pt}
\def\showtextsize{\normalsize}
\ifTP@abspos
  \newdimen\TP@ox
  \newdimen\TP@oy
\fi
\def\textblockorigin#1#2{%
  \ifTP@abspos
    \TP@ox=-1in    \addtolength\TP@ox{#1}
    \TP@oy=-1in    \addtolength\TP@oy{#2}
    \ifTP@chatter\typeout{TextBlockOrigin set to #1 x #2}\fi
  \else
    \PackageError{textpos}
      {The \protect\textblockorigin\space command\MessageBreak
       may only be used if the package was given\MessageBreak
       the`absolute' option when it was invoked}
      {If you want to use the \protect\textblockorigin\space command, then
         \MessageBreak
       invoke the package with the syntax\MessageBreak
       \protect\usepackage[absolute]{textpos}}
  \fi
  }
\def\textblocklabel#1{\gdef\TP@textblocklabel{#1}}
\def\textblockcolour#1{%
  \@ifundefined{color}%
    {\PackageWarning{textpos}{command textblockcolour used,\MessageBreak
       but {color} package not loaded.\MessageBreak
       Colour changes ignored.}}
    {\gdef\TP@blockcolour{#1}
     \ifx\TP@defaultblockcolour\@undefined
       \gdef\TP@defaultblockcolour{#1}
     \fi
    }}
\def\TP@blockcolour{}           % safe initial default
\let\textblockcolor\textblockcolour
\let\tekstblokkulur\textblockcolour
\def\textblockrulecolour#1{%
  \@ifundefined{color}%
    {\PackageWarning{textpos}{command textblockrulecolour used,\MessageBreak
       but {color} package not loaded.\MessageBreak
       Colour changes ignored.}}
    {\gdef\TP@rulecolour{#1}}}
\def\TP@rulecolour{black}
\let\textblockrulecolor\textblockrulecolour
\let\tekstblokroolkulur\textblockrulecolour
\gdef\TP@color[#1]#2{}
\def\TP@checkdummycolorpackage{%
  \@ifundefined{color}%
    {\globaldefs=1
       \DeclareRobustCommand\color[2][]{}%
       \def\color@block##1##2##3{}%
     \globaldefs=0 }{}%
  \global\let\TP@checkdummycolorpackage\relax % don't come here again
}
\def\textblock#1{%
  \@tempdima=#1\TPHorizModule
  \ifvmode\else
    \ifmmode
      \PackageError{textpos}
        {You cannot use textblock in maths mode}
        {You may use the textblock environment only in \MessageBreak
         vertical mode or horizontal mode (when it triggers a\MessageBreak
         new paragraph).  You cannot use it in maths mode.}
    \else % in horizontal mode
      \par % force us back into vertical mode
    \fi
  \fi
  \@ifnextchar[{\TP@textblock}{\TP@textblock[0,0]}%] bracematch
}
\def\TP@textblockstar#1{%
  \setlength{\@tempdima}{#1}
  \ifvmode\else
    \PackageWarning{textpos}{environment textblock* not in vertical mode.
      \MessageBreak
      Environment textblock* should not have any text\MessageBreak
      or printable material appearing before it.\MessageBreak
      Alignment may work out wrongly.}%
    \par % force us back into vertical mode
  \fi
  \@ifnextchar[{\TP@textblock}{\TP@textblock[0,0]}%] bracematch
}
\expandafter\let\csname textblock*\endcsname\TP@textblockstar
\newtoks\TP@tbargs
\def\TP@textblock[#1,#2](#3,#4){%
  \TP@tbargs={{#1}{#2}{#3}{#4}}%
  \let\@xfloat\TP@xfloat
  \let\@xympar\TP@xympar
  \setbox\TP@textbox=\vbox\bgroup
    \ifTPshowboxes
      \TP@checkdummycolorpackage
      {\color{\TP@rulecolour}\hrule height0pt depth \TPboxrulesize }%
      \vskip-\TPboxrulesize
    \fi
    \ifdim\TP@margin = 0pt
      \hsize=\@tempdima
      \textwidth\hsize \columnwidth\hsize \linewidth\hsize
    \else
      \vskip\TP@absmargin
      \@tempdimb=\@tempdima % \@tempdimb is outer box width
      \hsize=\@tempdima     % \hsize is inner box width
      \ifdim\TP@margin < 0pt
        \advance\@tempdimb by 2\TP@absmargin % bigger box
      \else
        \advance\hsize by -2\TP@absmargin    % narrower content
      \fi
      \hbox to \@tempdimb\bgroup
        \hskip\TP@absmargin\vbox\bgroup
          \textwidth\hsize \columnwidth\hsize \linewidth\hsize
    \fi
  }
\def\endtextblock{\global\@tempswatrue\TP@commonendtextblock}
\@namedef{endtextblock*}{\global\@tempswafalse\TP@commonendtextblock}
\newdimen\TP@prevdepth
\def\TP@commonendtextblock{%
    \ifdim\TP@margin = 0pt
      \relax
    \else
      \egroup % end of inner vbox
      \hskip\TP@absmargin
      \egroup % end of inner hbox
      \vskip \TP@absmargin
    \fi
    \ifTPshowboxes
        \vskip-\TPboxrulesize
        {\color{\TP@rulecolour}\hrule depth 0pt height \TPboxrulesize}%
    \fi
    \egroup % end of \TP@textbox
  \TP@prevdepth=\prevdepth
  \prevdepth=-1000pt  % = \nointerlineskip
  \expandafter\TP@endtextblock\the\TP@tbargs
  }
\def\TP@endtextblock#1#2#3#4{%
  \if@tempswa % modular/unstarred endtextblock
    \@tempdima=#3\TPHorizModule
    \@tempdimb=#4\TPVertModule
  \else % absolute/starred endtextblock
    \setlength{\@tempdima}{#3}
    \setlength{\@tempdimb}{#4}
  \fi
  \ifdim\TP@margin < 0pt
    \advance\@tempdima \TP@margin
    \advance\@tempdimb \TP@margin
    % #1,#2 are proportions of \TP@textbox size
    \@tempdimc=-#1\wd\TP@textbox
    \advance\@tempdima\@tempdimc
    \@tempdimc=-#2\ht\TP@textbox
    \advance\@tempdimb\@tempdimc
  \else
    % \TP@margin is positive
    % #1,#2 are proportions of \TP@framebox size = \TP@textbox+2\TP@margin
    \@tempdimc=\wd\TP@textbox
    \advance\@tempdimc 2\TP@margin
    \@tempdimc=#1\@tempdimc
    \advance\@tempdima -\@tempdimc
    \@tempdimc=\ht\TP@textbox
    \advance\@tempdimc 2\TP@margin
    \@tempdimc=#2\@tempdimc
    \advance\@tempdimb -\@tempdimc
  \fi
  \ifTP@abspos
    \advance\@tempdima by \TP@ox
    \advance\@tempdimb by \TP@oy
  \fi
  \setbox0=\vbox to 0pt{\vskip\@tempdimb
    \hbox to 0pt{\hskip\@tempdima
    \ifx\TP@blockcolour\@empty \else
      {\TP@checkdummycolorpackage
       \color{\TP@blockcolour}%
       \color@block{\wd\TP@textbox}{\ht\TP@textbox}{\dp\TP@textbox}%
      }%
    \fi
    \ifx\TP@defaultblockcolour\@undefined \else
      \global\let\TP@blockcolour\TP@defaultblockcolour
    \fi
    \ifTPshowboxes
      {\color{\TP@rulecolour}\vrule width \TPboxrulesize}%
      \hskip -\TPboxrulesize
    \fi
    \ifTP@showtext
      \box\TP@textbox
    \else
      \vbox to\ht\TP@textbox{%
        \ifTPshowboxes
          {\color{\TP@rulecolour}\hrule depth 0pt height \TPboxrulesize \vskip-\TPboxrulesize}%
        \fi
        \vskip\smallskipamount
        \hbox to\wd\TP@textbox{%
          \ifx\TP@textblocklabel\undefined
            \hbox{}%
          \else
            \hskip\smallskipamount
            \fbox{\showtextsize \TP@textblocklabel}%
            \global\let\TP@textblocklabel\undefined
          \fi
          \hss
        }%
        \vss
        \ifTPshowboxes
          \vskip -\TPboxrulesize
          {\color{\TP@rulecolour}\hrule depth 0pt height \TPboxrulesize}%
        \fi
      }%
    \fi
    \ifTPshowboxes
      \hskip -\TPboxrulesize
      {\color{\TP@rulecolour}\vrule width \TPboxrulesize}%
    \fi
    \hss}%
  \vss
  }%  end of box0
  \ifTP@abspos
    \global\setbox\TP@holdbox\vbox{%
      \unvbox\TP@holdbox
      \box0
    }%
  \else
    \box0
    \prevdepth=\TP@prevdepth
  \fi
  }%
\ifTP@abspos
  \ifTP@overlay
    \EveryShipout{%
      \global\setbox\@cclv\vbox{%
        \vbox to 0pt{\ifvbox\@cclv \unvbox\@cclv \else \box\@cclv \fi \vss}%
        \unvbox\TP@holdbox      % TP@holdbox is now void
      }
    }%
  \else
    \EveryShipout{%
      \global\setbox\@cclv\vbox{%
        \unvbox\TP@holdbox
        \ifvbox\@cclv \unvbox\@cclv \else \box\@cclv \fi
      }%
    }%
  \fi
  \textblockorigin{0pt}{0pt}%
\fi
\endinput
%%
%% End of file `textpos.sty'.
