561 lines
20 KiB
OpenEdge ABL
561 lines
20 KiB
OpenEdge ABL
|
% Syntaxe générale de \place
|
|||
|
% \place x[largeur] position[align] \objet{...}
|
|||
|
% \colonne x[largeur] position[align] {...}
|
|||
|
% x: première colonne
|
|||
|
% largeur: nombre de colonnes (ou 1 si non spécifié)
|
|||
|
% position: t = top, b = bottom, rien = remplir la page
|
|||
|
% align: n° de colonne sur laquelle aligner (libre par défaut)
|
|||
|
%
|
|||
|
% À faire :
|
|||
|
% - pouvoir spécifier (taille) au lieu de [align] avec (taille) = une
|
|||
|
% taille en unités standard
|
|||
|
% - intertitres
|
|||
|
% - utiliser keyval pour les options ?
|
|||
|
% - XXX \endmakecols ne marche pas si \makecols est aligné
|
|||
|
% - virer \colonne en bricolant \output
|
|||
|
%
|
|||
|
%
|
|||
|
%
|
|||
|
%
|
|||
|
%<<<1 Introduction
|
|||
|
% 2007/05/27 Adaptation à XeTeX
|
|||
|
\XeTeXdefaultencoding utf-8
|
|||
|
\RequirePackage{fontspec}
|
|||
|
%\RequirePackage{bidi}
|
|||
|
% Pour les tirets cadratins et demi-cadratins à base de -- et ---
|
|||
|
\defaultfontfeatures{Mapping=tex-text}
|
|||
|
%<<<2 Options de paquet
|
|||
|
\RequirePackage[xetex]{color}
|
|||
|
\let\J@color\color
|
|||
|
\DeclareOption{a3paper}{\paperheight 420mm \paperwidth 297mm}%
|
|||
|
\DeclareOption{a4paper}{\paperheight 297mm \paperwidth 210mm}%
|
|||
|
\DeclareOption{a5paper}{\paperheight 210mm \paperwidth 148mm}%
|
|||
|
\DeclareOption{letterpaper}{\paperheight 11in \paperwidth 8.5in}%
|
|||
|
\DeclareOption{legalpaper}{\paperheight 14in \paperwidth 8.5in}%
|
|||
|
\DeclareOption{executivepaper}{\paperheight 10.5in \paperwidth 7.25in}%
|
|||
|
\DeclareOption{landscape}{%
|
|||
|
\advance\paperheight\paperwidth
|
|||
|
\advance\paperwidth-\paperheight \paperwidth-\paperwidth
|
|||
|
\advance\paperheight-\paperwidth \paperheight-\paperheight}
|
|||
|
\DeclareOption{10pt}{\def\@ptsize{10}}%
|
|||
|
\DeclareOption{11pt}{\def\@ptsize{11}}%
|
|||
|
\DeclareOption{12pt}{\def\@ptsize{12}}%
|
|||
|
\DeclareOption*{\ClassWarning{journal}{Option \CurrentOption inconnue}}%
|
|||
|
\ExecuteOptions{a4paper,10pt}%
|
|||
|
\ProcessOptions
|
|||
|
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
|
|||
|
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
|
|||
|
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
|
|||
|
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}
|
|||
|
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
|
|||
|
\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl}
|
|||
|
\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc}
|
|||
|
\input{size\@ptsize.clo}%
|
|||
|
%<<<2 Paramètres
|
|||
|
% Nombre de colonnes
|
|||
|
\newcount\columns \columns=3
|
|||
|
% Séparation verticale entre les objets
|
|||
|
\newdimen\objsep
|
|||
|
% Tokens pour les objets
|
|||
|
\newtoks\J@obj@toks
|
|||
|
% Variables temporaires à volonté
|
|||
|
\newdimen\J@dim@a
|
|||
|
\newdimen\J@dim@b
|
|||
|
\newdimen\J@dim@c
|
|||
|
\newcount\J@cnt@a
|
|||
|
\newcount\J@cnt@b
|
|||
|
\newbox\J@box@a
|
|||
|
% Un offset pour le recolonnage
|
|||
|
\newdimen\J@offset
|
|||
|
|
|||
|
% Les dimensions pour le colonnage
|
|||
|
\columnsep 5mm
|
|||
|
\objsep 4mm
|
|||
|
\topskip 0pt
|
|||
|
% Les dimensions LaTeX
|
|||
|
\arraycolsep 3pt \tabcolsep 3pt \arrayrulewidth .4pt
|
|||
|
|
|||
|
%<<<2 \ignorepar, c'est un genre de \ignorespaces, en mieux.
|
|||
|
% Merci Knuth
|
|||
|
\let\J@par=\\
|
|||
|
\def\\{\let\stoken= }\\ % now \stoken is a space token
|
|||
|
\let\\\J@par
|
|||
|
\let\J@par=\par
|
|||
|
\def\ignorepar{\futurelet\J@tmp@a\J@testpar}%
|
|||
|
\def\J@testpar{\ifx\J@tmp@a\par \let\par=\ignorepar \else
|
|||
|
\ifx\J@tmp@a\stoken\let\par=\ignorepar \ignorespaces \else
|
|||
|
\let\par=\J@par\fi\fi}%
|
|||
|
%<<<2 Allocation des registres pour les colonnes. Il y en a deux par colonne:
|
|||
|
% \botcol@n taille verticale restant disponible
|
|||
|
% \topcol@n ordonnée où commence la place libre
|
|||
|
% On ne peut utiliser ici \J@obj@do car il faut justement construire le nom
|
|||
|
% de topcol@i etc.
|
|||
|
\def\J@alloc{%
|
|||
|
\J@cnt@a=0 \loop \ifnum\J@cnt@a<\columns \advance\J@cnt@a by 1
|
|||
|
\edef\J@tmp@a{\romannumeral\J@cnt@a}%
|
|||
|
% On n'alloue des registres que s'il n'existent pas déjà
|
|||
|
\expandafter\ifx\csname topcol@\J@tmp@a\endcsname\relax
|
|||
|
\expandafter\newdimen\csname topcol@\J@tmp@a\endcsname\fi
|
|||
|
\expandafter\ifx\csname botcol@\J@tmp@a\endcsname\relax
|
|||
|
\expandafter\newdimen\csname botcol@\J@tmp@a\endcsname\fi
|
|||
|
\repeat
|
|||
|
}%
|
|||
|
%<<<2 \newpage
|
|||
|
% Il faut bien sûr redéfinir \newpage pour remettre en place l'espace
|
|||
|
% libre dans les colonnes.
|
|||
|
\let\J@newpage=\newpage
|
|||
|
\def\J@columns{%
|
|||
|
\J@dim@a=\hsize
|
|||
|
\J@dim@b=\columnsep \multiply\J@dim@b by \columns
|
|||
|
\advance\J@dim@b by -\columnsep
|
|||
|
\advance\J@dim@a by -\J@dim@b
|
|||
|
\divide\J@dim@a by \columns \columnwidth=\J@dim@a%
|
|||
|
}%
|
|||
|
\def\pageinit{%
|
|||
|
\J@columns
|
|||
|
\J@alloc
|
|||
|
\J@dim@a=\z@
|
|||
|
\J@dim@b=\vsize
|
|||
|
\J@obj@first=1 \J@obj@span=\columns
|
|||
|
\def\col@do{\topcol@\J@dim@a \botcol@\J@dim@b}\J@obj@do\col@do
|
|||
|
\parindent\z@
|
|||
|
}%
|
|||
|
\def\newpage{\J@newpage \pageinit}%
|
|||
|
|
|||
|
%<<<1 Positionnement des objets
|
|||
|
%<<<2 Algorithme de positionnement
|
|||
|
%<<<3 Déclaration des registres
|
|||
|
% Position logique d'un objet (en colonnes)
|
|||
|
\newcount\J@obj@first \newcount\J@obj@span
|
|||
|
% Taille physique d'un objet
|
|||
|
\newdimen\J@obj@ht \newdimen\J@obj@wd \newdimen\J@obj@align
|
|||
|
% Boîte où est rangée l'objet
|
|||
|
\newbox\J@obj@box
|
|||
|
%<<<3 Fonctions utiles
|
|||
|
% \J@obj@do - Applique la fonction #1 sur l'étendue de colonnes
|
|||
|
% [ \J@obj@first, \J@obj@first + \J@obj@span - 1 ]
|
|||
|
\def\J@obj@do#1{\J@cnt@a=0 \J@cnt@b=\J@obj@first \loop
|
|||
|
\ifnum\J@cnt@a<\J@obj@span \advance\J@cnt@a by 1
|
|||
|
\expandafter\let\expandafter\topcol@
|
|||
|
\csname topcol@\romannumeral\J@cnt@b\endcsname
|
|||
|
\expandafter\let\expandafter\botcol@
|
|||
|
\csname botcol@\romannumeral\J@cnt@b\endcsname
|
|||
|
#1\advance\J@cnt@b by 1 \repeat}%
|
|||
|
% \J@top, \J@bot - met dans \J@dim@a les bornes de l'espace disponible en
|
|||
|
% haut (ou en bas).
|
|||
|
\def\J@top{\J@dim@a=-1cm
|
|||
|
\def\col@do{\ifdim\J@dim@a<\topcol@ \J@dim@a=\topcol@\fi}%
|
|||
|
\J@obj@do\col@do}%
|
|||
|
\def\J@bot{\J@dim@a=\vsize\advance\J@dim@a 1cm
|
|||
|
\def\col@do{\ifdim\J@dim@a>\botcol@ \J@dim@a=\botcol@\fi}%
|
|||
|
\J@obj@do\col@do}
|
|||
|
%<<<3 Fonction de positionnement
|
|||
|
\def\place{\@killglue \J@obj@ht\vsize
|
|||
|
\def\J@calc@obj@ht{\ifdim\J@obj@ht>\J@dim@c \J@obj@ht\J@dim@c\fi}%
|
|||
|
\let\J@obj@ex\ignorespaces\@J@obj@first}%
|
|||
|
\def\J@calc@obj@x{\J@dim@a=\columnwidth \advance\J@dim@a by \columnsep
|
|||
|
\advance\J@cnt@b by -1 \multiply \J@dim@a by \J@cnt@b
|
|||
|
\advance\J@dim@a by\J@offset
|
|||
|
\advance\J@cnt@b by 1}%
|
|||
|
% Appeler l'objet pour qu'il calcule ce qui est nécessaire
|
|||
|
\def\J@place{\J@obj@ht=\ht\J@obj@box\advance\J@obj@ht by\dp\J@obj@box
|
|||
|
% Calculer les coordonnées (\J@dim@a, \J@dim@b) où placer l'objet
|
|||
|
\J@obj@check
|
|||
|
\ifx t\J@obj@dir
|
|||
|
\J@dim@b=\z@
|
|||
|
\def\calc@y{\J@dim@c=\topcol@ \advance\J@dim@c by \ht\J@obj@box
|
|||
|
\ifdim\J@dim@c>\J@dim@b \J@dim@b=\J@dim@c\fi}%
|
|||
|
\def\col@chk{\J@dim@c=-\topcol@ \advance\J@dim@c by -\ht\J@obj@box
|
|||
|
\advance\J@dim@c by \J@dim@b
|
|||
|
\ifdim\J@dim@c>\baselineskip \ClassWarning{journal}{%
|
|||
|
\the\J@dim@c\space unused at top of column \the\J@cnt@b}\fi
|
|||
|
}%
|
|||
|
\def\adj@col{\topcol@=\J@dim@b
|
|||
|
\advance\topcol@ by\dp\J@obj@box \advance\topcol@ by \objsep}%
|
|||
|
\else
|
|||
|
\ifx b\J@obj@dir
|
|||
|
\J@dim@b=\vsize
|
|||
|
\def\calc@y{\J@dim@c=\botcol@ \advance\J@dim@c by-\dp\J@obj@box
|
|||
|
\ifdim\J@dim@b>\J@dim@c \J@dim@b=\J@dim@c\fi}%
|
|||
|
\def\col@chk{\J@dim@c=\botcol@ \advance\J@dim@c by -\J@dim@b
|
|||
|
\ifdim\J@dim@c>\baselineskip \ClassWarning{journal}{%
|
|||
|
\the\J@dim@c\space unused at bottom of column \the\J@cnt@b}\fi
|
|||
|
}%
|
|||
|
\def\adj@col{\botcol@=\J@dim@b
|
|||
|
\advance\botcol@ by -\ht\J@obj@box \advance\botcol@ by -\objsep}%
|
|||
|
\else
|
|||
|
\ifx p\J@obj@dir
|
|||
|
\J@dim@b=\z@
|
|||
|
\def\calc@y{\J@dim@c=\topcol@ \advance\J@dim@c by \ht\J@obj@box
|
|||
|
\ifdim\J@dim@b<\J@dim@c \J@dim@b=\J@dim@c\fi}%
|
|||
|
\def\adj@col{\botcol@ -1pt}%
|
|||
|
\else \ClassError{journal}{Unknown object position: '\meaning\J@obj@dir'}{}%
|
|||
|
\fi\fi\fi
|
|||
|
\J@obj@do\calc@y
|
|||
|
% Commented the too-verbose check
|
|||
|
% \J@obj@do\col@chk
|
|||
|
\J@dim@c=\J@dim@b
|
|||
|
\J@cnt@b=\J@obj@first \J@calc@obj@x
|
|||
|
\leavevmode\lower\J@dim@c\rlap{\kern\J@dim@a \copy\J@obj@box}%
|
|||
|
\J@obj@do\adj@col \J@obj@ht\z@
|
|||
|
\ignorepar}%
|
|||
|
%<<<2 La fonction pour lire les positions d'objet
|
|||
|
% La syntaxe est x[largeur] pos[align]
|
|||
|
% Les variables remplies:
|
|||
|
% \J@obj@first = première colonne
|
|||
|
% \J@obj@span = deuxième colonne
|
|||
|
% \J@obj@dir = t/b/p (tête/bas/page)
|
|||
|
% \J@obj@ht = 0 ou hauteur de l'objet
|
|||
|
\def\@J@obj@first#1{\J@obj@first=#1\@ifnextchar[\@J@obj@span{\@J@obj@span[1]}}%
|
|||
|
\def\@J@obj@span[#1]{\J@obj@span=#1\afterassignment\@J@obj@dir\let\J@tmp@a}%
|
|||
|
\def\@J@obj@dir{%
|
|||
|
\ifcat x\J@tmp@a
|
|||
|
\ifcat x\J@align \if\J@tmp@a\J@align\else
|
|||
|
\ClassError{journal}{Alignment `\meaning\J@tmp@a' forbidden within
|
|||
|
\string\makecols\space with alignment `\meaning\J@align'}{}
|
|||
|
\fi\fi
|
|||
|
\let\J@obj@dir\J@tmp@a\def\next{\@ifnextchar[\@J@obj@ht{\@J@obj@ht[]}}%
|
|||
|
\else
|
|||
|
\ifcat x\J@align \let\J@obj@dir\J@align \else \let\J@obj@dir p\fi
|
|||
|
\let\next\J@tmp@a\@J@obj@ht[]%
|
|||
|
\fi\next}%
|
|||
|
\def\@J@obj@ht[#1]{\def\J@tmp@a{#1}%
|
|||
|
\ifx\J@tmp@a\@empty
|
|||
|
\ifx p\J@obj@dir
|
|||
|
\def\col@do{\J@dim@c=\botcol@
|
|||
|
\advance \J@dim@c by-\topcol@
|
|||
|
\J@calc@obj@ht}\J@obj@do\col@do
|
|||
|
\J@obj@align\z@
|
|||
|
\else
|
|||
|
\ifdim\J@obj@ht=\z@
|
|||
|
% Colonne seulement !
|
|||
|
% Au final, on trouvera \J@obj@align < 0
|
|||
|
% et \J@obj@ht = la place disponible au total au sommet des colonnes
|
|||
|
\ifx t\J@obj@dir
|
|||
|
\J@top
|
|||
|
\def\col@do{\J@dim@c=\J@dim@a
|
|||
|
\advance \J@dim@c by-\topcol@\J@calc@obj@ht}\J@obj@do\col@do
|
|||
|
\else \ifx b\J@obj@dir
|
|||
|
\J@bot
|
|||
|
\def\col@do{\J@dim@c=-\J@dim@a
|
|||
|
\advance \J@dim@c by \botcol@\J@calc@obj@ht}\J@obj@do\col@do
|
|||
|
\fi\fi
|
|||
|
\J@obj@align -1pt
|
|||
|
\else
|
|||
|
\J@obj@ht\z@
|
|||
|
\fi
|
|||
|
\fi
|
|||
|
\else
|
|||
|
\ifx t\J@obj@dir
|
|||
|
\J@obj@align \csname topcol@\romannumeral\J@tmp@a\endcsname
|
|||
|
\advance\J@obj@align by -\objsep
|
|||
|
\def\col@do{%
|
|||
|
\J@dim@c=\J@obj@align
|
|||
|
\advance \J@dim@c by -\topcol@
|
|||
|
\J@calc@obj@ht
|
|||
|
}\J@obj@do\col@do
|
|||
|
\else \ifx b\J@obj@dir
|
|||
|
\J@obj@align \csname botcol@\romannumeral\J@tmp@a\endcsname
|
|||
|
\advance\J@obj@align by \objsep
|
|||
|
\def\col@do{%
|
|||
|
\J@dim@c=-\J@obj@align
|
|||
|
\advance \J@dim@c by \botcol@
|
|||
|
\J@calc@obj@ht
|
|||
|
}\J@obj@do\col@do
|
|||
|
\fi\fi
|
|||
|
\fi
|
|||
|
\J@obj@ex}%
|
|||
|
%<<<2 Code commun aux objets
|
|||
|
% Vérifications.
|
|||
|
\def\J@obj@check{%
|
|||
|
\def\col@do{\ifdim\botcol@<\z@\ClassError{journal}%
|
|||
|
{Column \the\J@cnt@b\space is already filled}{}\fi}\J@obj@do\col@do
|
|||
|
\J@cnt@b=\J@obj@first \advance \J@cnt@b by \J@obj@span
|
|||
|
\advance \J@cnt@b by -1 \ifnum \J@cnt@b>\columns
|
|||
|
\ClassError{journal}{Column \the\J@cnt@b\space does not exist (max is
|
|||
|
\the\columns)}{}\fi
|
|||
|
\ifnum \J@obj@first<0 \ClassError{journal}{Negative column numbers
|
|||
|
(\the\J@obj@first) not allowed}{}\fi}%
|
|||
|
|
|||
|
\def\J@calc@obj@wd{%
|
|||
|
\J@obj@wd=\columnsep \advance\J@obj@wd by\columnwidth
|
|||
|
\multiply\J@obj@wd by\J@obj@span \advance\J@obj@wd by -\columnsep
|
|||
|
}%
|
|||
|
% \objbox est prévue pour être utilisée par les objets
|
|||
|
% Un objet termine par une commande \objbox{ce qu'il y a dans l'objet}%
|
|||
|
% Voir ci-dessous les exemples d'utilisations.
|
|||
|
\def\objbox{\let\par\J@par
|
|||
|
\def\objbox@{\J@calc@obj@wd\hsize=\J@obj@wd\aftergroup\J@place}%
|
|||
|
\afterassignment\objbox@\setbox\J@obj@box=\vbox}%
|
|||
|
%<<<1 Mise en page complexe
|
|||
|
%<<<2 \borne
|
|||
|
\def\borne #1#2{\begingroup\J@obj@first=1\J@obj@span=\columns
|
|||
|
\edef\@borne{\romannumeral #2}%
|
|||
|
\ifx t#1
|
|||
|
\def\col@do{\topcol@=\csname botcol@\@borne\endcsname
|
|||
|
\advance\topcol@ by \objsep}%
|
|||
|
\xdef\col@res{\noexpand\botcol@=\csname botcol@\@borne\endcsname}%
|
|||
|
\else
|
|||
|
\ifx b#1
|
|||
|
\def\col@do{\botcol@=\csname topcol@\@borne\endcsname
|
|||
|
\advance\botcol@ by-\objsep}%
|
|||
|
\xdef\col@res{\noexpand\topcol@=\csname topcol@\@borne\endcsname}%
|
|||
|
\else
|
|||
|
\fi\fi
|
|||
|
\J@obj@do\col@do
|
|||
|
\ignorepar}%
|
|||
|
\def\endborne{\endgroup\J@obj@first=1\J@obj@span=\columns\J@obj@do\col@res}
|
|||
|
%<<<2 \pushcols - empile les colonnes (et ce, pour pouvoir faire une
|
|||
|
% sous-page)
|
|||
|
% \def\pushcols{%
|
|||
|
% \def\pop@cols{}%
|
|||
|
% \J@obj@first=1 \J@obj@span=\columns
|
|||
|
% \def\@do{%
|
|||
|
% \xdef\pop@cols{\expandafter\noexpand\pop@cols
|
|||
|
% \noexpand\global\expandafter\noexpand
|
|||
|
% \csname topcol@\romannumeral\J@cnt@b\endcsname=\the\topcol@
|
|||
|
% \noexpand\global\expandafter\noexpand
|
|||
|
% \csname botcol@\romannumeral\J@cnt@b\endcsname=\the\topcol@
|
|||
|
% }%
|
|||
|
% }\J@obj@do\@do
|
|||
|
% \aftergroup\pop@cols
|
|||
|
% }%
|
|||
|
%<<<2 \makecols
|
|||
|
\let\J@sub\relax
|
|||
|
\let\J@align\relax
|
|||
|
\def\makecols#1{%
|
|||
|
\let\J@sub=\J@obj@dir
|
|||
|
\begingroup
|
|||
|
\columns=#1 \J@calc@obj@wd \hsize=\J@obj@wd
|
|||
|
\J@cnt@b=\J@obj@first \J@calc@obj@x \J@offset=\J@dim@a
|
|||
|
\J@alloc \J@columns
|
|||
|
\ifx t\J@sub \J@top
|
|||
|
\ifdim\J@obj@ht>\z@ \J@dim@b\J@dim@a \advance\J@dim@b\J@obj@ht
|
|||
|
\else \begingroup\J@bot\global\J@dim@b\J@dim@a\endgroup \fi
|
|||
|
\else \J@bot \J@dim@b\J@dim@a
|
|||
|
\ifdim\J@obj@ht>\z@ \J@dim@a\J@dim@b \advance\J@dim@a-\J@obj@ht
|
|||
|
\else \J@top \fi
|
|||
|
\fi
|
|||
|
\J@obj@first=1\J@obj@span\columns
|
|||
|
\def\col@do{\topcol@\J@dim@a \botcol@\J@dim@b}\J@obj@do\col@do
|
|||
|
}%
|
|||
|
\def\endmakecols{%
|
|||
|
\ifx t\J@sub\J@top \else\J@bot\fi \global\J@dim@a\J@dim@a
|
|||
|
\endgroup
|
|||
|
\ifdim\J@obj@ht>\z@ \espace{\J@obj@ht}\espace{\objsep}%
|
|||
|
\else
|
|||
|
\ifx t\J@sub \def\col@do{\topcol@\J@dim@a}\else
|
|||
|
\def\col@do{\botcol@\J@dim@a}\fi
|
|||
|
\J@obj@do\col@do
|
|||
|
\fi
|
|||
|
\let\J@sub\relax\ignorepar
|
|||
|
}%
|
|||
|
%<<<1 Définition des objets
|
|||
|
%<<<2 \espace et \jointif
|
|||
|
\def\espace#1{%
|
|||
|
\ifx t\J@obj@dir \def\col@do{\advance\topcol@ by #1}\else
|
|||
|
\ifx b\J@obj@dir \def\col@do{\advance\botcol@ by-#1}\fi\fi
|
|||
|
% Le \ignorepar est nécessaire puisqu'on n'utilise pas \objbox
|
|||
|
\J@obj@do\col@do\ignorepar}%
|
|||
|
\def\jointif{\espace{-\objsep}}
|
|||
|
%<<<2 \texte
|
|||
|
\def\texte{\afterassignment\texte@\J@obj@toks=}%
|
|||
|
\def\texte@{%
|
|||
|
\ifdim\J@obj@ht=\z@ \def\J@obj@extra{}\else
|
|||
|
\edef\J@obj@extra{to \the\J@obj@ht}\fi
|
|||
|
\objbox\J@obj@extra{\begingroup\leavevmode\J@@txt@init\the\J@obj@toks\J@@txt@init\endgroup}}%
|
|||
|
|
|||
|
%<<<2 \gencadre
|
|||
|
% Merci Knuth
|
|||
|
\def\futurenonspacelet#1{\def\cs{#1}%
|
|||
|
\afterassignment\fnslet@i\let\fnslet@next= }
|
|||
|
\def\fnslet@i{\expandafter\futurelet\cs\fnslet@ii}
|
|||
|
\def\fnslet@ii{\expandafter\ifx\cs\stoken\let\next=\fnslet@three
|
|||
|
\else\let\next=\fnslet@next\fi \next}
|
|||
|
\def\fnslet@three{\afterassignment\fnslet@i\let\next= }
|
|||
|
|
|||
|
\newif\if@J@jointif\@J@jointiffalse
|
|||
|
\def\intjointif{\@J@jointiftrue}
|
|||
|
|
|||
|
% \gencadre{bordure}{marge}{couleur bordure}{couleur fond}{texte}
|
|||
|
\newif\if@J@cadre
|
|||
|
\def\gencadre#1#2#3#4{\def\J@cadre@{\J@cadre{#1}{#2}{#3}{#4}}%
|
|||
|
\afterassignment\J@cadre@@\J@obj@toks=}%
|
|||
|
\def\J@cadre@@{\futurenonspacelet\@tmq\J@cadre@}
|
|||
|
\def\J@cadre#1#2#3#4{%
|
|||
|
\J@dim@a=#1 \J@dim@b=#2
|
|||
|
\def\J@tmp@a{#3}\ifx\J@tmp@a\@empty\def\J@tmp@a{black}\fi
|
|||
|
\def\J@tmp@b{#4}\ifx\J@tmp@b\@empty\def\J@tmp@b{white}\fi
|
|||
|
\advance \J@dim@b by \J@dim@a
|
|||
|
\ifdim\J@obj@ht=\z@ \def\J@obj@extra{}\else
|
|||
|
\advance\J@obj@ht by -2\J@dim@b \edef\J@obj@extra{to \the\J@obj@ht}\fi
|
|||
|
\setbox\J@box@a=\vbox\J@obj@extra{\J@calc@obj@wd\hsize=\J@obj@wd
|
|||
|
\advance\hsize by -2\J@dim@b
|
|||
|
\vskip \J@dim@b\begingroup
|
|||
|
\let\@tmp\undefined
|
|||
|
\J@dim@c=\J@dim@b \let\jointif\intjointif \@J@cadretrue
|
|||
|
\J@obj@ht \z@
|
|||
|
\J@@txt@init \the\J@obj@toks \J@@txt@end \vskip\J@dim@b\endgroup}%
|
|||
|
\fboxrule #1 \fboxsep #2
|
|||
|
\if@J@cadre \par
|
|||
|
\if@J@jointif\vskip -\ht\strutbox\else\vskip\dp\strutbox\fi
|
|||
|
\leavevmode \hskip-\J@dim@c \fcolorbox{\J@tmp@a}{\J@tmp@b}{\box\J@box@a}\par
|
|||
|
\ifx\@tmq\jointif\vskip-\dp\strutbox\fi
|
|||
|
\global\@J@jointiffalse
|
|||
|
\else
|
|||
|
\objbox{\fcolorbox{\J@tmp@a}{\J@tmp@b}{\box\J@box@a}}%
|
|||
|
\fi
|
|||
|
\ignorepar
|
|||
|
}
|
|||
|
%<<<2 \genfilet
|
|||
|
% \genfilet{epaisseur}{marge}{couleur}
|
|||
|
\def\genfilet#1#2#3{%
|
|||
|
\objbox{\J@dim@a=\hsize \advance\J@dim@a by -#2
|
|||
|
\hbox to\hsize{\color{#3}\hss\vrule depth \z@ height #1 width \J@dim@a\hss}}%
|
|||
|
\ignorepar
|
|||
|
}%
|
|||
|
%<<<1 Remplissage des colonnes
|
|||
|
%<<<2 Fonction \colonne
|
|||
|
% On utilise def, même si ce n'est pas un objet au sens strict.
|
|||
|
\def\colonne{\@killglue \J@obj@ht\z@
|
|||
|
\def\J@calc@obj@ht{\advance\J@obj@ht by\J@dim@c}%
|
|||
|
\let\J@obj@ex\J@colonne\@J@obj@first}%
|
|||
|
|
|||
|
\def\J@colonne{\afterassignment\J@colonne@\J@obj@toks=}%
|
|||
|
\def\J@colonne@{\@killglue
|
|||
|
% Arrivé ici, on a la hauteur totale dans \J@obj@ht, il suffit de répartir
|
|||
|
\J@obj@check
|
|||
|
% Traçage de la boîte
|
|||
|
\J@obj@wd=\columnwidth
|
|||
|
\setbox\J@obj@box=\vbox{%
|
|||
|
\hsize=\J@obj@wd
|
|||
|
\begingroup \J@@txt@init \the\J@obj@toks \J@@txt@end \endgroup}%
|
|||
|
\J@dim@b=\ht\J@obj@box
|
|||
|
\ifdim\J@obj@align<\z@
|
|||
|
% Le cas où on a le droit d'ajuster autant qu'on veut. Dans ce cas, on
|
|||
|
% calcule à quelle hauteur on va ajuster, ce qui permet de reprendre
|
|||
|
% tel quel l'algorithme suivant.
|
|||
|
\J@obj@align= \J@dim@b \advance\J@obj@align by -\J@obj@ht
|
|||
|
\ifdim \J@obj@align<\z@ \ClassError{journal}{%
|
|||
|
Pas assez de texte pour remplir les \the\J@obj@span\space colonnes.^^J}\fi
|
|||
|
\divide\J@obj@align by\J@obj@span \J@obj@ht=\J@dim@b
|
|||
|
\ifx t\J@obj@dir \J@top \advance\J@obj@align by\J@dim@a
|
|||
|
\else \J@bot \J@obj@align=-\J@obj@align \advance\J@obj@align by\J@dim@a
|
|||
|
\fi
|
|||
|
\fi
|
|||
|
% Répartition de l'espace
|
|||
|
\J@dim@c=1pt % Pour des raisons de précision de la division
|
|||
|
\divide \J@obj@ht by\J@dim@c \divide \J@dim@b by\J@dim@c
|
|||
|
\def\put@col{%
|
|||
|
\ifx t\J@obj@dir \J@dim@a=\J@obj@align \else \J@dim@a=\botcol@ \fi
|
|||
|
\ifx b\J@obj@dir \J@dim@c=\J@obj@align \else \J@dim@c=\topcol@ \fi
|
|||
|
% Maintenant \J@dim@a contient la place libre sur cette colonne
|
|||
|
\advance\J@dim@a by -\J@dim@c \J@dim@c=\J@dim@a
|
|||
|
\divide\J@dim@c by\J@obj@ht \multiply\J@dim@c by \J@dim@b
|
|||
|
% Maintenant \J@dim@c contient la taille qu'on attribue à cette colonne
|
|||
|
\splittopskip\z@
|
|||
|
\setbox\J@box@a=\vsplit\J@obj@box to\J@dim@c
|
|||
|
\setbox\J@box@a=\vbox to\J@dim@a{\unvbox\J@box@a}%
|
|||
|
\ifx t\J@obj@dir \J@dim@c=\J@obj@align\else \J@dim@c=\botcol@ \fi
|
|||
|
\J@calc@obj@x % maintenant dans \J@dim@a
|
|||
|
\begingroup % Filet gauche
|
|||
|
\ifnum \J@cnt@b>1
|
|||
|
% Calcul de l'abscisse
|
|||
|
\ifnum\J@cnt@b=\J@obj@first\let\J@tmp@a\J@vsep@l@c\let\J@tmp@b\J@vsep@l@w
|
|||
|
\else \let\J@tmp@a\J@vsep@i@c \let\J@tmp@b\J@vsep@i@w \fi
|
|||
|
\expandafter\J@dim@b\J@tmp@b \advance\J@dim@b by \columnsep
|
|||
|
\divide\J@dim@b by 2\advance\J@dim@a by -\J@dim@b
|
|||
|
% Calcul de l'ordonnée
|
|||
|
\ifnum \J@cnt@b=\J@obj@first \J@dim@b=\ht\J@box@a
|
|||
|
\else \J@dim@b=\J@dim@c \advance\J@dim@b by -\ht\J@box@a
|
|||
|
\J@vsep@recalc \J@dim@b=-\J@dim@b \advance\J@dim@b by \J@dim@c \fi
|
|||
|
\leavevmode \lower\J@dim@c \rlap{\kern \J@dim@a
|
|||
|
\ifx\J@tmp@a\@empty\else\color{\J@tmp@a}\fi
|
|||
|
\vrule height \J@dim@b width \J@tmp@b}%
|
|||
|
\fi \endgroup
|
|||
|
\begingroup % Filet droit
|
|||
|
\advance\J@obj@first by\J@obj@span \advance\J@obj@first by -1
|
|||
|
\ifnum \J@cnt@b<\columns
|
|||
|
\ifnum\J@cnt@b=\J@obj@first % droit
|
|||
|
\expandafter\J@dim@b\J@vsep@r@w \advance\J@dim@b by-\columnsep
|
|||
|
\divide\J@dim@b by2\advance\J@dim@a by -\J@dim@b
|
|||
|
\leavevmode \lower \J@dim@c \rlap{\kern\J@dim@a \kern\columnwidth
|
|||
|
\ifx\J@vsep@r@c\@empty\else\color{\J@vsep@r@c}\fi
|
|||
|
\vrule height \ht\J@box@a width \J@vsep@r@w}%
|
|||
|
\else % intérieur
|
|||
|
% Le filet intérieur rejoint les _plus petites_ sous-boîtes communes
|
|||
|
% aux deux colonnes
|
|||
|
\J@dim@b=\J@dim@c \advance\J@dim@b by -\ht\J@box@a
|
|||
|
\xdef\J@vsep@recalc{%
|
|||
|
\noexpand\ifdim\noexpand\J@dim@c>\the\J@dim@c
|
|||
|
\noexpand\J@dim@c=\the\J@dim@c\noexpand\fi
|
|||
|
\noexpand\ifdim\noexpand\J@dim@b<\the\J@dim@b
|
|||
|
\noexpand\J@dim@b=\the\J@dim@b\noexpand\fi}%
|
|||
|
\fi\fi \endgroup
|
|||
|
\leavevmode \lower\J@dim@c \rlap{\kern\J@dim@a \box\J@box@a}%
|
|||
|
\ifx t\J@obj@dir \topcol@=\J@obj@align \advance \topcol@ by \objsep\else
|
|||
|
\ifx b\J@obj@dir \botcol@=\J@obj@align \advance \botcol@ by -\objsep\else
|
|||
|
\botcol@= -1pt\fi\fi
|
|||
|
}\J@obj@do\put@col
|
|||
|
\ignorepar}% end \J@colonne@
|
|||
|
%<<<2 Séparateurs verticaux
|
|||
|
\def\separateur#1#2#3{\J@sep@def{#2}{#3}#1.\ignorepar}
|
|||
|
\def\J@sep@def#1#2#3{\edef\J@tmp@b{.}\def\next{\J@sep@def{#1}{#2}}%
|
|||
|
\ifx .#3\let\next\relax \else
|
|||
|
\edef\J@tmp@a{#1}\ifx\J@tmp@b\J@tmp@a\else
|
|||
|
\expandafter\def\csname J@vsep@#3@w\endcsname{#1}\fi
|
|||
|
\edef\J@tmp@a{#2}\ifx\J@tmp@b\J@tmp@a\else
|
|||
|
\expandafter\def\csname J@vsep@#3@c\endcsname{#2}\fi
|
|||
|
\fi\next
|
|||
|
}%
|
|||
|
\J@sep@def{\z@}{}lri.
|
|||
|
%<<<2 Styles de texte
|
|||
|
% Faut-il mettre un filet dans le texte?
|
|||
|
\newif\if@J@filet
|
|||
|
\def\txtgenfilet#1#2#3{%
|
|||
|
\J@footnotes
|
|||
|
% take care of footins
|
|||
|
\if@J@filet \J@dim@b=#2
|
|||
|
\J@dim@a=\hsize \advance \J@dim@a by -2\J@dim@b
|
|||
|
\bigbreak
|
|||
|
\cleaders\hbox{{\hskip\J@dim@b \color{#3}%
|
|||
|
\vrule width \J@dim@a height #1 depth \z@}}\vskip #1
|
|||
|
\leavevmode\fi
|
|||
|
\@J@filettrue
|
|||
|
}%
|
|||
|
% Les notes de bas d'article
|
|||
|
\def\J@@txt@init{%
|
|||
|
\linewidth\hsize
|
|||
|
\@J@filetfalse
|
|||
|
\leavevmode
|
|||
|
\setcounter{footnote}0%
|
|||
|
\def\J@fns{}%
|
|||
|
\let\par\J@par % restore it to prevent wrapfigure from being confused
|
|||
|
\J@txt@init
|
|||
|
}%
|
|||
|
\def\J@@txt@end{%
|
|||
|
\J@footnotes
|
|||
|
\J@txt@end
|
|||
|
}%
|
|||
|
\let\J@txt@init\relax % hook for derived classes
|
|||
|
\let\J@txt@end \relax % hook for derived classes
|
|||
|
%<<<2 Footnotes
|
|||
|
% On ne peut pas utiliser de registre token pour les footnotes, car il
|
|||
|
% faut expander la valeur de \@thefnmark.
|
|||
|
\long\def\@footnotetext#1{%
|
|||
|
\long\edef\J@tmp@a##1##2{\noexpand\def\noexpand\J@fns{%
|
|||
|
\expandafter\noexpand\J@fns##1\noexpand\hbox to 1.4em{%
|
|||
|
\noexpand\hss\@thefnmark. }##2}}%
|
|||
|
\J@tmp@a{\noindent\interlinepenalty\interfootnotelinepenalty}{#1\par}%
|
|||
|
}
|
|||
|
\def\J@footnotes{\ifnum\c@footnote>0
|
|||
|
\penalty 150 \medskip \footnoterule
|
|||
|
\begingroup\reset@font\footnotesize\J@fns\endgroup
|
|||
|
\def\J@fns{}\c@footnote=0
|
|||
|
\fi}
|
|||
|
\def\footnoterule{\kern -3pt\hrule width .4\hsize \kern 2.6pt}
|
|||
|
\let\J@@footnotes\J@footnotes
|
|||
|
\def\skipfootnotes{\def\J@footnotes{\let\J@footnotes\J@@footnotes}}
|
|||
|
% vim: fdm=marker fmr=<<<,>>>
|
|||
|
\AtBeginDocument{\pageinit}%
|