def insert(self, i, arg):
arg = self.__coerce(arg)<EOL>if isinstance(arg, Arg):<EOL><INDENT>super().insert(i, arg)<EOL><DEDENT>if len(self) <= <NUM_LIT:1>:<EOL><INDENT>self.all.append(arg)<EOL><DEDENT>else:<EOL><INDENT>if i > len(self):<EOL><INDENT>i = len(self) - <NUM_LIT:1><EOL><DEDENT>before = self[i - <NUM_LIT:1>]<EOL>index_before = self.all.index(before)<EOL>self.all.insert(index_before + <NUM_LIT:1>, arg)<EOL><DEDENT>
r"""Insert whitespace, an unparsed argument string, or an argument
        object.

        :param int i: Index to insert argument into
        :param Arg arg: Argument to insert

        >>> arguments = TexArgs(['\n', RArg('arg0'), '[arg2]'])
        >>> arguments.insert(1, '[arg1]')
        >>> len(arguments)
        3
        >>> arguments
        [RArg('arg0'), OArg('arg1'), OArg('arg2')]
        >>> arguments.all
        ['\n', RArg('arg0'), OArg('arg1'), OArg('arg2')]
        >>> arguments.insert(10, '[arg3]')
        >>> arguments[3]
        OArg('arg3')