El código define la caja del borde y luego en la parte que comienza:
\ifx\PageBorderTwo\empty\else
Comprueba si PageBorderTwo está definido y, de ser así, cambia PageBorder. Tal como está, el código de Jeff parece recargar el PDF del borde en cada página, por lo que cambiar PageBorder surte efecto la próxima vez que tenga que escribir un borde. Si PageBorderTwo está vacío, PageBorder se mantendrá como estaba.
Si no usas la versión del código de Jeff, sino que te ciñes a la original, que solo recarga el PDF cuando la caja está vacía (p. ej., al inicio del documento), podemos aprovechar esto con ganchos (triggers) y establecer la caja como vacía (void) cada vez que queramos cambiar el borde.
Si quieres cambiar el borde en varios lugares del código, podrías hacer algo como esto:
\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
¡Todo el código está totalmente sin probar!
(\voidb@x es simplemente una caja normal, pero nadie debería poner nada en ella, por lo que siempre está vacía)
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)
Traducción automática desde English