Nominal/activities/wallpaper.sty
author Christian Urban <urbanc@in.tum.de>
Fri, 19 Jul 2019 11:38:54 +0100
changeset 579 58c09367912e
parent 415 f1be8028a4a9
permissions -rw-r--r--
updated

%% 
%% This is file `wallpaper.sty' v 1.10
%%
%% Author Michael H.F. Wilkinson 
%%   April 21, 2006
%% 
%% Create background, either centered, tiled, or in any corner   
%% relies heavily on eso-pic.sty, corrects for changes in \hoffset 
%% by classes such as sciposter.cls
%% Problems, bugs and comments to 
%%        michael@cs.rug.nl
%% version 1.10, 2006/04/21:
%%               - Commands added for corner wallpapers 
%%
%% version 1.01, 2005/01/18:
%%               - \providecommand{\LenToUnit} included to be compatible
%%                  with earlier versions of eso-pic.sty
%%
%% version 1.00, 2004/12/22:
%%               - first release
%%
%%
\ProvidesPackage{wallpaper}[2005/01/18, v1.01 easy wallpaper formatting (MHFW)]
\NeedsTeXFormat{LaTeX2e}[1995/06/01]

\RequirePackage{ifthen}
\RequirePackage{calc}
\RequirePackage{eso-pic}
\RequirePackage{graphicx}

\providecommand{\LenToUnit}[1]{#1\@gobble}


\newlength{\wpXoffset}
\setlength{\wpXoffset}{-\hoffset}
\newlength{\wpYoffset}
\setlength{\wpYoffset}{0pt}
\newlength{\tileXoffset}
\newlength{\tileYoffset}
\newlength{\tilewidth}
\newlength{\tileheight}
\newlength{\tileX}
\newlength{\tileY}

\newcommand{\LLCornerWallPaper}[2]{%
\AddToShipoutPicture{%
  \AtPageLowerLeft{%
    \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
                     keepaspectratio]{#2}%
    }
  }
}

\newcommand{\ThisLLCornerWallPaper}[2]{%
\AddToShipoutPicture*{%
  \AtPageLowerLeft{%
    \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
                     keepaspectratio]{#2}%
    }
  }
}

\newcommand{\ULCornerWallPaper}[2]{%
  \AddToShipoutPicture{%
    \AtPageLowerLeft{%
      \parbox[b][\paperheight]{#1\paperwidth}{%       
        \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
        keepaspectratio]{#2}%
        \vfill%
      }
    }
  }
}

\newcommand{\ThisULCornerWallPaper}[2]{%
  \AddToShipoutPicture*{%
    \AtPageLowerLeft{%
      \parbox[b][\paperheight]{#1\paperwidth}{%       
        \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
        keepaspectratio]{#2}%
        \vfill%
      }
    }
  }
}

\newcommand{\LRCornerWallPaper}[2]{%
  \AddToShipoutPicture{%
    \AtPageLowerLeft{%
      \parbox[b]{\paperwidth}{%       
        \hfill \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
        keepaspectratio]{#2}%
      }
    }
  }
}

\newcommand{\ThisLRCornerWallPaper}[2]{%
  \AddToShipoutPicture*{%
    \AtPageLowerLeft{%
      \parbox[b]{\paperwidth}{%       
        \hfill \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
        keepaspectratio]{#2}%
      }
    }
  }
}

\newcommand{\URCornerWallPaper}[2]{%
  \AddToShipoutPicture{%
    \AtPageLowerLeft{%
      \parbox[b][\paperheight]{\paperwidth}{%       
        \hfill \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
        keepaspectratio]{#2}%
        \vfill%
      }
    }
  }
}
\newcommand{\ThisURCornerWallPaper}[2]{%
  \AddToShipoutPicture*{%
    \AtPageLowerLeft{%
      \parbox[b][\paperheight]{\paperwidth}{%       
        \hfill \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
        keepaspectratio]{#2}%
        \vfill%
      }
    }
  }
}

\newcommand{\CenterWallPaper}[2]{%
\AddToShipoutPicture{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){%
     \parbox[b][\paperheight]{\paperwidth}{%       
       \vfill
       \centering
       \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
                        keepaspectratio]{#2}%
       \vfill
     }}
  }
}  

\newcommand{\ThisCenterWallPaper}[2]{%
\AddToShipoutPicture*{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){%
     \parbox[b][\paperheight]{\paperwidth}{%       
       \vfill
       \centering
       \includegraphics[width=#1\paperwidth,height=#1\paperheight,%
                        keepaspectratio]{#2}%
       \vfill
     }}}
}  



\newcommand{\TileSquareWallPaper}[2]{%
\AddToShipoutPicture{%
  \begingroup
    \setlength{\tileYoffset}{\wpYoffset}
    \setlength{\tilewidth}{\paperwidth/#1}%
    \setlength{\tileheight}{\tilewidth}%
    \setlength{\tileY}{0pt}%
    \whiledo{\lengthtest{\tileY < \paperheight}}{% 
      \setlength{\tileX}{0pt}%
      \setlength{\tileXoffset}{\wpXoffset}%
      \whiledo{\lengthtest{\tileX < \paperwidth}}{% 
        \put(\LenToUnit{\tileXoffset},\LenToUnit{\tileYoffset}){%
          \includegraphics[height=\tileheight,width=\tilewidth]{#2}}%
        \addtolength{\tileX}{\tilewidth}
        \addtolength{\tileXoffset}{\tilewidth}
      }%
      \addtolength{\tileY}{\tileheight}
      \addtolength{\tileYoffset}{\tileheight}
    }%
  \endgroup  
}%
}

\newcommand{\ThisTileSquareWallPaper}[2]{%
\AddToShipoutPicture*{%
  \begingroup
    \setlength{\tileYoffset}{\wpYoffset}
    \setlength{\tilewidth}{\paperwidth/#1}%
    \setlength{\tileheight}{\tilewidth}%
    \setlength{\tileY}{0pt}%
    \whiledo{\lengthtest{\tileY < \paperheight}}{% 
      \setlength{\tileX}{0pt}%
      \setlength{\tileXoffset}{\wpXoffset}%
      \whiledo{\lengthtest{\tileX < \paperwidth}}{% 
        \put(\LenToUnit{\tileXoffset},\LenToUnit{\tileYoffset}){%
          \includegraphics[height=\tileheight,width=\tilewidth]{#2}}%
        \addtolength{\tileX}{\tilewidth}
        \addtolength{\tileXoffset}{\tilewidth}
      }%
      \addtolength{\tileY}{\tileheight}
      \addtolength{\tileYoffset}{\tileheight}
    }%
  \endgroup  
}%
}


\newcommand{\TileWallPaper}[3]{%
\AddToShipoutPicture{%
  \begingroup
    \setlength{\tileYoffset}{\wpYoffset}
    \setlength{\tilewidth}{#1}%
    \setlength{\tileheight}{#2}%
    \setlength{\tileY}{0pt}%
    \whiledo{\lengthtest{\tileY < \paperheight}}{% 
      \setlength{\tileX}{0pt}%
      \setlength{\tileXoffset}{\wpXoffset}%
      \whiledo{\lengthtest{\tileX < \paperwidth}}{% 
        \put(\LenToUnit{\tileXoffset},\LenToUnit{\tileYoffset}){%
          \includegraphics[height=\tileheight,width=\tilewidth]{#3}}%
        \addtolength{\tileX}{\tilewidth}
        \addtolength{\tileXoffset}{\tilewidth}
      }%
      \addtolength{\tileY}{\tileheight}
      \addtolength{\tileYoffset}{\tileheight}
    }%
  \endgroup  
}%
}

\newcommand{\ThisTileWallPaper}[3]{%
\AddToShipoutPicture*{%
  \begingroup
    \setlength{\tileYoffset}{\wpYoffset}
    \setlength{\tilewidth}{#1}%
    \setlength{\tileheight}{#2}%
    \setlength{\tileY}{0pt}%
    \whiledo{\lengthtest{\tileY < \paperheight}}{% 
      \setlength{\tileX}{0pt}%
      \setlength{\tileXoffset}{\wpXoffset}%
      \whiledo{\lengthtest{\tileX < \paperwidth}}{% 
        \put(\LenToUnit{\tileXoffset},\LenToUnit{\tileYoffset}){%
          \includegraphics[height=\tileheight,width=\tilewidth]{#3}}%
        \addtolength{\tileX}{\tilewidth}
        \addtolength{\tileXoffset}{\tilewidth}
      }%
      \addtolength{\tileY}{\tileheight}
      \addtolength{\tileYoffset}{\tileheight}
    }%
  \endgroup  
}%
}

\newcommand{\ClearWallPaper}{\ClearShipoutPicture}