<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def text(self):
 r"""All text in descendant nodes. This is equivalent to contents, keeping text elements and excluding Tex expressions. 'Nested\n ' """

        for descendant in self.contents:
            if isinstance(descendant, TokenWithPosition):
                yield descendant
            elif hasattr(descendant, 'text'):
                yield from descendant.text