Possible Duplicate:
Tool for cleaning LaTeX code
This might not be a TeX question, strictly speaking but I'm sure this is the right forum to ask this: Is there a tool that can format the (La)TeX source documents? To clarify, I'm not trying to typeset TeX sourcecode in output documents -- I have listings, algorithms and minted for that. I'm trying to find a tool that can format my source .tex documents so that they have better indentation etc.
indent-regionis the command you want. I find the 'LaTeX' mode to format code much better than 'TeX' mode. – Justin Bailey Jan 15 '12 at 07:20