def METHOD_NAME(self, builder: str, doctreedir: str | None = None) -> int:
    # compatibility with old Makefile
    papersize = os.getenv('PAPER', '')
    opts = self.opts
    if papersize in ('a4', 'letter'):
        opts.extend(['-D', 'latex_elements.papersize=' + papersize + 'paper'])
    if doctreedir is None:
        doctreedir = self.builddir_join('doctrees')
    args = ['-b', builder,
            '-d', doctreedir,
            self.srcdir,
            self.builddir_join(builder)]
    return build_main(args + opts)