From e2d71ec3007e1d1f338ddf91b5a9ed0c3e080172 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 18 Sep 2014 22:57:06 +0000 Subject: facture (18sep14) git-svn-id: svn://tug.org/texlive/trunk@35196 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/xelatex/facture/exemple.pdf | Bin 20446 -> 22310 bytes Master/texmf-dist/doc/xelatex/facture/exemple.tex | 3 +- .../doc/xelatex/facture/exemplesansTVA.pdf | Bin 19043 -> 18762 bytes .../doc/xelatex/facture/exemplesansTVA.tex | 2 + Master/texmf-dist/doc/xelatex/facture/facture.pdf | Bin 92376 -> 93186 bytes Master/texmf-dist/doc/xelatex/facture/makefile | 1 + .../texmf-dist/source/xelatex/facture/facture.dtx | 79 +++++++++++++-------- Master/texmf-dist/tex/xelatex/facture/facture.cls | 45 +++++++----- 8 files changed, 79 insertions(+), 51 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/xelatex/facture/exemple.pdf b/Master/texmf-dist/doc/xelatex/facture/exemple.pdf index 90d00f0d6b3..c5900a1193a 100644 Binary files a/Master/texmf-dist/doc/xelatex/facture/exemple.pdf and b/Master/texmf-dist/doc/xelatex/facture/exemple.pdf differ diff --git a/Master/texmf-dist/doc/xelatex/facture/exemple.tex b/Master/texmf-dist/doc/xelatex/facture/exemple.tex index b78e4d01fad..09c586e7ab3 100644 --- a/Master/texmf-dist/doc/xelatex/facture/exemple.tex +++ b/Master/texmf-dist/doc/xelatex/facture/exemple.tex @@ -1,5 +1,6 @@ \documentclass{facture} \usepackage{lipsum} +\usepackage[top=2 cm, bottom=2 cm, left=1.5 cm, right=2.5 cm]{geometry} \setmainfont[Mapping=tex-text]{Linux Libertine O} \datelimite{30} \dest{Client\\ @@ -30,5 +31,5 @@ SIRET : XXXX \ligne{Produit 2}{10}[2] \end{facture} -\lipsum[1-2] +\lipsum[1-6] \end{document} \ No newline at end of file diff --git a/Master/texmf-dist/doc/xelatex/facture/exemplesansTVA.pdf b/Master/texmf-dist/doc/xelatex/facture/exemplesansTVA.pdf index c66543628bc..a092e0d7ab2 100644 Binary files a/Master/texmf-dist/doc/xelatex/facture/exemplesansTVA.pdf and b/Master/texmf-dist/doc/xelatex/facture/exemplesansTVA.pdf differ diff --git a/Master/texmf-dist/doc/xelatex/facture/exemplesansTVA.tex b/Master/texmf-dist/doc/xelatex/facture/exemplesansTVA.tex index a07a87235d6..9c939baa3c7 100644 --- a/Master/texmf-dist/doc/xelatex/facture/exemplesansTVA.tex +++ b/Master/texmf-dist/doc/xelatex/facture/exemplesansTVA.tex @@ -1,5 +1,6 @@ \documentclass[sansTVA]{facture} \usepackage{lipsum} +\usepackage[top=2 cm, bottom=2 cm, left=1.5 cm, right=2.5 cm]{geometry} \setmainfont[Mapping=tex-text]{Linux Libertine O} \datelimite{30} \dest{Client\\ @@ -24,6 +25,7 @@ SIRET : XXXX } \begin{document} \entete +\renewcommand{\largeurDescriptif}{0.1\textwidth} \begin{facture} \ligne{Produit 1}[2]{25} \ligne{Produit 2}{10}[2] diff --git a/Master/texmf-dist/doc/xelatex/facture/facture.pdf b/Master/texmf-dist/doc/xelatex/facture/facture.pdf index 3acdc09975a..13dfbcd76f4 100644 Binary files a/Master/texmf-dist/doc/xelatex/facture/facture.pdf and b/Master/texmf-dist/doc/xelatex/facture/facture.pdf differ diff --git a/Master/texmf-dist/doc/xelatex/facture/makefile b/Master/texmf-dist/doc/xelatex/facture/makefile index 6fcbb05b5f0..5132211b304 100644 --- a/Master/texmf-dist/doc/xelatex/facture/makefile +++ b/Master/texmf-dist/doc/xelatex/facture/makefile @@ -6,6 +6,7 @@ all:facture.pdf exemple.pdf exemplesansTVA.pdf %.cls:%.ins %.dtx + $(RM) $*.cls @xelatex $*.ins facture.pdf:facture.cls facture.dtx @xelatex facture.dtx diff --git a/Master/texmf-dist/source/xelatex/facture/facture.dtx b/Master/texmf-dist/source/xelatex/facture/facture.dtx index 079e0e8a4d1..a4f6c637ef9 100644 --- a/Master/texmf-dist/source/xelatex/facture/facture.dtx +++ b/Master/texmf-dist/source/xelatex/facture/facture.dtx @@ -1,5 +1,5 @@ % \iffalse meta-comment -% Droits d'auteur : Maïeul Rouquette 2011 +% Droits d'auteur : Maïeul Rouquette 2011-2014 % Licence Creative Commons - Paternité -Partage des Conditions Initiales à l'identique % http://creativecommons.org/licenses/by-sa/2.0/fr/ % \fi @@ -21,10 +21,12 @@ \end{document} % %\fi -% \CheckSum{436} -% \changes{v1.0}{2011/09/10}{Première version} +% \CheckSum{453} +% \changes{v1.0}{2011/09/10}{Première version} +% \changes{v.1.1}{2011/09/13}{Laisser le choix de la marge à l'utilisateur} % \GetFileInfo{facture.dtx} -% \title{La class \textsf{facture}\thanks{Ce document correspond à la version~1.0 de \textsf{facture}, datée du~10/09/2011.}} +%\changes{v1.1.2}{2014/09/16}{Possibilité de modifier la taille du tableau.} +% \title{La class \textsf{facture}\thanks{Ce document correspond à la version~1.2 de \textsf{facture}, datée du~16/09/2014.}} %\author{Maïeul Rouquette} %\maketitle %\begin{abstract} @@ -80,7 +82,7 @@ %Toutes ces méta-données, à l'exception du taux de TVA et du pied de page sont affichées dans une zolie présentation avec la commande. \DescribeMacro{\entete}\cmd{\entete}. %\section{Insertion de texte} % La classe étant dérivée de la classe \emph{article}, il est possible d'insérer du texte sectionnable avec les commandes de \emph{article}. Il n'y a pas d'endroit obligatoire pour l'afficher. -%\section{Insertion de la facture}. +%\section{Insertion de la facture} % Une facture est constituée de lignes indiquant les prix et quantités des différents produits. Chaque ligne s'appelle au sein de l'environnement \DescribeEnv{facture}\emph{facture}, via la commande \DescribeMacro{\ligne}\cmd{\ligne}\marg{produit}\oarg{quantité}\marg{prix unitaire HT}\oarg{remise}\oarg{taux de TVA}. % %\meta{produit} est le nom du produit. @@ -116,12 +118,15 @@ %\section{Personnalisation} % Plusieurs possibilités de personnalisation existent, en redéfinissant des commandes et/ou des couleurs. J'invite à lire le code pour savoir lesquels. %\begin{itemize} -%\item Pour les couleurs et les mise en valeurs des textes, voir section~\ref{apparence}. +%\item Pour les couleurs, les traits et les mise en valeurs des textes, voir section~\ref{apparence}. %\item Pour les réglages concernant les mathématiques (arrondis par exemple), voir section~\ref{math}. %\item Pour les textes, voir section~\ref{texte}. -%\item Pour le pieds de page, voir section~\ref{pied}. -%\item Pour l'affichage de la TVA, voir p.~\pageref{afficheTVA} +%\item Pour le pieds de page, voir section~\ref{pied}. +%\item Pour l'affichage de la TVA, voir section~\ref{afficheTVA} p.~\pageref{afficheTVA} +%\item Pour la largeur des colonnes du tableau, voir section~\ref{largeurCols}. %\end{itemize} +% +%Pour personnaliser la taille du papier et celle des marges, on peut utiliser le package \emph{geometry}. %\StopEventually{} %\section{Documentation du code} %\subsection{Chargement des packages} @@ -129,7 +134,7 @@ % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{facture}[2011/09/10 v1.0] -\LoadClass{article}%On se base sur la classe article +\LoadClass[a4paper]{article}%On se base sur la classe article \RequirePackage{fontspec} \RequirePackage{xunicode} \RequirePackage{polyglossia} @@ -139,8 +144,6 @@ \RequirePackage{tikz} % tikz est utilisé pour tracer des boites, par exemple \RequirePackage{graphicx} % Pour insérer des images. Utiliser le format jpg pour plus de simplicité. \RequirePackage{fancyhdr} % Pour entête et pied de page -\RequirePackage[paper=a4paper,top=2 cm, bottom=2 cm, left=1.5 cm, right=2.5 cm]{geometry} % On peut modifier ces valeurs pour augmenter ou réduire les marges. -\RequirePackage{ifthen} \RequirePackage{array} \RequirePackage{longtable} \RequirePackage{colortbl} @@ -161,6 +164,8 @@ \definecolor{encadre}{RGB}{111,111,111} \newcommand{\libelle}[1]{\textcolor{entetes}{\textbf#1}} \setlength{\tabcolsep}{1pt} +\newlength{\epaisseurcadre} +\setlength{\epaisseurcadre}{1.5mm} % \end{macrocode} %\subsection{Textes}\label{texte} %\subsubsection{Invariants} @@ -194,35 +199,43 @@ \newcommand{\postTotaux}{} \fi % \end{macrocode} +%\subsection{Largeur des colonnes}\label{largeurCols} +% On peut redéfinir les commandes ci-dessous pour modifier la largeur des commandes. Attention à ne pas dépasser un total de 1\cmd{\textwidth} ! +% \begin{macrocode} +\newcommand{\largeurDescriptif}{0.2\textwidth} +\newcommand{\largeurChiffres}{0.2\textwidth} +\newcommand{\largeurChiffresAvecTVA}{0.1\textwidth} +% \end{macrocode} +% %\subsection{Réglages mathématiques}\label{math} %On régle ici les paramètres mathématiques, définissables avec le package \emph{numprint}. % Tout d'abord on dit qu'on veut avoir les zéros finaux. % \begin{macrocode} \npaddmissingzero % \end{macrocode} -% Puis on dit qu'on arrondis à deux chiffres après la virgule. +% Puis on dit qu'on arrondit à deux chiffres après la virgule. % \begin{macrocode} \nprounddigits{2} % \end{macrocode} %\subsection{Quelques réglages standards} % Ici on régle la TVA par défaut et le type de document % \begin{macrocode} -\gdef\@TVAdefaut{19,6} -\gdef\@type{\facturetxt} +\def\@TVAdefaut{19,6} +\def\@type{\facturetxt} % \end{macrocode} %\subsection{Méta-données} %Toutes ces commandes sont appelées par l'utilisateurs au tout début (\emph{cf}.~section~\ref{meta}). La plupart stockent dans une commande commençant par @ le code qui est passé. % \begin{macrocode} \renewcommand{\date}[1]{\SetDate[#1]} -\newcommand{\TVAdefaut}[1]{\gdef\@TVAdefaut{#1}} -\newcommand{\datelimite}[1]{\newcommand{\@datelimite}{#1}} -\newcommand{\dest}[1]{\newcommand{\@dest}{#1}} -\newcommand{\fact}[1]{\newcommand{\@fact}{#1}} -\newcommand{\adresseemet}[1]{\gdef\@adresseemet{#1}} -\newcommand{\nomemet}[1]{\gdef\@nomemet{#1}} -\newcommand{\type}[1]{\gdef\@type{#1}} -\newcommand{\numero}[1]{\gdef\@numero{#1}} -\newcommand{\codedest}[1]{\gdef\@codedest{#1}} +\newcommand{\TVAdefaut}[1]{\def\@TVAdefaut{#1}} +\newcommand{\datelimite}[1]{\def\@datelimite{#1}} +\newcommand{\dest}[1]{\def\@dest{#1}} +\newcommand{\fact}[1]{\def\@fact{#1}} +\newcommand{\adresseemet}[1]{\def\@adresseemet{#1}} +\newcommand{\nomemet}[1]{\def\@nomemet{#1}} +\newcommand{\type}[1]{\def\@type{#1}} +\newcommand{\numero}[1]{\def\@numero{#1}} +\newcommand{\codedest}[1]{\def\@codedest{#1}} % \end{macrocode} %\subsection{Génération de l'entête} @@ -248,7 +261,7 @@ % \begin{macrocode} \coordinate[xshift=-1\textwidth,yshift=1ex] (a) at (b.north); \coordinate[xshift=1em,yshift=-1ex] (c) at (b.south); - \draw[color=encadre,line width=1.5mm] (a) rectangle (c); + \draw[color=encadre,line width=\epaisseurcadre] (a) rectangle (c); \end{tikzpicture} % \end{macrocode} % @@ -335,11 +348,11 @@ \setlength{\tabcolsep}{0.5em} \arrayrulecolor{encadre} \ifsansTVA% - \begin{longtable}{|p{0.2\textwidth}|P{0.2\textwidth}|P{0.2\textwidth}|P{0.2\textwidth}|P{0.2\textwidth}|}% + \begin{longtable}{|p{\largeurDescriptif}|P{\largeurChiffres}|P{\largeurChiffres}|P{\largeurChiffres}|P{\largeurChiffres}|}% \hline% \rowcolor{entetes}\centering\textbf\produit & \centering\textbf\quantite & \centering\textbf\prixtxt & \centering\textbf\remise & \centering\textbf\tottxt \tabularnewline[1ex]% \else% - \begin{longtable}{|p{0.2\textwidth}|P{0.1\textwidth}|P{0.1\textwidth}|P{0.1\textwidth}|P{0.1\textwidth}|P{0.2\textwidth}|P{0.1\textwidth}|}% + \begin{longtable}{|p{\largeurDescriptif}|P{\largeurChiffresAvecTVA}|P{\largeurChiffresAvecTVA}|P{\largeurChiffresAvecTVA}|P{\largeurChiffresAvecTVA}|P{\largeurChiffres}|P{\largeurChiffresAvecTVA}|}% \hline% \rowcolor{entetes}\centering\textbf\produit & \centering\textbf\quantite & \centering\textbf\prixHT & \centering\textbf\remise & \centering\textbf\totHTtxt & \centering\textbf\TVAtxt & \textbf\prixTTC \tabularnewline[1ex]% \fi% @@ -376,6 +389,7 @@ \newcommand{\lignesansTVA}[5]{#1 & #2 & #3 & #4 & #5 \tabularnewline[1ex]} % \end{macrocode} %La commande \cmd{\afficheTVA} sert à afficher la TVA dans le tableau. En ne l'indiquant pas directement dans le code de \cmd{\ligne}, on permet de personnaliser plus facilement l'affichage de la TVA. \label{afficheTVA} + % \begin{macrocode} \newcommand{\afficheTVA}[1]{\raggedleft{\numprint[\%]{#1}} \hfill $\triangleright$ \numprint[\unite]{\TVA}} % \end{macrocode} @@ -421,11 +435,14 @@ %\subsection{Apparence du pied}\label{pied} %On se base sur le package \emph{fancyhdr} pour personnaliser le pied. % \begin{macrocode} -\pagestyle{fancy} -\fancyhf{} -\renewcommand{\headrule}{}%Pas de règle après l'entête -\lfoot{\ifnumgreater{\thepage}{1}{\thepage}{}}%Indiquer le numéro de page, sauf sur la première -\newcommand{\pied}[1]{\rfoot{#1}}%Le pied définissable par l'utilisateur +\AtBeginDocument{ + \pagestyle{fancy} + \fancyhf{} + \renewcommand{\headrule}{}%Pas de règle après l'entête + \lfoot{\ifnum \value{page}>1 \thepage\fi}%Indiquer le numéro de page, sauf sur la première + \rfoot{\@pied} +} +\newcommand{\pied}[1]{\def\@pied{#1}}%Le pied définissable par l'utilisateur % \end{macrocode} % % \PrintChanges diff --git a/Master/texmf-dist/tex/xelatex/facture/facture.cls b/Master/texmf-dist/tex/xelatex/facture/facture.cls index a0c99ab02c6..5d4a9da116e 100644 --- a/Master/texmf-dist/tex/xelatex/facture/facture.cls +++ b/Master/texmf-dist/tex/xelatex/facture/facture.cls @@ -12,7 +12,7 @@ %% \NeedsTeXFormat{LaTeX2e} \ProvidesClass{facture}[2011/09/10 v1.0] -\LoadClass{article}%On se base sur la classe article +\LoadClass[a4paper]{article}%On se base sur la classe article \RequirePackage{fontspec} \RequirePackage{xunicode} \RequirePackage{polyglossia} @@ -22,8 +22,6 @@ \RequirePackage{tikz} % tikz est utilisé pour tracer des boites, par exemple \RequirePackage{graphicx} % Pour insérer des images. Utiliser le format jpg pour plus de simplicité. \RequirePackage{fancyhdr} % Pour entête et pied de page -\RequirePackage[paper=a4paper,top=2 cm, bottom=2 cm, left=1.5 cm, right=2.5 cm]{geometry} % On peut modifier ces valeurs pour augmenter ou réduire les marges. -\RequirePackage{ifthen} \RequirePackage{array} \RequirePackage{longtable} \RequirePackage{colortbl} @@ -37,6 +35,8 @@ \definecolor{encadre}{RGB}{111,111,111} \newcommand{\libelle}[1]{\textcolor{entetes}{\textbf#1}} \setlength{\tabcolsep}{1pt} +\newlength{\epaisseurcadre} +\setlength{\epaisseurcadre}{1.5mm} \newcommand{\codeclient}{Code client :} \newcommand{\datetxt}{Date:} \newcommand{\datelimitetxt}{À payer avant:} @@ -62,20 +62,23 @@ \newcommand{\totTTCtxt}{Total TTC} \newcommand{\postTotaux}{} \fi +\newcommand{\largeurDescriptif}{0.2\textwidth} +\newcommand{\largeurChiffres}{0.2\textwidth} +\newcommand{\largeurChiffresAvecTVA}{0.1\textwidth} \npaddmissingzero \nprounddigits{2} -\gdef\@TVAdefaut{19,6} -\gdef\@type{\facturetxt} +\def\@TVAdefaut{19,6} +\def\@type{\facturetxt} \renewcommand{\date}[1]{\SetDate[#1]} -\newcommand{\TVAdefaut}[1]{\gdef\@TVAdefaut{#1}} -\newcommand{\datelimite}[1]{\newcommand{\@datelimite}{#1}} -\newcommand{\dest}[1]{\newcommand{\@dest}{#1}} -\newcommand{\fact}[1]{\newcommand{\@fact}{#1}} -\newcommand{\adresseemet}[1]{\gdef\@adresseemet{#1}} -\newcommand{\nomemet}[1]{\gdef\@nomemet{#1}} -\newcommand{\type}[1]{\gdef\@type{#1}} -\newcommand{\numero}[1]{\gdef\@numero{#1}} -\newcommand{\codedest}[1]{\gdef\@codedest{#1}} +\newcommand{\TVAdefaut}[1]{\def\@TVAdefaut{#1}} +\newcommand{\datelimite}[1]{\def\@datelimite{#1}} +\newcommand{\dest}[1]{\def\@dest{#1}} +\newcommand{\fact}[1]{\def\@fact{#1}} +\newcommand{\adresseemet}[1]{\def\@adresseemet{#1}} +\newcommand{\nomemet}[1]{\def\@nomemet{#1}} +\newcommand{\type}[1]{\def\@type{#1}} +\newcommand{\numero}[1]{\def\@numero{#1}} +\newcommand{\codedest}[1]{\def\@codedest{#1}} \newcommand{\entete}{ @@ -90,7 +93,7 @@ }; \coordinate[xshift=-1\textwidth,yshift=1ex] (a) at (b.north); \coordinate[xshift=1em,yshift=-1ex] (c) at (b.south); - \draw[color=encadre,line width=1.5mm] (a) rectangle (c); + \draw[color=encadre,line width=\epaisseurcadre] (a) rectangle (c); \end{tikzpicture} \vspace{3ex} @@ -147,11 +150,11 @@ \setlength{\tabcolsep}{0.5em} \arrayrulecolor{encadre} \ifsansTVA% - \begin{longtable}{|p{0.2\textwidth}|P{0.2\textwidth}|P{0.2\textwidth}|P{0.2\textwidth}|P{0.2\textwidth}|}% + \begin{longtable}{|p{\largeurDescriptif}|P{\largeurChiffres}|P{\largeurChiffres}|P{\largeurChiffres}|P{\largeurChiffres}|}% \hline% \rowcolor{entetes}\centering\textbf\produit & \centering\textbf\quantite & \centering\textbf\prixtxt & \centering\textbf\remise & \centering\textbf\tottxt \tabularnewline[1ex]% \else% - \begin{longtable}{|p{0.2\textwidth}|P{0.1\textwidth}|P{0.1\textwidth}|P{0.1\textwidth}|P{0.1\textwidth}|P{0.2\textwidth}|P{0.1\textwidth}|}% + \begin{longtable}{|p{\largeurDescriptif}|P{\largeurChiffresAvecTVA}|P{\largeurChiffresAvecTVA}|P{\largeurChiffresAvecTVA}|P{\largeurChiffresAvecTVA}|P{\largeurChiffres}|P{\largeurChiffresAvecTVA}|}% \hline% \rowcolor{entetes}\centering\textbf\produit & \centering\textbf\quantite & \centering\textbf\prixHT & \centering\textbf\remise & \centering\textbf\totHTtxt & \centering\textbf\TVAtxt & \textbf\prixTTC \tabularnewline[1ex]% \fi% @@ -176,6 +179,7 @@ } \newcommand{\lignesansTVA}[5]{#1 & #2 & #3 & #4 & #5 \tabularnewline[1ex]} + \newcommand{\afficheTVA}[1]{\raggedleft{\numprint[\%]{#1}} \hfill $\triangleright$ \numprint[\unite]{\TVA}} \newcommandx{\ligne}[5][2=1,5=\@TVAdefaut,4=0,usedefault]{% \ifsansTVA @@ -209,11 +213,14 @@ \fi \hline } +\AtBeginDocument{ \pagestyle{fancy} \fancyhf{} \renewcommand{\headrule}{}%Pas de règle après l'entête -\lfoot{\ifnumgreater{\thepage}{1}{\thepage}{}}%Indiquer le numéro de page, sauf sur la première -\newcommand{\pied}[1]{\rfoot{#1}}%Le pied définissable par l'utilisateur +\lfoot{\ifnum \value{page}>1 \thepage\fi}%Indiquer le numéro de page, sauf sur la première +\rfoot{\@pied} +} +\newcommand{\pied}[1]{\def\@pied{#1}}%Le pied définissable par l'utilisateur \endinput %% %% End of file `facture.cls'. -- cgit v1.2.3