code: def remove_comments(tex_source):
      
      # Expression via http://stackoverflow.com/a/13365453
      return re.sub(r'(?<!\\)%.*$', r'', tex_source, flags=re.M)
docs: Delete latex comments from TeX source.
  
      Parameters
      ----------
      tex_source : str
          TeX source content.
  
      Returns
      -------
      tex_source : str
          TeX source without comments.