'Generate pairs delta,c where c is a token or tuple of tokens from tex
(after deleting extraneous brackets starting at pos) and delta
is the length of the tokens prior to bracket deletion.'

def candidates(self, offset):

    t = self[offset]
    if (t in _blacklist):
        return
    elif (t == '{'):
        for (delta, c) in self.candidates((offset + 1)):
            if (self[((offset + delta) + 1)] == '}'):
                (yield ((delta + 2), c))
    elif (t == '\\mbox'):
        for (delta, c) in self.candidates((offset + 1)):
            (yield ((delta + 1), c))
    elif ((t == '$') and (self[(offset + 2)] == '$')):
        (yield (3, (t, self[(offset + 1)], t)))
    else:
        q = self[(offset + 1)]
        if ((q == '{') and (self[(offset + 3)] == '}')):
            (yield (4, (t, self[(offset + 2)])))
        elif q:
            (yield (2, (t, q)))
        (yield (1, t))
