def METHOD_NAME(self, canv, x, y, _sW=0):
    if _sW and hasattr(self, 'hAlign'):
        from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT, TA_JUSTIFY
        a = self.hAlign
        if a in ('CENTER', 'CENTRE', TA_CENTER):
            x = x + 0.5 * _sW
        elif a in ('RIGHT', TA_RIGHT):
            x = x + _sW
        elif a not in ('LEFT', TA_LEFT, TA_JUSTIFY):
            raise ValueError("Bad hAlign value " + str(a))
    height = 0
    if HAS_MATPLOTLIB:
        global fonts
        canv.saveState()
        try:
            (width, height, descent, glyphs, rects,) = self.parser.parse(
                enclose(self.s), 72, prop=FontProperties(size=self.fontsize)
            )
            canv.translate(x, y + descent)
            for font, fontsize, num, ox, oy in glyphs:
                fontname = font.fname
                if fontname not in fonts:
                    fonts[fontname] = fontname
                    pdfmetrics.registerFont(TTFont(fontname, fontname))
                canv.setFont(fontname, fontsize)
                rgb_color = to_rgb(self.color)
                canv.setFillColorRGB(rgb_color[0], rgb_color[1], rgb_color[2])
                canv.drawString(ox, oy, chr(num))
            canv.setLineWidth(0)
            canv.setDash([])
            for ox, oy, width, height in rects:
                canv.rect(ox, oy + height, width, height, fill=1)
        except Exception as e:
            log.error(f"Math error: {e}")
            log.exception("Math error!")
            canv.translate(x, y)
            rgb_color = to_rgb(self.color)
            canv.setFillColorRGB(rgb_color[0], rgb_color[1], rgb_color[2])
            canv.drawString(0, 0, self.s)
        canv.restoreState()
    else:
        canv.saveState()
        canv.translate(x, y)
        canv.drawString(x, y, self.s)
        canv.restoreState()
    if self.label:
        log.info('Drawing equation-%s' % self.label)
        canv.bookmarkHorizontal('equation-%s' % self.label, 0, height)