move some source to the function scanLatexSource