Le code définit la boîte de bordure, puis dans la partie commençant par :
\ifx\PageBorderTwo\empty\else
Il vérifie si PageBorderTwo est défini et, si c’est le cas, modifie PageBorder. Tel quel, le code de Jeff semble recharger le PDF de la bordure à chaque page, donc la modification de PageBorder prend effet la prochaine fois qu’il doit écrire une bordure. Si PageBorderTwo est vide, alors PageBorder restera tel qu’il était.
Si vous n’utilisez pas la version du code de Jeff, mais vous en tenez à l’original, qui ne recharge le PDF que lorsque la boîte est vide (par exemple, au début du document), nous pouvons en tirer parti avec des déclencheurs (triggers) et définir la boîte comme vide (void) chaque fois que nous voulons changer la bordure.
Si vous voulez changer la bordure à divers endroits du code, vous pourriez faire quelque chose comme ceci :
\makeatletter
\setcvhook{GEN1.1}{\def\PageBorder{path_to_border2}\setbox\b@rder\box\voidb@x}
\sethook{bookstart}{MAT}{\let\PageBorder\empty\setbox\b@rder\box\voidb@x} % No border for NT intro
\setcvhook{MAT1.1}{\def\PageBorder{path_to_border3}\setbox\b@rder\box\voidb@x}
\makeatother
Tout le code est totalement non testé !
(\voidb@x est simplement une boîte normale, mais personne ne devrait jamais y mettre quoi que ce soit, donc elle est toujours vide)
The code defines the border box and then in the bit starting:
\ifx\PageBorderTwo\empty\else
It checks if PageBorderTwo is set and if so changes PageBorder. As given, Jeff’s code looks like it reloading the border PDF each page, so changing PageBorder takes effect the next time it has to write a border. If PageBorderTwo is empty, then PageBorder will stay as it was.
If you don’t use Jeff’s version of the code, but stick to the original, that only reloads the PDF when the box is empty (e.g. at the start of the document), we can make use this with triggers, and set the box to empty (void) whenever we want to change the border.
If you want to change the border at various places in the code, you could do something like this:
\makeatletter
\setcvhook{GEN1.1}{\def\PageBorder{path_to_border2}\setbox\b@rder\box\voidb@x}
\sethook{bookstart}{MAT}{\let\PageBorder\empty\setbox\b@rder\box\voidb@x} % No border for NT intro
\setcvhook{MAT1.1}{\def\PageBorder{path_to_border3}\setbox\b@rder\box\voidb@x}
\makeatother
All code is totally untested!
(\voidb@x is just a normal box, but no one should ever put anything in it, thus it’s always void)
Traduit automatiquement depuis English Afficher l'original