Is it possible to export a selection to latex instead of the whole file?
As a workaround, this is what I am doing (I am reading the content from the clipboard in the python file):
(tm-define (export-current-selection-to-latex)
(let ((temp (clipboard-get-export)))
(clipboard-set-export "latex")
(clipboard-copy "primary")
(clipboard-set-export temp)
(system "python ~/clean_latex.py &"))