<div dir="ltr"><div><span style="font-size:14px"><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

When using the LaTeX bundle, "Reformat paragraph" isn't very clever<br></blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

about respecting things like environments that aren't separated by a<br></blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

blank line and commands like \item and \caption that might take<br></blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

paragraph text. Is it possible to customise this?<br></blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

<br></blockquote><div> </div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">
I think it's more a question of someone just writing a "reformat<br></blockquote><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
paragraph" script for LaTeX files. Then you can bind it to the same</blockquote><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
keystroke. But I don't know of any such "latex beautifier". If we can</blockquote><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
formalize precisely what such a script should be doing, it will</blockquote><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
probably be not too hard to write one.</blockquote><div> </div>The standard LaTeX bundles still(!) ships with an old LaTeX Tidy I wrote, under "Tidy".  It is simple-minded and works on the whole document.  You should try it out and see if it gets close to what you want. You may be able to effectively customize it (it's a perl script LaTeXTidy.pl in Latex.tmbundle/Support/bin).  Here are the notes from the script comments:<br>

<br># General Idea<br># ------------<br><br># Eat all single newlines. Add newlines after all "\\"<br># Newlines before each \begin and \end. After each \end{}<br># Each environment \begin adds a level of tab.<br>

# Newlines before each \item.<br># \n before each \[  and after each \]<br><br>best wishes, Eric<br>--<br>Eric Hsu, Associate Professor of Mathematics<br>San Francisco State University<br><a href="http://math.sfsu.edu/hsu" target="_blank">http://math.sfsu.edu/hsu</a><br>

<a href="mailto:erichsu@math.sfsu.edu" target="_blank">erichsu@math.sfsu.edu</a><br><br></span></div></div>