summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/petiteannonce
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/petiteannonce
Initial commit
Diffstat (limited to 'macros/latex/contrib/petiteannonce')
-rw-r--r--macros/latex/contrib/petiteannonce/baignoire.JPGbin0 -> 36476 bytes
-rw-r--r--macros/latex/contrib/petiteannonce/petiteannonce.cls308
-rw-r--r--macros/latex/contrib/petiteannonce/petiteannonce.doc.pdfbin0 -> 174545 bytes
-rw-r--r--macros/latex/contrib/petiteannonce/petiteannonce.doc.tex109
-rw-r--r--macros/latex/contrib/petiteannonce/petiteannonceexample.pdfbin0 -> 79209 bytes
-rw-r--r--macros/latex/contrib/petiteannonce/petiteannonceexample.tex35
6 files changed, 452 insertions, 0 deletions
diff --git a/macros/latex/contrib/petiteannonce/baignoire.JPG b/macros/latex/contrib/petiteannonce/baignoire.JPG
new file mode 100644
index 0000000000..95c9c7d3dd
--- /dev/null
+++ b/macros/latex/contrib/petiteannonce/baignoire.JPG
Binary files differ
diff --git a/macros/latex/contrib/petiteannonce/petiteannonce.cls b/macros/latex/contrib/petiteannonce/petiteannonce.cls
new file mode 100644
index 0000000000..da246ed761
--- /dev/null
+++ b/macros/latex/contrib/petiteannonce/petiteannonce.cls
@@ -0,0 +1,308 @@
+% %NAME% : Petiteannonce
+% %AUTHOR% : Vincent Bela\"\i che
+% %EMAIL% : vincent.b.1@hotmail.fr
+% %VERSION% : v1.001
+%%
+%% This is file `petiteannonce.cls'.
+%%
+%%
+%% IMPORTANT NOTICE:
+%%
+%% This file is part of the "petiteannonce" package.
+%% This package is distributed under the terms of the LaTeX Project
+%% Public License (LPPL) described in the file lppl.txt.
+%%
+%% Ce fichier fait partie de la distribution du paquetage "petiteannonce".
+%% Ce paquetage est distribué sous les termes de la License Publique
+%% du Projet LaTeX (LPPL) décrite dans le fichier lppl.txt.
+%%
+%
+% ****************************************
+% * PREAMBULE *
+% ****************************************
+%
+\NeedsTeXFormat{LaTeX2e}
+\RequirePackage{graphicx}
+\RequirePackage{keyval}
+\ProvidesClass{petiteannonce}[2012/04/10 v1.001]
+% Get font sizes
+\makeatletter
+\newcommand\@ptsize{}
+\DeclareOption{10pt}{\renewcommand\@ptsize{0}}
+\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}
+%
+% ****************************************
+% * POLICES *
+% ****************************************
+%
+\DeclareOldFontCommand{\rm}{\rmfamily}{\mathrm}
+\DeclareOldFontCommand{\sl}{\slshape}{\@nomath\sl}
+\DeclareOldFontCommand{\it}{\itshape}{\mathit}
+\DeclareOldFontCommand{\sc}{\scshape}{\@nomath\sc}
+\DeclareOldFontCommand{\bf}{\bfseries}{\mathbf}
+\DeclareOldFontCommand{\sf}{\sffamily}{\mathsf}
+\DeclareOldFontCommand{\tt}{\ttfamily}{\mathtt}
+\DeclareRobustCommand*{\cal}{\@fontswitch{\relax}{\mathcal}}
+\DeclareRobustCommand*{\mit}{\@fontswitch{\relax}{\mathnormal}}
+
+
+%
+% ****************************************
+% * MISE-EN-PAGE : parametres *
+% ****************************************
+%
+\topmargin =\petiteannonce@margin% marge sup.
+% suppression de l'offset vertical
+\advance\topmargin by -1in
+\headheight 0pt% entete
+\headsep 0mm% sep. d'entete
+\textheight 297mm
+\advance\textheight by -2\petiteannonce@margin% hauteur texte
+\footskip 0mm% sep d'embase
+%
+% total vertical 1+0+295+0=296 mm, reste 1 mm sur A4 = 297 mm.
+%
+\footnotesep 0mm%
+\marginparpush 0mm%
+%
+% marge gauche
+\oddsidemargin =\petiteannonce@margin%
+\evensidemargin =\petiteannonce@margin%
+% suppression de l'offset horizontal
+\advance \oddsidemargin by -1in%
+\advance \evensidemargin by -1in%
+\textwidth 210mm
+\advance\textwidth by -2\petiteannonce@margin%largeur texte
+\marginparsep 0mm% separation note lat\'erale
+\marginparwidth 0mm% largeur note latérale
+%
+% total horizontal 1+208+0+0=209 mm, reste 1 mm sur A4 = 210 mm.
+%
+\skip\footins 4mm plus 2pt minus 4pt%
+\pagestyle{empty}
+
+% objects for keyval-ed arguments
+\newcount \petiteannonce@cols
+\newcount \petiteannonce@count
+\newcount \petiteannonce@skip
+\newdimen \petiteannonce@cutvspace
+\newdimen \petiteannonce@telcolsep % separation between telephone columns
+\newdimen \petiteannonce@telrulewidth
+\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\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}
+\define@key{petiteannonce}{skip}[0]{\petiteannonce@skip=#1}
+\define@key{petiteannonce}{telcolsep}[10pt]{\petiteannonce@telcolsep=#1}
+\define@key{petiteannonce}{telrulewidth}[0.5pt]{\petiteannonce@telrulewidth=#1}
+\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@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@worule % without rule
+\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
+\newdimen \petiteannonce@textwidth
+\newdimen \petiteannonce@width@min@colsep % width reduced by column separator.
+% counters for counting telephone number strips
+\newcount \petiteannonce@telcount
+\newcount \petiteannonce@telcount@minone % same as above minus 1
+% counters for counting petiteannonce
+\newcount \petiteannonce@count@temp
+\newcount \petiteannonce@col@temp
+% boxes
+\newsavebox{\petiteannonce@telbox}
+\newsavebox{\petiteannonce@box}
+\newsavebox{\petiteannonce@tel}
+
+% ==============================================================================
+% The \petiteannonce command:
+%
+% Arg 1 = Telephone number
+% Arg 2 = Advertisement text
+% Arg 3 (optional) = Option keys
+% ==============================================================================
+\newcommand\petiteannonce[3][]{%
+ % Omitting keyed arguments is same as setting them to their default values
+ \KV@petiteannonce@cols@default{}%
+ \KV@petiteannonce@count@default{}%
+ \KV@petiteannonce@cutvspace@default{}%
+ \KV@petiteannonce@skip@default{}%
+ \KV@petiteannonce@telcolsep@default{}%
+ \KV@petiteannonce@telrulewidth@default{}%
+ \KV@petiteannonce@telvspace@default{}%
+ \KV@petiteannonce@texthspace@default{}%
+ \KV@petiteannonce@textvspace@default{}%
+ \KV@petiteannonce@width@default{}%
+ % parse keyed arguments
+ \setkeys{petiteannonce}{#1}%
+ % consistency checks
+ \ifnum\petiteannonce@cols<1\relax%
+ \ClassError{petiteannonce}%
+ {non positive cols key value}%
+ {The value of key cols shall be positive;\MessageBreak
+ cols value will be forced to 1.}%
+ \petiteannonce@cols=1
+ \fi%
+ % consistency check is To Be Compeleted
+ \petiteannonce@width@min@colsep=\petiteannonce@width%
+ \advance\petiteannonce@width@min@colsep by -\petiteannonce@telcolsep%
+ % compute half values and other temporary dimensions and counters
+ \petiteannonce@textwidth=\petiteannonce@width%
+ \advance\petiteannonce@textwidth by -\petiteannonce@texthspace%
+ \petiteannonce@half@colsep@worule=0.5\petiteannonce@telcolsep%
+ \advance\petiteannonce@half@colsep@worule by -\petiteannonce@telrulewidth%
+ %
+ \sbox{\petiteannonce@tel}{\mbox{#2}}%
+ \def\petiteannonce@text{%
+ \hspace{0.5\petiteannonce@texthspace}%
+ \begin{minipage}{\petiteannonce@textwidth}%
+ #3%
+ \end{minipage}%
+ \hspace{0.5\petiteannonce@texthspace}%
+ }%
+ % compute tel dimension
+ % ------------------------------
+ %
+ % tel-width = total height+depth when looked at horizontally
+ % this is a first approximate that is going to be refined later on
+ \settoheight{\petiteannonce@telwidth}{\usebox{\petiteannonce@tel}}%
+ \settodepth{\petiteannonce@telwidth@temp}{\usebox{\petiteannonce@tel}}%
+ \advance\petiteannonce@telwidth by \petiteannonce@telwidth@temp%
+ % tel-height = width when looked at horizontally + some vspace
+ \settowidth{\petiteannonce@telheight}{\usebox{\petiteannonce@tel}}
+ \advance\petiteannonce@telheight by \petiteannonce@telvspace
+ % compute into \petiteannonce@telwidth@temp the number of columns (as a real number)
+ \advance\petiteannonce@telwidth by \petiteannonce@telcolsep
+ \petiteannonce@telwidth@temp=\petiteannonce@width%
+ %\advance\petiteannonce@telwidth@temp by \petiteannonce@telcolsep
+ \divide\petiteannonce@telwidth@temp by \petiteannonce@telwidth
+ \petiteannonce@telcount=\petiteannonce@telwidth@temp % floor
+ % column count - 1
+ \petiteannonce@telcount@minone=\petiteannonce@telcount
+ \advance\petiteannonce@telcount@minone by -1
+ % refine tel width now
+ \petiteannonce@telwidth@temp=\petiteannonce@telcolsep
+ \multiply\petiteannonce@telwidth@temp by \petiteannonce@telcount
+ \petiteannonce@telwidth=\petiteannonce@width
+ \advance\petiteannonce@telwidth by - \petiteannonce@telwidth@temp
+ \divide\petiteannonce@telwidth by \petiteannonce@telcount
+ % save the telephone into a box
+ \savebox{\petiteannonce@telbox}[\petiteannonce@telwidth]{%
+ \rotatebox{90}{%
+ \hspace{0.5\petiteannonce@telvspace}\usebox{\petiteannonce@tel}\hspace{0.5\petiteannonce@telvspace}%
+ }%
+ }
+ % define the row of repeated telephone number
+ % -----------------------------------------------
+ \def\petiteannonce@telrow
+ {%
+ \makebox[\petiteannonce@width]{%
+ \hspace{0.5\petiteannonce@telcolsep}%
+ \usebox{\petiteannonce@telbox}%
+ \petiteannonce@telcount@temp=\petiteannonce@telcount%
+ \loop%
+ \hspace\petiteannonce@half@colsep@worule%
+ \vrule width\petiteannonce@telrulewidth height\petiteannonce@telheight%
+ \hspace\petiteannonce@half@colsep@worule%
+ \usebox{\petiteannonce@telbox}%
+ \advance\petiteannonce@telcount@temp by -1%
+ \ifnum\petiteannonce@telcount@temp>2\repeat\relax%
+ \hspace{0.5\petiteannonce@telcolsep}%
+ }%
+ }%
+ % now make one petiteannonce
+ \savebox{\petiteannonce@box}[\petiteannonce@frame@width]{%
+ \framebox[\petiteannonce@frame@width]{%
+ \begin{minipage}{\petiteannonce@width}%
+ \vspace{0.5\petiteannonce@textvspace}%
+
+ \petiteannonce@this@textwidth=\petiteannonce@textwidth
+ \noindent\petiteannonce@text%
+
+ \vspace{0.5\petiteannonce@textvspace}%
+
+ \noindent \hbox to\petiteannonce@width{\dotfill}%
+
+ \vspace{\petiteannonce@cutvspace}%
+
+ \noindent\petiteannonce@telrow%
+ \end{minipage}%
+ }%
+ }%
+ % now the petiteannonce main loop
+ \petiteannonce@count@temp=\petiteannonce@skip%
+ \petiteannonce@col@temp=1%
+ %
+ \noindent%
+ \loop\ifnum\petiteannonce@count@temp<\petiteannonce@count\relax%
+ \usebox{\petiteannonce@box}%
+ \advance\petiteannonce@count@temp by 1%
+ \advance\petiteannonce@col@temp by 1%
+ \ifnum\petiteannonce@col@temp=\petiteannonce@cols\relax%
+ \newline%
+ \petiteannonce@col@temp=1%
+ \fi%
+ \repeat%
+ }%
+
+\@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
+%
+%%
+%% End of file `petiteannonce.cls.
diff --git a/macros/latex/contrib/petiteannonce/petiteannonce.doc.pdf b/macros/latex/contrib/petiteannonce/petiteannonce.doc.pdf
new file mode 100644
index 0000000000..1ab73120f2
--- /dev/null
+++ b/macros/latex/contrib/petiteannonce/petiteannonce.doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/petiteannonce/petiteannonce.doc.tex b/macros/latex/contrib/petiteannonce/petiteannonce.doc.tex
new file mode 100644
index 0000000000..b596e73338
--- /dev/null
+++ b/macros/latex/contrib/petiteannonce/petiteannonce.doc.tex
@@ -0,0 +1,109 @@
+\documentclass{article}
+\usepackage{pdfpages,fancyvrb}
+\usepackage{siunitx}
+\title{Petiteannonce package documentation}
+\author{Vincent Bela\"\i che}
+\begin{document}
+
+\maketitle
+\section{Introduction}
+This is the documentation of the petiteannonce package. The aim of this package is to
+make adverts that you would pin down on some notice board in a mall with your
+phone number repeated on strips. This practice is quite common in France as it
+is simple, cheap (no fee for intermediates like eBay\texttrademark),
+and allows you to reach people in the same neighbourhood (so no need for
+postal fee either).
+
+\section{Package options}
+
+There is one single class option \verb!margin!, this is used to set the margin value, by default this is
+\SI{1}{\milli\metre}. For instance use:
+
+\verb!\documentclass[margin=3mm]{petiteannonce}!
+
+\noindent if you want it to be \SI{3}{\milli\metre} instead of \SI{1}{\milli\metre}.
+
+\section{Commands}
+
+There are three commands the \verb!\petiteannonce! command, the \verb!\petiteannoncewidth!
+command, and the \verb!\petiteannonceaddtowidth! command.
+
+\subsection{The \textbackslash petiteannonce command}
+
+The \verb!\petiteannonce! command is used to create the advertisement. It takes two
+mandatory arguments and one optional argument.
+\begin{itemize}
+\item The 1\textsuperscript{st} mandatory argument is the phone number or
+ email address where to reach the seller.
+\item The 2\textsuperscript{nd} mandatory argument is the text of the advert itself
+\item The optional argument is a list of comma separated \(<\textit
+ key\/>=<\textit{value\/}>\) arguments that allows to configure a number of
+ additional things. Absence of the key is equivalent to setting it to its
+ default value. The supported keys are the following:
+ \begin{list}{}{}
+ \item [cols] positive integer with default value 1. Specifies the
+ number of columns of the document that is used to compute the width of
+ the advert. When the advert is repeated, a new paragraph is generated
+ every {\em cols\/} columns.
+ \item [count] positive integer with default value 1. Tells the number of
+ times the advert is repeated.
+ \item [cutvspace] dimension with default value 10pt. Tell the vertical space
+ under to horizontal dotted line that is provided for cutting one strip.
+ \item [skip] non negative integer with default value 0. The value shall be
+ less than {\em cols\/}. Specifies that the first {\em skip\/}
+ advert are not generated. This may be useful when you want to make several
+ adverts in the same document.
+ \item [texthspace] dimension with default value 20pt. This key allows to
+ specify the space evenly placed before and after advert text.
+ \item [textvspace] dimension with default value 10pt. This key allows to
+ specify the space evenly placed above and below text.
+ \item [telcolsep] dimension with default value 10pt. This key allows to
+ specify the separation between two telephone strips, that is to say the
+ horizontal space between the telephone numbers.
+ \item [telrulewidth] dimension with default value 0.5pt. Width of the
+ vertical rule separating two telephone strips.
+ \item [telvspace] dimension with default value 10pt. Vertical space shared
+ equally above and below the telephone number in the strip (this space is
+ one the before and after the number if you look at the strip horizontally).
+ \item [width] dimension with default value \verb!\textwidth!. Overloads the value
+ computed with {\em cols\/}. In such a case take care to place the {\em
+ width\/} argument after the {\em cols\/} argument. This specifies the advert total width, including the
+ frame rule width, rule separator, and all the internal spaces.
+ \end{list}
+\end{itemize}
+
+\subsection{The \textbackslash petiteannoncewidth and \textbackslash petiteannonceaddtowidth commands}
+
+The \verb!\petiteannoncewidth! command takes one argument \#1 and expands into \#1 \(\times\) the width of the
+advert text. This is useful when you use a tabular to make the text of the advert like in the example given in
+\S~\ref{sec:sample-code}.
+
+The \verb!\petiteannonceaddtowidth! command takes one argument that is some offset to add to the advert
+textwidth. A use of that is given in example of \S~\ref{sec:sample-code}, where the advert text is within an
+array, and one wants to take into account the \verb!\tabcolsep! half column separation.
+
+\subsection{Changing the outside frame}
+
+The frame around the advert is generated with a standard \verb!\framebox! command, so you can play with it by
+changing \verb!\fboxsep! and \verb!\fboxrule!.
+
+\section{Sample code}
+\label{sec:sample-code}
+
+The following sample code will expand into the advertisement page at the page
+this sample code.
+
+
+\VerbatimInput{petiteannonceexample.tex}
+
+
+
+\includepdf{petiteannonceexample}
+
+\end{document}
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-PDF-mode: t
+%%% TeX-master: t
+%%% End:
diff --git a/macros/latex/contrib/petiteannonce/petiteannonceexample.pdf b/macros/latex/contrib/petiteannonce/petiteannonceexample.pdf
new file mode 100644
index 0000000000..38b472971a
--- /dev/null
+++ b/macros/latex/contrib/petiteannonce/petiteannonceexample.pdf
Binary files differ
diff --git a/macros/latex/contrib/petiteannonce/petiteannonceexample.tex b/macros/latex/contrib/petiteannonce/petiteannonceexample.tex
new file mode 100644
index 0000000000..3a295aa8d3
--- /dev/null
+++ b/macros/latex/contrib/petiteannonce/petiteannonceexample.tex
@@ -0,0 +1,35 @@
+\documentclass[margin=3mm]{petiteannonce}
+\usepackage{siunitx}
+\usepackage{graphicx}
+\usepackage{array}
+\usepackage{eurosym}
+\begin{document}
+
+\petiteannonce[cols=2, count=4]%
+{02 99 yy yy yy}
+{%
+ \tabcolsep=10pt\relax
+ \petiteannonceaddtowidth{-2\tabcolsep}%
+ \begin{tabular}%
+ {@{}m{\petiteannoncewidth{0.5}}m{\petiteannoncewidth{0.5}}@{}}
+ \multicolumn{2}{@{}c@{}}{\Large \dotfill Vend Baignoire enfant \dotfill }\\
+ \hline\\
+ Vend baignoire enfant.\newline
+ Dimensions \(\SI {80}{\centi \metre }\times \SI
+ {30}{\centi \metre }\)\newline
+ Prix 20\si{~}\euro
+ &
+ \includegraphics[width=\petiteannoncewidth{0.5}]{baignoire.jpg}
+ \end{tabular}
+}
+
+
+
+
+\end{document}
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: t
+%%% TeX-PDF-mode: t
+%%% End: