%%
%% This is file `timbreicmc.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% timbreicmc.dtx 
%% 
%% Copyright (C) 2017 Miguel V. S. Frasson (mvsfrasson@gmail.com)
%% 
%% This file is part of the `timbreicmc' package.
%% 
%% This package may be distributed under the terms of the LaTeX
%% Project Public License, as described in lppl.txt in the base
%% LaTeX distribution, either version 1.2 or (at your option)
%% any later version.
%% 
%% This program is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
%% 
%% \CheckSum{0}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{timbreicmc}[2017/12/12 v1.0 Timbres do ICMC-USP (alguns)]
\RequirePackage{xwatermark,xcolor,tikz}
\newlength{\timbreICMCmargem}
\setlength{\timbreICMCmargem}{1.25cm}
\DeclareOption{icmc}{\def\TimbreICMCdepto{0}}
\DeclareOption{scc} {\def\TimbreICMCdepto{1}}
\DeclareOption{sma} {\def\TimbreICMCdepto{2}}
\DeclareOption{sme} {\def\TimbreICMCdepto{3}}
\DeclareOption{ssc} {\def\TimbreICMCdepto{4}}
\ExecuteOptions{icmc}
\ProcessOptions \relax
\definecolor{c5c7a99}{RGB}{92,122,153}
\definecolor{c00006a}{RGB}{0,0,106}
\definecolor{cfefefe}{RGB}{254,254,254}
\definecolor{c9c316a}{RGB}{156,49,106}
\definecolor{c6666cc}{RGB}{102,102,204}
\definecolor{c319c63}{RGB}{49,156,99}
\newsavebox{\timbreICMClogo}
\savebox{\timbreICMClogo}{\input{timbreicmclogoicmc}}
\def\timbreICMCfonterodape{\fontsize{9}{12}\sffamily}

\def\timbreICMCtexto{%
  \ifcase\TimbreICMCdepto\relax % 0 = basico
  \or Departamento de Ci\^encias de Computa\c c\~ao\\ % 1 = scc
  \or Departamento de Matem\'atica\\ % 2 = sma
  \or Departamento de Matem\'atica Aplicada e Estat\'istica\\ % 3 = sme
  \or Departamento de Sistemas de Computa\c c\~ao\\ % 4 = ssc
  \fi
  Instituto de Ci\^encias Matem\'aticas e de Computa\c c\~ao \textbar{}
  Universidade de S\~ao Paulo \textbar\\ Av.\ Trabalhador S\~ao-carlense,
  400 \textbullet{} Centro \textbullet{} S\~ao Carlos/SP \textbullet{}
  CEP 13566-590 \textbullet{} Brasil \textbullet{} www.icmc.usp.br}

\newsavebox{\timbreICMCendereco}

\savebox{\timbreICMCendereco}{%
  \makebox[0pt][c]{%
    \begin{tikzpicture}
      \node[c5c7a99] {\parbox{19cm}{%
          \timbreICMCfonterodape\centering\timbreICMCtexto}};
    \end{tikzpicture}}}
\newlength{\timbreICMCskip}

\newsavebox{\timbreICMCmarcadagua}

\newcommand{\timbreICMCsetwatermark}{%
  \setlength{\timbreICMCskip}{\paperheight}%
  \addtolength{\timbreICMCskip}{-2\timbreICMCmargem}%
  \settoheight{\timbreICMCmargem}{\usebox{\timbreICMClogo}}%
  \addtolength{\timbreICMCskip}{-\timbreICMCmargem}%
  \settoheight{\timbreICMCmargem}{\usebox{\timbreICMCendereco}}%
  \addtolength{\timbreICMCskip}{-\timbreICMCmargem}%
  \savebox{\timbreICMCmarcadagua}{\parbox{10cm}{%
      \centering
      \usebox{\timbreICMClogo}\par
      \vspace{\timbreICMCskip}\par
      \usebox{\timbreICMCendereco}}}%
  \newwatermark[allpages]{\usebox{\timbreICMCmarcadagua}}}

\AtBeginDocument{\timbreICMCsetwatermark}
%%
%% End of file `timbreicmc.dtx'.
\endinput
%%
%% End of file `timbreicmc.sty'.
