diff options
author | Karl Berry <karl@freefriends.org> | 2023-11-15 21:09:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-11-15 21:09:01 +0000 |
commit | 5ebac73000415d0d7644691d0ad784cf2372402d (patch) | |
tree | e4c6b17cc5a6ad2dad9b829a35a164880acbc319 /Master/texmf-dist/tex/latex | |
parent | 71bbd7f7eb51fcf2c3e5c095ba308dc0aee62d70 (diff) |
writeongrid (15nov23)
git-svn-id: svn://tug.org/texlive/trunk@68863 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/writeongrid/WriteOnGrid.sty | 261 |
1 files changed, 178 insertions, 83 deletions
diff --git a/Master/texmf-dist/tex/latex/writeongrid/WriteOnGrid.sty b/Master/texmf-dist/tex/latex/writeongrid/WriteOnGrid.sty index f5a6f6adf92..f6a9d6199e3 100644 --- a/Master/texmf-dist/tex/latex/writeongrid/WriteOnGrid.sty +++ b/Master/texmf-dist/tex/latex/writeongrid/WriteOnGrid.sty @@ -2,7 +2,8 @@ % licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{WriteOnGrid}[2023/08/09 v0.1.4 package to write on grid lines] +\ProvidesPackage{WriteOnGrid}[2023/11/15 v0.1.5 package to write on grid lines] +% 0.1.5 Choix de la réglure pour le seyes (en pretest) + amélioration de la gestion des paragraphes % 0.1.4 Suppression des options de xcolor (définition manuelle des couleurs) % 0.1.3 Ajout de commandes simples pour des mini-quadrillages autonomes, sans texte % 0.1.2 Modification locale des couleurs + raccourcis couleurs Seyes / Ruled @@ -10,7 +11,6 @@ % 0.1.0 Version initiale [fr] & [en] %------Packages utiles -%\RequirePackage[table,svgnames]{xcolor} \RequirePackage{tikz} \RequirePackage{simplekv} \RequirePackage{xstring} @@ -24,8 +24,10 @@ \definecolor{TyrianPurple}{rgb}{0.4,0.01,0.24} \definecolor{PapierRose}{HTML}{E6B8E6} \definecolor{PapierGris}{HTML}{D7E2EE} + \def\CoulSeyes{PapierRose/PapierGris} \def\CoulRuled{PapierGris/TyrianPurple} + \def\ColSeyes{PapierRose/PapierGris} \def\ColRuled{PapierGris/TyrianPurple} @@ -44,7 +46,7 @@ \addtocounter{lgquadri}{1} \useKVdefault[LigneQuadrill] \setKV[LigneQuadrill]{#1} - \node[text width=\fpeval{\ValeurCarreau*\QuadNbCol/\QuadEchelle-\ValeurCarreau*\useKV[Quadrill]{Marge}/\QuadEchelle}cm,align=#2,scale=\QuadEchelle,anchor=base west,inner sep={\useKV[LigneQuadrill]{Sep}}] at ($({\ValeurCarreau*\useKV[Quadrill]{Marge}+\ValeurCarreau*\useKV[LigneQuadrill]{DecalH}},{-\ValeurCarreau*\thelgquadri})+(0.025,\useKV[LigneQuadrill]{DecalV})$) {\strut #3} ; + \node[text width=\fpeval{\CoeffUnite*\ValeurCarreau*\QuadNbCol/\QuadEchelle-\CoeffUnite*\ValeurCarreau*\useKV[Quadrill]{Marge}/\QuadEchelle}cm,align=#2,scale=\QuadEchelle,anchor=base west,inner sep={\useKV[LigneQuadrill]{Sep}}] at ($({\ValeurCarreau*\useKV[Quadrill]{Marge}+\ValeurCarreau*\useKV[LigneQuadrill]{DecalH}},{-\ValeurCarreau*\thelgquadri})+(0.025,\useKV[LigneQuadrill]{DecalV})$) {\strut #3} ; } %déf des clés @@ -53,7 +55,8 @@ Grille=\xdef\QuadType{#1},% NbCarreaux=\xdef\QuadNbCar{#1},% Elargir=\xdef\QuadElar{#1},% - CouleurBarreSeyes=\xdef\QuadCoulSeyes{#1} + CouleurBarreSeyes=\xdef\QuadCoulSeyes{#1},% + ReglureSeyes=\xdef\QuadReglureSeyes{#1} } \setKVdefault[Quadrill]{% @@ -64,7 +67,8 @@ Cadre=false,% Grille=5x5,% AffBarre=true,% - CouleurBarreSeyes={red!75} + CouleurBarreSeyes={red!75},% + ReglureSeyes=2 } \NewDocumentCommand\AffQuadrillage{ O{} D<>{lightgray!50/lightgray!25} }{%affichage simple du quadrillage @@ -76,18 +80,19 @@ {\def\QuadCoulA{#2}\def\QuadCoulB{#2}}% \StrCut{\QuadNbCar}{x}{\QuadNbCol}{\QuadNbLig}% \IfStrEq{\QuadType}{Seyes}%les types de quadrillages - {\xdef\ValeurCarreau{0.8}}% + {\xdef\ValeurCarreau{0.8}\xdef\CoeffUnite{\fpeval{(\QuadReglureSeyes)/2}}}% {}% \IfStrEq{\QuadType}{5x5}% - {\xdef\ValeurCarreau{0.5}}% + {\xdef\ValeurCarreau{0.5}\xdef\CoeffUnite{1}}% {}% \IfStrEq{\QuadType}{Ruled}% - {\xdef\ValeurCarreau{0.9}}% + {\xdef\ValeurCarreau{0.9}\xdef\CoeffUnite{1}}% {}% + \IfSubStr{\QuadElar}{/}%on récupère les élargissements G et D {\StrCut{\QuadElar}{/}{\QuadElarG}{\QuadElarD}}% {\def\QuadElarG{\QuadElar}\def\QuadElarD{\QuadElar}}% - \begin{tikzpicture}[xscale={\useKV[Quadrill]{Unite}},yscale={\useKV[Quadrill]{Unite}}] + \begin{tikzpicture}[xscale={\CoeffUnite*\useKV[Quadrill]{Unite}},yscale={\CoeffUnite*\useKV[Quadrill]{Unite}}] \useasboundingbox (0,0) rectangle ({\ValeurCarreau*\QuadNbCol},{-\ValeurCarreau*\QuadNbLig}) ;%on fixe la grille de base, avant élargissement éventuel \IfStrEq{\QuadType}{Seyes}% {% @@ -130,18 +135,18 @@ {\def\QuadCoulA{#2}\def\QuadCoulB{#2}}% \StrCut{\QuadNbCar}{x}{\QuadNbCol}{\QuadNbLig}% \IfStrEq{\QuadType}{Seyes}%les types de quadrillages - {\xdef\ValeurCarreau{0.8}}% + {\xdef\ValeurCarreau{0.8}\xdef\CoeffUnite{\fpeval{(\QuadReglureSeyes)/2}}}% {}% \IfStrEq{\QuadType}{5x5}% - {\xdef\ValeurCarreau{0.5}}% + {\xdef\ValeurCarreau{0.5}\xdef\CoeffUnite{1}}% {}% \IfStrEq{\QuadType}{Ruled}% - {\xdef\ValeurCarreau{0.9}}% + {\xdef\ValeurCarreau{0.9}\xdef\CoeffUnite{1}}% {}% \IfSubStr{\QuadElar}{/}%on récupère les élargissements G et D {\StrCut{\QuadElar}{/}{\QuadElarG}{\QuadElarD}}% {\def\QuadElarG{\QuadElar}\def\QuadElarD{\QuadElar}}% - \begin{tikzpicture}[xscale={\useKV[Quadrill]{Unite}},yscale={\useKV[Quadrill]{Unite}}] + \begin{tikzpicture}[xscale={\CoeffUnite*\useKV[Quadrill]{Unite}},yscale={\CoeffUnite*\useKV[Quadrill]{Unite}}] \useasboundingbox (0,0) rectangle ({\ValeurCarreau*\QuadNbCol},{-\ValeurCarreau*\QuadNbLig}) ;%on fixe la grille de base, avant élargissement éventuel \IfStrEq{\QuadType}{Seyes}% {% @@ -305,31 +310,49 @@ \defKV[SeyesFull]{% CouleurP=\xdef\SeyesFullCoulP{#1},% CouleurS=\xdef\SeyesFullCoulS{#1},% - CouleurMarge=\xdef\SeyesFullCoulM{#1} + CouleurMarge=\xdef\SeyesFullCoulM{#1},% + ReglureSeyes=\xdef\SeyesFullReglureSeyes{#1},% + FormatPapier=\xdef\SeyesFullFormatPapier{#1} } \setKVdefault[SeyesFull]{% CouleurP=PapierRose,% CouleurS=PapierGris,% CouleurMarge=red!75, - NumLignes=false + NumLignes=false,% + ReglureSeyes=2,% + FormatPapier=A4 } -\NewDocumentEnvironment{PleinePageSeyes}{ O{} }%semble OK ^^ +\NewDocumentEnvironment{PleinePageSeyes}{ O{} }%semble OK ^^, à tester avec modification de la taille de papier... { - \useKVdefault[SeyesFull] - \setKV[SeyesFull]{#1} - \begin{tikzpicture}[remember picture,overlay,x=1cm,y=1cm] + \useKVdefault[SeyesFull]% + \setKV[SeyesFull]{#1}% + \IfEq{\SeyesFullFormatPapier}{A4}% + {\xdef\SeyesFullHautPap{29.7}\xdef\SeyesFullLargPap{21}\xdef\SeyesFullMargeH{3}\xdef\SeyesFullMargeG{4}\xdef\SeyesFullHautEff{24}}% + {}% + \IfEq{\SeyesFullFormatPapier}{A5}% + {\xdef\SeyesFullHautPap{21}\xdef\SeyesFullLargPap{14.8}\xdef\SeyesFullMargeH{2.5}\xdef\SeyesFullMargeG{2.5}\xdef\SeyesFullHautEff{17}}% + {}% + \IfSubStr{\SeyesFullFormatPapier}{x}% + {\StrCut{\SeyesFullFormatPapier}{x}{\SeyesFullLargPap}{\SeyesFullHautPap}\xdef\SeyesFullMargeH{3}\xdef\SeyesFullMargeG{3}\xdef\SeyesFullHautEff{\fpeval{\SeyesFullHautPap-6}}}% + {}% + %calcul du nombre de lignes /colonnes ? + \xdef\SeyesFullNbLignP{\fpeval{round(\SeyesFullHautEff/(0.4*\SeyesFullReglureSeyes),0)}}% + \xdef\SeyesFullNbLignS{\fpeval{round(\SeyesFullHautEff/(0.1*\SeyesFullReglureSeyes),0)+5}}% + \xdef\SeyesFullNbCol{\fpeval{round((\SeyesFullLargPap-\SeyesFullMargeG)/(0.4*\SeyesFullReglureSeyes),0)}}% + %création de la grille + \begin{tikzpicture}[remember picture,overlay,x=1cm,y=1cm]% %grille secondaire - \foreach \L in {0,1,...,125} {\draw[\SeyesFullCoulS] ($(current page.north west)+(0,{-2.4-\L*0.2})$)--++({\paperwidth},0) ;} + \foreach \L in {0,...,\SeyesFullNbLignS} {\draw[\SeyesFullCoulS] ($(current page.north west)+(0,{-(\SeyesFullMargeH-0.3*\SeyesFullReglureSeyes)-\L*0.1*\SeyesFullReglureSeyes})$)--++({\paperwidth},0) ;} %grille principale - \foreach \C in {1,2,...,21} {\draw[\SeyesFullCoulP] ($(current page.north west)+({4+0.8*\C},0)$)--($(current page.south west)+({4+0.8*\C},0)$) ;} - \foreach \L in {0,1,...,30} {\draw[\SeyesFullCoulP] ($(current page.north west)+(0,{-3-\L*0.8})$)--++({\paperwidth},0) ;} + \foreach \C in {1,...,\SeyesFullNbCol} {\draw[\SeyesFullCoulP] ($(current page.north west)+({\SeyesFullMargeG+(0.4*\SeyesFullReglureSeyes)*\C},0)$)--($(current page.south west)+({\SeyesFullMargeG+(0.4*\SeyesFullReglureSeyes)*\C},0)$) ;} + \foreach \L in {0,...,\SeyesFullNbLignP} {\draw[\SeyesFullCoulP] ($(current page.north west)+(0,{-(\SeyesFullMargeH)-\L*(0.4*\SeyesFullReglureSeyes)})$)--++({\paperwidth},0) ;} %marge - \draw[\SeyesFullCoulM,thick] ($(current page.north west)+(4,0)$)--($(current page.south west)+(4,0)$) ; - \coordinate (SeyesOrigine) at ($(current page.north west)+(4,-3)$) ; + \draw[\SeyesFullCoulM,thick] ($(current page.north west)+({\SeyesFullMargeG},0)$)--($(current page.south west)+({\SeyesFullMargeG},0)$) ; + \coordinate (SeyesOrigine) at ($(current page.north west)+({\SeyesFullMargeG},{-\SeyesFullMargeH})$) ; \ifboolKV[SeyesFull]{NumLignes}% {% - \foreach \lig in {1,2,...,31} {\node[gray,inner sep=0pt,anchor=base east] at ($(SeyesOrigine)+(-0.2,{-0.8*(\lig-1)})$) {\scriptsize\sffamily \lig};} + \foreach \lig in {1,...,\inteval{\SeyesFullNbLignP+1}} {\node[gray,inner sep=0pt,anchor=base east] at ($(SeyesOrigine)+(-0.2,{-0.4*\SeyesFullReglureSeyes*(\lig-1)})$) {\scriptsize\sffamily\lig};} }% {} } @@ -339,11 +362,11 @@ \newcommand\CadreNoteSeyes[2][3]{%on précise la {ligne de début} + [hauteur] %cadre de note - \draw[thick] ($(SeyesOrigine)+(0,{(-#2+1)*0.8})$) --++ ({\paperwidth-4cm},{0}) ; - \draw[thick] ($(SeyesOrigine)+(0,{(-#2+1)*0.8})$) --++ ({0},{-#1*0.8}) ; - \draw[thick] ($(SeyesOrigine)+(0,{(-#2+1-#1)*0.8})$) --++ ({\paperwidth-4cm},{0}) ; - \draw[thick] ($(SeyesOrigine)+(0,{(-#2+1)*0.8})$) rectangle++ ({#1.*0.8},{-#1*0.8}) ; - \draw[thick] ($(SeyesOrigine)+(0,{(-#2+1-#1)*0.8})$) --++ ({#1.*0.8},{#1*0.8}) ; + \draw[thick] ($(SeyesOrigine)+(0,{(-#2+1)*0.4*\SeyesFullReglureSeyes})$) --++ ({\SeyesFullLargPap-\SeyesFullMargeG},{0}) ; + \draw[thick] ($(SeyesOrigine)+(0,{(-#2+1)*0.4*\SeyesFullReglureSeyes})$) --++ ({0},{-#1*0.4*\SeyesFullReglureSeyes}) ; + \draw[thick] ($(SeyesOrigine)+(0,{(-#2+1-#1)*0.4*\SeyesFullReglureSeyes})$) --++ ({\SeyesFullLargPap-\SeyesFullMargeG},{0}) ; + \draw[thick] ($(SeyesOrigine)+(0,{(-#2+1)*0.4*\SeyesFullReglureSeyes})$) rectangle++ ({#1*0.4*\SeyesFullReglureSeyes},{-#1*0.4*\SeyesFullReglureSeyes}) ; + \draw[thick] ($(SeyesOrigine)+(0,{(-#2+1-#1)*0.4*\SeyesFullReglureSeyes})$) --++ ({#1*0.4*\SeyesFullReglureSeyes},{#1*0.4*\SeyesFullReglureSeyes}) ; } \defKV[SeyesLigne]{% @@ -356,18 +379,21 @@ Couleur=black,% Ligne=1,% Echelle=1,% - Largeur=16.5 + Largeur=auto } \NewDocumentCommand\LignePapierSeyes{ O{} D<>{left} D(){0,0} m }{% - \useKVdefault[SeyesLigne] - \setKV[SeyesLigne]{#1} - \node[\SeyesLigneCouleur,text width=\fpeval{\SeyesLigneLarg/\SeyesLigneEchelle}cm,align=#2,inner sep=0pt,anchor=base west,scale=\SeyesLigneEchelle] at ($(SeyesOrigine)+(0.05,{-(\SeyesLigne-1)*0.8})+(#3)$) {#4} ; - } + \useKVdefault[SeyesLigne]% + \setKV[SeyesLigne]{#1}% + \IfEq{\SeyesLigneLarg}{auto}% + {\xdef\SeyesLigneLarg{\fpeval{\SeyesFullLargPap-\SeyesFullMargeG-0.25}}}% + {}% + \node[\SeyesLigneCouleur,text width=\fpeval{\SeyesLigneLarg/\SeyesLigneEchelle}cm,align=#2,inner sep=0pt,anchor=base west,scale=\SeyesLigneEchelle] at ($(SeyesOrigine)+(0.05,{-(\SeyesLigne-1)*0.4*\SeyesFullReglureSeyes})+(#3)$) {#4} ; +} \defKV[SeyesPar]{% Couleur=\xdef\SeyesParCouleur{#1},% - TaillePolice=\xdef\SeyesParEchelle{#1},% + Echelle=\xdef\SeyesParEchelle{#1},% Espacement=\xdef\SeyesParBase{#1},% Ligne=\xdef\SeyesPar{#1},% Largeur=\xdef\SeyesParLarg{#1} @@ -375,40 +401,66 @@ \setKVdefault[SeyesPar]{% Couleur=black,% Ligne=1,% - TaillePolice=11,% - Espacement=22.792,% - Largeur=16.5 + Echelle=1,% + Espacement=auto,% + Largeur=auto } -\NewDocumentCommand\ParagraphePapierSeyes{ O{} D<>{justify} D(){0,0} m }{% - \useKVdefault[SeyesPar] - \setKV[SeyesPar]{#1} - \node[\SeyesParCouleur,text width=\SeyesParLarg cm,align=#2,inner sep=0pt,anchor=base west,font=\fontsize{\SeyesParEchelle}{\SeyesParBase}\selectfont] at ($(SeyesOrigine)+(0.05,{-(\SeyesPar-1)*0.8})+(#3)$) {#4} ; +\RequirePackage{setspace} + +\NewDocumentCommand\ParagraphePapierSeyes{ O{} D<>{justify} D(){0,0} m }{%essayer de passer à setspace ? + \useKVdefault[SeyesPar]% + \setKV[SeyesPar]{#1}% + \IfEq{\SeyesParLarg}{auto}% + {\xdef\SeyesParLarg{\fpeval{\SeyesFullLargPap-\SeyesFullMargeG-0.25}}}% + {}% + \IfStrEq{\SeyesParBase}{auto}% + {% + \def\SeyesStretchPar{\fpeval{4*\SeyesFullReglureSeyes/\SeyesParEchelle}}% + }% + {% + \def\SeyesStretchPar{\SeyesParBase}% + }% + \node[\SeyesParCouleur,text width=\fpeval{\SeyesParLarg/\SeyesParEchelle}cm,align=#2,inner sep=0pt,anchor=base west,scale=\SeyesParEchelle,execute at begin node=\setlength{\baselineskip}{\SeyesStretchPar mm}] at ($(SeyesOrigine)+(0.05,{-(\SeyesPar-1)*0.4*\SeyesFullReglureSeyes})+(#3)$) {#4} ; } %------page entière 5x5 \defKV[CxCFull]{% Couleur=\xdef\CCFullCoul{#1},% - CouleurMarge=\xdef\CCFullCoulM{#1} + CouleurMarge=\xdef\CCFullCoulM{#1},% + FormatPapier=\xdef\CCFullFormatPap{#1} } \setKVdefault[CxCFull]{% Couleur=lightgray!50,% CouleurMarge=gray,% - NumLignes=false + NumLignes=false,% + FormatPapier=A4 } \NewDocumentEnvironment{PleinePageCinqCinq}{ O{} }%semble OK ^^ { - \useKVdefault[CxCFull] - \setKV[CxCFull]{#1} + \useKVdefault[CxCFull]% + \setKV[CxCFull]{#1}% + \IfEq{\CCFullFormatPap}{A4}% + {\xdef\CCFullHautPap{29.7}\xdef\CCFullLargPap{21}\xdef\CCFullMargeG{1.7}\xdef\CCFullMargeH{1.3}}% + {}% + \IfEq{\CCFullFormatPap}{A5}% + {\xdef\CCFullHautPap{21}\xdef\CCFullLargPap{14.8}\xdef\CCFullMargeG{1.2}\xdef\CCFullMargeH{0.8}}% + {}% + \IfSubStr{\CCFullFormatPap}{x}% + {\StrCut{\CCFullFormatPap}{x}{\CCFullLargPap}{\CCFullHautPap}\xdef\CCFullMargeG{1.7}\xdef\CCFullMargeH{1.3}}% + {}% + %calcul du nombre de lignes /colonnes ? + \xdef\CCFullNbLign{\fpeval{round(\CCFullHautPap/(0.5),0)}}% + \xdef\CCFullNbCol{\fpeval{round((\CCFullLargPap)/(0.5),0)}}% \begin{tikzpicture}[remember picture,overlay,x=1cm,y=1cm] %lignes horizontales - \foreach \L in {0,1,...,58} {\draw[\CCFullCoul] ($(current page.north west)+(0,{-0.3-\L*0.5})$)--++({\paperwidth},0) ;} + \foreach \L in {0,1,...,\CCFullNbLign} {\draw[\CCFullCoul] ($(current page.north west)+(0,{-0.3-\L*0.5})$)--++({\paperwidth},0) ;} %lignes verticales - \foreach \C in {0,1,...,41} {\draw[\CCFullCoul] ($(current page.north west)+({0.2+0.5*\C},0)$)--($(current page.south west)+({0.2+0.5*\C},0)$) ;} + \foreach \C in {0,1,...,\CCFullNbCol} {\draw[\CCFullCoul] ($(current page.north west)+({0.2+0.5*\C},0)$)--($(current page.south west)+({0.2+0.5*\C},0)$) ;} %marge - \draw[\CCFullCoulM,thick] ($(current page.north west)+(1.7,0)$)--($(current page.south west)+(1.7,0)$) ; - \coordinate (CinqCinqOrigine) at ($(current page.north west)+(1.7,-1.3)$) ; + \draw[\CCFullCoulM,thick] ($(current page.north west)+(\CCFullMargeG,0)$)--($(current page.south west)+(\CCFullMargeG,0)$) ; + \coordinate (CinqCinqOrigine) at ($(current page.north west)+({\CCFullMargeG},{-\CCFullMargeH})$) ; \ifboolKV[CxCFull]{NumLignes}% {% \foreach \lig in {1,2,...,57} {\node[gray,inner sep=0pt,anchor=base east] at ($(CinqCinqOrigine)+(-0.2,{-0.5*(\lig-1)})$) {\tiny\sffamily \lig};} @@ -421,9 +473,9 @@ \newcommand\CadreNoteCinqCinq[2][3]{%on précise la {ligne de début} + [hauteur] %cadre de note - \draw[thick] ($(CinqCinqOrigine)+(0,{(-#2+1)*0.5})$) --++ ({\paperwidth-1.7cm},{0}) ; + \draw[thick] ($(CinqCinqOrigine)+(0,{(-#2+1)*0.5})$) --++ ({\CCFullLargPap-\CCFullMargeG},{0}) ; \draw[thick] ($(CinqCinqOrigine)+(0,{(-#2+1)*0.5})$) --++ ({0},{-#1*0.5}) ; - \draw[thick] ($(CinqCinqOrigine)+(0,{(-#2+1-#1)*0.5})$) --++ ({\paperwidth-1.7cm},{0}) ; + \draw[thick] ($(CinqCinqOrigine)+(0,{(-#2+1-#1)*0.5})$) --++ ({\CCFullLargPap-\CCFullMargeG},{0}) ; \draw[thick] ($(CinqCinqOrigine)+(0,{(-#2+1)*0.5})$) rectangle++ ({#1.*0.5},{-#1*0.5}) ; \draw[thick] ($(CinqCinqOrigine)+(0,{(-#2+1-#1)*0.5})$) --++ ({#1.*0.5},{#1*0.5}) ; } @@ -438,18 +490,21 @@ Couleur=black,% Ligne=1,% Echelle=1,% - Largeur=18.7 + Largeur=auto } \NewDocumentCommand\LignePapierCinqCinq{ O{} D<>{left} D(){0,0} m }{% - \useKVdefault[CCLigne] - \setKV[CCLigne]{#1} + \useKVdefault[CCLigne]% + \setKV[CCLigne]{#1}% + \IfEq{\CCLigneLarg}{auto}% + {\xdef\CCLigneLarg{\fpeval{\CCFullLargPap-\CCFullMargeG-0.25}}}% + {}% \node[\CCLigneCouleur,text width=\fpeval{\CCLigneLarg/\CCLigneEchelle}cm,align=#2,inner sep=0pt,anchor=base west,scale=\CCLigneEchelle] at ($(CinqCinqOrigine)+(0.05,{-(\CCLigne-1)*0.5})+(#3)$) {#4} ; } \defKV[CCPar]{% Couleur=\xdef\CCParCouleur{#1},% - TaillePolice=\xdef\CCParEchelle{#1},% + Echelle=\xdef\CCParEchelle{#1},% Espacement=\xdef\CCParBase{#1},% Ligne=\xdef\CCPar{#1},% Largeur=\xdef\CCParLarg{#1} @@ -457,44 +512,69 @@ \setKVdefault[CCPar]{% Couleur=black,% Ligne=1,% - TaillePolice=11,% - Espacement=28.5,% - Largeur=18.75 + Echelle=1,% + Espacement=auto,% + Largeur=auto } \NewDocumentCommand\ParagraphePapierCinqCinq{ O{} D<>{justify} D(){0,0} m }{% \useKVdefault[CCPar] - \setKV[CCPar]{#1} - \node[\CCParCouleur,text width=\CCParLarg cm,align=#2,inner sep=0pt,anchor=base west,font=\fontsize{\CCParEchelle}{\CCParBase}\selectfont] at ($(CinqCinqOrigine)+(0.05,{-(\CCPar-1)*0.5})+(#3)$) {#4} ; + \setKV[CCPar]{#1}% + \IfEq{\CCParLarg}{auto}% + {\xdef\CCParLarg{\fpeval{\CCFullLargPap-\CCFullMargeG-0.25}}}% + {}% + \IfStrEq{\CCParBase}{auto}% + {% + \def\CCStretchPar{\fpeval{5/\CCParEchelle}}% + }% + {% + \def\CCStretchPar{\CCParBase}% + } + \node[\CCParCouleur,text width=\fpeval{\CCParLarg/\CCParEchelle}cm,align=#2,inner sep=0pt,anchor=base west,scale=\CCParEchelle,execute at begin node=\setlength{\baselineskip}{\CCStretchPar mm}] at ($(CinqCinqOrigine)+(0.05,{-(\CCPar-1)*0.5})+(#3)$) {#4} ; } %------page entière ruled \defKV[RuledFull]{% Couleur=\xdef\RuledFullCoul{#1},% - CouleurMarge=\xdef\RuledFullCoulMarge{#1} + CouleurMarge=\xdef\RuledFullCoulMarge{#1},% + FormatPapier=\xdef\RuledFullFormatPapier{#1} } \setKVdefault[RuledFull]{% Couleur=PapierGris,% CouleurMarge=TyrianPurple,% - NumLignes=false + NumLignes=false,% + FormatPapier=A4 } \NewDocumentEnvironment{PleinePageRuled}{ O{} }%semble OK ^^ { - \useKVdefault[RuledFull] - \setKV[RuledFull]{#1} + \useKVdefault[RuledFull]% + \setKV[RuledFull]{#1}% + + \IfEq{\RuledFullFormatPapier}{A4}% + {\xdef\RuledFullHautPap{29.7}\xdef\RuledFullLargPap{21}\xdef\RuledFullMarge{3}\xdef\RuledFullMargeH{1.5}\xdef\RuledFullHautEff{26.1}}% + {}% + \IfEq{\RuledFullFormatPapier}{A5}% + {\xdef\RuledFullHautPap{21}\xdef\RuledFullLargPap{14.8}\xdef\RuledFullMarge{1.5}\xdef\RuledFullMargeH{1.25}\xdef\RuledFullHautEff{18.9}}% + {}% + \IfSubStr{\RuledFullFormatPapier}{x}% + {\StrCut{\RuledFullFormatPapier}{x}{\RuledFullLargPap}{\RuledFullHautPap}\xdef\RuledFullMarge{3}\xdef\RuledFullMargeH{3}\xdef\RuledFullHautEff{\fpeval{\RuledFullHautPap-3.5}}}% + {}% + %calcul du nombre de lignes /colonnes ? + \xdef\RuledFullNbLign{\fpeval{round(\RuledFullHautEff/(0.9),0)}}% \begin{tikzpicture}[remember picture,overlay,x=1cm,y=1cm] %lignes horizontales - \foreach \L in {1.5,2.4,...,27.6} {\draw[\RuledFullCoul] ($(current page.north west)+(0,{-\L})$)--++({\paperwidth},0) ;} + \foreach \L in {1,...,\RuledFullNbLign} {\draw[\RuledFullCoul] ($(current page.north west)+(0,{-(\L-1)*0.9-\RuledFullMargeH})$)--++({\paperwidth},0) ;} + %\foreach \L in {1.5,2.4,...,27.6} {\draw[\RuledFullCoul] ($(current page.north west)+(0,{-\L})$)--++({\paperwidth},0) ;} %lignes verticales - \draw[thick,\RuledFullCoulMarge] ($(current page.north west)+(3,0)$)--($(current page.south west)+(3,0)$) ; - \draw[thick,\RuledFullCoulMarge] ($(current page.north east)+(-3,0)$)--($(current page.south east)+(-3,0)$) ; + \draw[thick,\RuledFullCoulMarge] ($(current page.north west)+({\RuledFullMarge},0)$)--($(current page.south west)+({\RuledFullMarge},0)$) ; + \draw[thick,\RuledFullCoulMarge] ($(current page.north east)+({-\RuledFullMarge},0)$)--($(current page.south east)+({-\RuledFullMarge},0)$) ; %\foreach \C in {3} {\draw[thick,\RuledFullCoulMarge] ($(current page.north west)+({\C},0)$)--($(current page.south west)+({\C},0)$) ;} %origine - \coordinate (RuledOrigine) at ($(current page.north west)+(3,-1.5)$) ; + \coordinate (RuledOrigine) at ($(current page.north west)+({\RuledFullMarge},{-\RuledFullMargeH})$) ; \ifboolKV[RuledFull]{NumLignes}% {% - \foreach \lig in {1,2,...,30} {\node[gray,inner sep=0pt,anchor=base east] at ($(RuledOrigine)+(-0.2,{-0.9*(\lig-1)})$) {\tiny\sffamily \lig};} + \foreach \lig in {1,...,\RuledFullNbLign} {\node[gray,inner sep=0pt,anchor=base east] at ($(RuledOrigine)+(-0.2,{-0.9*(\lig-1)})$) {\tiny\sffamily \lig};} }% {} } @@ -504,10 +584,10 @@ \newcommand\CadreNoteRuled[2][3]{%on précise la {ligne de début} + [hauteur] %cadre de note - \draw[thick] ($(RuledOrigine)+(0,{(-#2+1)*0.9})$) --++ ({\paperwidth-6cm},{0}) ; + \draw[thick] ($(RuledOrigine)+(0,{(-#2+1)*0.9})$) --++ ({\RuledFullLargPap-2*\RuledFullMarge},{0}) ; \draw[thick] ($(RuledOrigine)+(0,{(-#2+1)*0.9})$) --++ ({0},{-#1*0.9}) ; \draw[thick] ($(RuledOrigine)+({\paperwidth-6},{(-#2+1)*0.9})$) --++ ({0},{-#1*0.9}) ; - \draw[thick] ($(RuledOrigine)+(0,{(-#2+1-#1)*0.9})$) --++ ({\paperwidth-6cm},{0}) ; + \draw[thick] ($(RuledOrigine)+(0,{(-#2+1-#1)*0.9})$) --++ ({\RuledFullLargPap-2*\RuledFullMarge},{0}) ; \draw[thick] ($(RuledOrigine)+(0,{(-#2+1)*0.9})$) rectangle++ ({#1.*0.9},{-#1*0.9}) ; \draw[thick] ($(RuledOrigine)+(0,{(-#2+1-#1)*0.9})$) --++ ({#1.*0.9},{#1*0.9}) ; } @@ -522,18 +602,22 @@ Couleur=black,% Ligne=1,% Echelle=1,% - Largeur=14.75 + Largeur=auto } \NewDocumentCommand\LignePapierRuled{ O{} D<>{left} D(){0,0} m }{% - \useKVdefault[RuledLigne] - \setKV[RuledLigne]{#1} + \useKVdefault[RuledLigne]% + \setKV[RuledLigne]{#1}% + \IfEq{\RuledLigneLarg}{auto}% + {\xdef\RuledLigneLarg{\fpeval{\RuledFullLargPap-2*\RuledFullMarge-0.25}}}% + {}% \node[\RuledLigneCouleur,text width=\fpeval{\RuledLigneLarg/\RuledLigneEchelle}cm,align=#2,inner sep=0pt,anchor=base west,scale=\RuledLigneEchelle] at ($(RuledOrigine)+(0.05,{-(\RuledLigne-1)*0.9})+(#3)$) {#4} ; } \defKV[RuledPar]{% Couleur=\xdef\RuledParCouleur{#1},% - TaillePolice=\xdef\RuledParEchelle{#1},% + Echelle=\xdef\RuledParEchelle{#1},% + %TaillePolice=\xdef\RuledParEchelle{#1},% Espacement=\xdef\RuledParBase{#1},% Ligne=\xdef\RuledPar{#1},% Largeur=\xdef\RuledParLarg{#1} @@ -541,15 +625,26 @@ \setKVdefault[RuledPar]{% Couleur=black,% Ligne=1,% - TaillePolice=11,% - Espacement=25.641,% - Largeur=14.75 + %TaillePolice=11,% + Echelle=1,% + Espacement=auto,% + Largeur=auto } \NewDocumentCommand\ParagraphePapierRuled{ O{} D<>{justify} D(){0,0} m }{% - \useKVdefault[RuledPar] - \setKV[RuledPar]{#1} - \node[\RuledParCouleur,text width=\RuledParLarg cm,align=#2,inner sep=0pt,anchor=base west,font=\fontsize{\RuledParEchelle}{\RuledParBase}\selectfont] at ($(RuledOrigine)+(0.05,{-(\RuledPar-1)*0.9})+(#3)$) {#4} ; + \useKVdefault[RuledPar]% + \setKV[RuledPar]{#1}% + \IfEq{\RuledParLarg}{auto}% + {\xdef\RuledParLarg{\fpeval{\RuledFullLargPap-2*\RuledFullMarge-0.25}}}% + {}% + \IfStrEq{\RuledParBase}{auto}% + {% + \def\RuledStretchPar{\fpeval{9/\RuledParEchelle}}% + }% + {% + \def\RuledStretchPar{\RuledParBase}% + } + \node[\RuledParCouleur,text width=\fpeval{\RuledParLarg/\RuledParEchelle}cm,align=#2,inner sep=0pt,anchor=base west,scale=\RuledParEchelle,execute at begin node=\setlength{\baselineskip}{\RuledStretchPar mm}] at ($(RuledOrigine)+(0.05,{-(\RuledPar-1)*0.9})+(#3)$) {#4} ; } \endinput
\ No newline at end of file |