I come from this comment both enlightened and with a question mark over my head:

The command \makeatletter \makeatother requires packages, in my case pdfpages and xpatch. In so far I use these only inside the file template.tex, there is no further complication, and the proposed solution rests.

HOWEVER, since my next intention is to integrate it into the class file politex.cls, I require to use the command \RequirePackage[package_name] to allow me to use its available features.

So far, so good. When I add the rows below on politex.cls, the file template.tex stops compiling.

  • 1
    \makeatletter and \makeatother should not require any packages (of course code that comes in between might, but the two commands are defined in the LaTeX kernel).
    – moewe
    Commented Jan 7, 2023 at 14:57
  • 1
    But if you need packages and want to load them in a .cls file then \RequirePackage as you show is how you'd usually do it. Note that in a .cls file you won't need and shouldn't use \makeatletter...\makeatother. These commands are only needed in a .tex document when you mess with internal commands.
    – moewe
    Commented Jan 7, 2023 at 14:59
  • (Flying) Moewe, may you give some further advice on how to adequate .tex code snippet on .cls file?
    – Bruno Lobo
    Commented Jan 7, 2023 at 15:07
  • 1
    I don't really understand which snippet you need to implant into your .cls file, but usually the rule is that any code can just go into the .cls with \usepackage replaced with \RequirePackage and the \makeatletter and \makeatother removed. Your class is very long and complex, though, so it is possible that there are load order classes or code order issues.
    – moewe
    Commented Jan 7, 2023 at 15:09
  • This is the main subject on the issue: investigate the reason for xpatch and pdfpages raises errors. :-/
    – Bruno Lobo
    Commented Jan 7, 2023 at 15:13


Browse other questions tagged .