From 8ae03ae44ffe043b5be56d464456c3960b5789d1 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 11 Apr 2012 22:25:57 +0000 Subject: petiteannonce 1.0001 (11apr12) git-svn-id: svn://tug.org/texlive/trunk@25915 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/petiteannonce/petiteannonce.cls | 85 +++++++++++++--------- 1 file changed, 52 insertions(+), 33 deletions(-) (limited to 'Master/texmf-dist/tex/latex/petiteannonce') diff --git a/Master/texmf-dist/tex/latex/petiteannonce/petiteannonce.cls b/Master/texmf-dist/tex/latex/petiteannonce/petiteannonce.cls index 32c46e6bac7..28a20d4ce93 100644 --- a/Master/texmf-dist/tex/latex/petiteannonce/petiteannonce.cls +++ b/Master/texmf-dist/tex/latex/petiteannonce/petiteannonce.cls @@ -1,7 +1,7 @@ % %NAME% : Petiteannonce % %AUTHOR% : Vincent Bela\"\i che % %EMAIL% : vincent.b.1@hotmail.fr -% %VERSION% : v0.001 +% %VERSION% : v1.001 %% %% This is file `petiteannonce.cls'. %% @@ -24,7 +24,7 @@ \NeedsTeXFormat{LaTeX2e} \RequirePackage{graphicx} \RequirePackage{keyval} -\ProvidesClass{petiteannonce}[2008/0/22 v0.001] +\ProvidesClass{petiteannonce}[2012/04/10 v1.001] % Get font sizes \makeatletter \newcommand\@ptsize{} @@ -32,10 +32,20 @@ \DeclareOption{11pt}{\renewcommand\@ptsize{1}} \DeclareOption{12pt}{\renewcommand\@ptsize{2}} + %\typeout{} %% petiteannonce options %\DeclareOption{someoption}{do something} \ExecuteOptions{10pt} + +\newdimen\petiteannonce@margin +\petiteannonce@margin=1mm +\define@key{petiteannonce@args}{margin}{\petiteannonce@margin=#1} + +\DeclareOption*{% + \def\@tempa#1{\setkeys{petiteannonce@args}{#1}}% + \expandafter\@tempa\expandafter{\CurrentOption}% +} \ProcessOptions \input{size1\@ptsize.clo} % @@ -59,8 +69,6 @@ % * MISE-EN-PAGE : parametres * % **************************************** % -\newdimen\petiteannonce@margin -\petiteannonce@margin=1mm \topmargin =\petiteannonce@margin% marge sup. % suppression de l'offset vertical \advance\topmargin by -1in @@ -101,14 +109,19 @@ \newdimen \petiteannonce@telvspace % space before and after telephone number \newdimen \petiteannonce@texthspace % space before and after text \newdimen \petiteannonce@textvspace % space above and below text +\newdimen \petiteannonce@frame@width \newdimen \petiteannonce@width +\newdimen \petiteannonce@this@textwidth % ============================================================================ % Define keys and their default values % ============================================================================ \define@key{petiteannonce}{cols}[1]{% - \petiteannonce@cols=#1% - \petiteannonce@width=\textwidth% - \divide\petiteannonce@width by \petiteannonce@cols% + \petiteannonce@cols=#1\relax + \petiteannonce@frame@width=\textwidth + \divide\petiteannonce@frame@width by \petiteannonce@cols + \petiteannonce@width=\petiteannonce@frame@width + \advance\petiteannonce@width by -2\fboxrule + \advance\petiteannonce@width by -2\fboxsep } \define@key{petiteannonce}{count}[1]{\petiteannonce@count=#1} \define@key{petiteannonce}{cutvspace}[10pt]{\petiteannonce@cutvspace=#1} @@ -118,14 +131,14 @@ \define@key{petiteannonce}{telvspace}[10pt]{\petiteannonce@telvspace=#1} \define@key{petiteannonce}{textvspace}[10pt]{\petiteannonce@textvspace=#1} \define@key{petiteannonce}{texthspace}[20pt]{\petiteannonce@texthspace=#1} -\define@key{petiteannonce}{width}[\textwidth]{\petiteannonce@width=#1} +\define@key{petiteannonce}{width}[\textwidth]{\petiteannonce@frame@width=#1\relax + \petiteannonce@width=\petiteannonce@frame@width + \advance\petiteannonce@width by -2\fboxrule + \advance\petiteannonce@width by -2\fboxsep +} % other objects for dimensions \newcount \petiteannonce@telcount@temp -\newdimen \petiteannonce@half@colsep \newdimen \petiteannonce@half@colsep@worule % without rule -\newdimen \petiteannonce@half@telvspace -\newdimen \petiteannonce@half@texthspace -\newdimen \petiteannonce@half@textvspace \newdimen \petiteannonce@telheight% width of telephone number when horizontal + hspace \newdimen \petiteannonce@telwidth % total = height + depth of telephone number when horizontal \newdimen \petiteannonce@telwidth@temp @@ -177,25 +190,16 @@ % compute half values and other temporary dimensions and counters \petiteannonce@textwidth=\petiteannonce@width% \advance\petiteannonce@textwidth by -\petiteannonce@texthspace% - \petiteannonce@half@texthspace=\petiteannonce@texthspace% - \divide\petiteannonce@half@texthspace by 2% - \petiteannonce@half@textvspace=\petiteannonce@textvspace% - \divide\petiteannonce@half@textvspace by 2% - \petiteannonce@half@colsep=\petiteannonce@telcolsep% - \divide\petiteannonce@half@colsep by 2% - \petiteannonce@half@colsep@worule=\petiteannonce@telcolsep% - \divide\petiteannonce@half@colsep@worule by 2% + \petiteannonce@half@colsep@worule=0.5\petiteannonce@telcolsep% \advance\petiteannonce@half@colsep@worule by -\petiteannonce@telrulewidth% - \petiteannonce@half@telvspace=\petiteannonce@telvspace% - \divide\petiteannonce@half@telvspace by 2% % \sbox{\petiteannonce@tel}{\mbox{#2}}% \def\petiteannonce@text{% - \hspace{\petiteannonce@half@texthspace}% + \hspace{0.5\petiteannonce@texthspace}% \begin{minipage}{\petiteannonce@textwidth}% #3% \end{minipage}% - \hspace{\petiteannonce@half@texthspace}% + \hspace{0.5\petiteannonce@texthspace}% }% % compute tel dimension % ------------------------------ @@ -226,7 +230,7 @@ % save the telephone into a box \savebox{\petiteannonce@telbox}[\petiteannonce@telwidth]{% \rotatebox{90}{% - \hspace\petiteannonce@half@telvspace\usebox{\petiteannonce@tel}\hspace\petiteannonce@half@telvspace% + \hspace{0.5\petiteannonce@telvspace}\usebox{\petiteannonce@tel}\hspace{0.5\petiteannonce@telvspace}% }% } % define the row of repeated telephone number @@ -234,7 +238,7 @@ \def\petiteannonce@telrow {% \makebox[\petiteannonce@width]{% - \hspace\petiteannonce@half@colsep% + \hspace{0.5\petiteannonce@telcolsep}% \usebox{\petiteannonce@telbox}% \petiteannonce@telcount@temp=\petiteannonce@telcount% \loop% @@ -244,18 +248,19 @@ \usebox{\petiteannonce@telbox}% \advance\petiteannonce@telcount@temp by -1% \ifnum\petiteannonce@telcount@temp>2\repeat\relax% - \hspace\petiteannonce@half@colsep% + \hspace{0.5\petiteannonce@telcolsep}% }% }% % now make one petiteannonce - \savebox{\petiteannonce@box}[\petiteannonce@width]{% - \framebox[\petiteannonce@width]{% + \savebox{\petiteannonce@box}[\petiteannonce@frame@width]{% + \framebox[\petiteannonce@frame@width]{% \begin{minipage}{\petiteannonce@width}% - \vspace{\petiteannonce@half@textvspace}% + \vspace{0.5\petiteannonce@textvspace}% + \petiteannonce@this@textwidth=\petiteannonce@textwidth \noindent\petiteannonce@text% - \vspace{\petiteannonce@half@textvspace}% + \vspace{0.5\petiteannonce@textvspace}% \noindent \hbox to\petiteannonce@width{\dotfill}% @@ -281,8 +286,22 @@ \repeat% }% -% The advertwidth command -\def\petiteannoncewidth#1{#1\petiteannonce@width} +\@ifundefined{petiteannoncewidth}{% + \def\petiteannoncewidth#1{#1\petiteannonce@this@textwidth}% +}{% + \ClassError{petiteannonce}% + {Already defined command petiteannoncewidth}% + {Already defined command petiteannoncewidth}% +} + +\@ifundefined{petiteannonceaddtowidth}{% + \def\petiteannonceaddtowidth#1{\advance \petiteannonce@this@textwidth by #1\relax}% +}{% + \ClassError{petiteannonce}% + {Already defined command petiteannonceaddtowidth}% + {Already defined command petiteannonceaddtowidth}% +} + \makeatother % %% -- cgit v1.2.3