alvinwan / TexSoup

fault-tolerant Python3 package for searching, navigating, and modifying LaTeX documents
https://texsoup.alvinwan.com
BSD 2-Clause "Simplified" License
290 stars 43 forks source link

Commands in environment arguments cannot be deleted #146

Open masonproffitt opened 1 year ago

masonproffitt commented 1 year ago

For example:

>>> import TexSoup
>>> ts = TexSoup.TexSoup(r'\begin{env}{\test}\end{env}')
>>> ts.find('test').delete()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/atlas/physics-office/src/TexSoup/TexSoup/data.py", line 473, in delete
    parent.remove(self)
  File "/home/user/atlas/physics-office/src/TexSoup/TexSoup/data.py", line 551, in remove
    self.expr.remove(node.expr)
  File "/home/user/atlas/physics-office/src/TexSoup/TexSoup/data.py", line 844, in remove
    index = self._contents.index(expr)
ValueError: TexCmd('test') is not in list