From d340c324cfbe63068a5ef7776b8debfe2f20f8a1 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 29 Aug 2007 20:35:06 +0000 Subject: new latex package image-gallery (27aug07) git-svn-id: svn://tug.org/texlive/trunk@4838 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/image-gallery/image-gallery.cls | 127 +++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/image-gallery/image-gallery.cls (limited to 'Master/texmf-dist/tex/latex/image-gallery') diff --git a/Master/texmf-dist/tex/latex/image-gallery/image-gallery.cls b/Master/texmf-dist/tex/latex/image-gallery/image-gallery.cls new file mode 100644 index 00000000000..2f364b556e1 --- /dev/null +++ b/Master/texmf-dist/tex/latex/image-gallery/image-gallery.cls @@ -0,0 +1,127 @@ + +% Rolf Niepraschk +% +% This file 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 2003/12/01 or later. + +%\errorcontextlines=100 + +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{image-gallery}[2007/08/27 v1.0h image gallery -- RN] +\DeclareOption{dummy}{% + \AtEndOfClass{% + \renewcommand*\IG@image[2][]{\rule{\IG@width}{\IG@height}}% + \renewcommand*\IG@fillBox{% + \textcolor{red}{\rule{\IG@width}{\IG@height}}}% + \RequirePackage{color}% + }% +} +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} +\ProcessOptions\relax +\LoadClass[10pt]{article} + +\RequirePackage{graphicx,keyval,url} +\RequirePackage[margin={0mm,0mm},dvips]{geometry} + +\newcommand*\IG@image[2][]{% + \let\IG@tempa=\@empty + \ifIG@autorotate + \sbox\IG@box{\includegraphics[#1]{#2}}% + \ifdim\wd\IG@box<\ht\IG@box + \def\IG@tempa{angle=90,}% + \fi + \setbox\IG@box\box\voidb@x + \fi + \expandafter\includegraphics\expandafter[\IG@tempa#1]{#2}% +} + +\newcommand*\IG@fillBox{\mbox{\phantom{\rule{\IG@width}{\IG@height}}}} + +\newlength\IG@width \newlength\IG@height +\newlength\IG@top \newlength\IG@bottom +\newlength\IG@left \newlength\IG@right +\newif\ifIG@more +\newcommand*\IG@rows{} \newcommand*\IG@columns{} +\newcommand*\IG@tempa{} \newcommand*\IG@imagefile{} +\newread\IG@input +\newsavebox\IG@box +\newif\ifIG@autorotate \IG@autorotatetrue + +\define@key{IG}{width}{\setlength\IG@width{#1}} +\define@key{IG}{height}{\setlength\IG@height{#1}} +\define@key{IG}{top}{\setlength\IG@top{#1}} +\define@key{IG}{bottom}{\setlength\IG@bottom{#1}} +\define@key{IG}{left}{\setlength\IG@left{#1}} +\define@key{IG}{right}{\setlength\IG@right{#1}} +\define@key{IG}{rows}{\edef\IG@rows{\number#1}} +\define@key{IG}{columns}{\edef\IG@columns{\number#1}} +\define@key{IG}{autorotate}[true]{\csname IG@autorotate#1\endcsname} + +\newcommand*\gallerySetup[1]{% + \setkeys{IG}{#1} + \geometry{left=\IG@left,right=\IG@right,top=\IG@top,bottom=\IG@bottom} +} + +\newcommand*\makeGallery[1]{% + \begingroup + \immediate\openin\IG@input=#1\relax + \IG@moretrue\@tempcnta=\z@\@tempcntb=\@ne + \endlinechar=\m@ne + \loop + \ifeof\IG@input\IG@morefalse\else + \read\IG@input to\IG@imagefile + \if\IG@imagefile\par\else + \ifx\IG@imagefile\@empty\else + \advance\@tempcnta\@ne + \makebox[\IG@width][c]{% + \IG@image[width=\IG@width,height=\IG@height,keepaspectratio]% + {\IG@imagefile}}% + \makebox[0pt][c]{% + \hskip-\IG@width\raisebox{-\ht\strutbox}[0pt][0pt]{% + \expandafter\IG@showname\expandafter{\IG@imagefile}}}% + \ifnum\@tempcnta=\IG@columns\relax + \@tempcnta=\z@ \par + \ifnum\@tempcntb=\IG@rows\relax + \@tempcntb=\@ne \newpage + \else + \advance\@tempcntb\@ne \vfill + \fi + \else + \hfill + \fi + \fi + \fi + \fi + \ifIG@more\repeat + \immediate\closeout\IG@input + \IG@moretrue + \ifnum\@tempcntb=\@ne\else + \loop + \advance\@tempcnta\@ne + \IG@fillBox + \ifnum\@tempcnta=\IG@columns\relax + \@tempcnta=\z@ \par + \ifnum\@tempcntb=\IG@rows\relax + \@tempcntb=\@ne \IG@morefalse + \else + \advance\@tempcntb\@ne \vfill + \fi + \else + \hfill + \fi + \ifIG@more\repeat + \fi + \endgroup +} + +\parindent=\z@ \pagestyle{empty} +\DeclareUrlCommand\IG@showname{\urlstyle{same}} + +\endinput -- cgit v1.2.3