Kode tersebut mendefinisikan kotak batas (border box) dan kemudian di bagian yang dimulai dengan:
\ifx\PageBorderTwo\empty\else
Ini memeriksa apakah PageBorderTwo diatur, dan jika ya, mengubah PageBorder. Seperti yang diberikan, kode Jeff tampaknya memuat ulang PDF batas setiap halaman, sehingga perubahan PageBorder berlaku saat berikutnya harus menulis batas. Jika PageBorderTwo kosong, maka PageBorder akan tetap seperti semula.
Jika Anda tidak menggunakan versi kode Jeff, tetapi tetap menggunakan versi asli, yang hanya memuat ulang PDF ketika kotak kosong (misalnya di awal dokumen), kita dapat memanfaatkan ini dengan pemicu (triggers), dan mengatur kotak menjadi kosong (void) kapan pun kita ingin mengubah batas.
Jika Anda ingin mengubah batas di berbagai tempat dalam kode, Anda bisa melakukan sesuatu seperti ini:
\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
Semua kode sama sekali belum diuji!
(\voidb@x hanyalah kotak biasa, tetapi tidak ada yang seharusnya menempatkan sesuatu di dalamnya, sehingga selalu kosong)
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)
Diterjemahkan secara otomatis dari English