def process_tex(lines):
 new_lines = []
 for line in lines:
  line = re.sub('^\\s*\\\\strong{See Also:}\\s*$', '\\paragraph{See Also}', line)
  if (line.startswith('\\section{scipy.') or line.startswith('\\subsection{scipy.') or line.startswith('\\subsubsection{scipy.') or line.startswith('\\paragraph{scipy.') or line.startswith('\\subparagraph{scipy.')):
   pass
  else:
   new_lines.append(line)
 return new_lines

def process_tex ( lines ) : new_lines = [ ] for line in lines : line = re . sub ( '^\\s*\\\\strong{See Also:}\\s*$' , '\\paragraph{See Also}' , line ) if ( line . startswith ( '\\section{scipy.' ) or line . startswith ( '\\subsection{scipy.' ) or line . startswith ( '\\subsubsection{scipy.' ) or line . startswith ( '\\paragraph{scipy.' ) or line . startswith ( '\\subparagraph{scipy.' ) ) : pass else : new_lines . append ( line ) return new_lines
remove unnecessary section titles from the latex file .