Replace all with SugarTeX.
    Runs ``sugartex_preprocess`` then iterates via regex and
    replaces each math between '$...$'.

def sugartex_replace_all(string):
    """
    Replace all with SugarTeX.
    Runs ``sugartex_preprocess`` then iterates via regex and
    replaces each math between '$...$'.
    """
    string = sugartex_preprocess(string).replace(r'\$', SESSION_ID)
    return re.sub(
        r'(?<=\$)[^$]*(?=\$)',
        lambda m: sugartex.replace(m.group(0)),
        string
    ).replace(SESSION_ID, r'\$')