Open main menu

Changes

1,533 bytes added ,  09:38, 25 May 2015
no edit summary
At my work, we have to add some sort of revision history to certain < [[Sample documents.]]
At my work, we have to add some sort of revision history to certain documents. This is also an example for the use of \getparameters (see [[media:Changes.pdf|example pdfCommands with KeyVal arguments]]).
A downloadable version of the macro is available [[media:Changes.tex|here]], and a PDF example of the output [[media:Changes.pdf|here]]. Note that background=screen is depricated and should be replaced by something like background=color,backgroundcolor=gray. <small><pretexcode>
\useregime[il1]
\enableregime[il1]
\def\BigTitle{\centerline{\framed[width=\BigWidth,offset=2mm,
background=screen]{\bfb\setupinterlinespace\cbox{Title}}}}
\def\Auteur{Peter}
\def\startChanges{\hbox to \hsize\bgroup\hss\SetTableToWidth{\BigWidth}%
\starttable[s1 | c | c | p(95mm) | p(17mm) | p(37mm) |]
\HL\BL[5]\AR\VL RévRv.\VL Date\VL Origine de la mise à jour\VL§ VL modifié\VL
Auteur\VL\AR\HL}
\def\stopChanges{\stoptable\hss\egegroup}\newcount\RevC\def\Changes[#1]{% \getgparameters[Changes][Date=,Labels=,#1]% Auteur, Modif, Labels, Date \doifundefined{ChangesAuteur}{\gdef\ChangesAuteur{\Auteur}}% \doifundefined{ChangesModif}{\gdef\ChangesModif{First version}}% \ifnum\RevC=0 \BigTitle \vskip0.5ex \Vfil \startChanges \fi \global\advance\RevC by 1 \VL \the\RevC \VL \ChangesDate \VL \ChangesModif \VL \expandafter\In\expandafter[\ChangesLabels,\relax]\VL \ChangesAuteur \VL\AR\HL}\def\Destinataires#1{\stopChanges\Vfil \def\temp{#1}\ifx\temp\empty\else\noindenting Destinataires:\crlf#1\blank\fi\centerline{\SetTableToWidth{\BigWidth}%\bf\starttable[| c | c | c |]\HL\BL[3]\AR\VL Approbateur\VL Date\VL Visa\VL\AR\HL\VL\vbox to 2cm{}\VL\VL\VL\AR\HL\stoptable}\par\page\completecontent} \starttext\Changes[Date=1/2/2004]\Changes[Date=3/4/2004,Modif=Some modifications,Labels={sec:S1,sec:S2}, Auteur=Jérôme]\Changes[Date=5/6/2004,Modif=Some other modifications,Labels=sec:S2]%\Destinataires{Peter, Olivier} \section[sec:S1]{A section}some text\subsection{Bla}\subsection{Bla} \section[sec:S2]{Another section}some text\stoptext</pretexcode[[Category:Sample documents]]
17

edits