ehuss/Sublime-Wrap-Plus

Do not wrap LaTeX formulas.

Closed this issue · 1 comments

ph03 commented

Hi! Thanks for the great plugin!
I'm currently trying to reformat a portion of a bigger latex document containing a lot of formulas.
However, code blogs like

The quadratic form $\mN$ for the integration of the squared norm of an
$m$-dimensional linear function on any simplex $\Omega$ of dimension $n$ can
therefore be written as
\begin{align}
\label{eq:integration_matrix}
\mN &= \Factorial{n} \, \vol{\Omega} \, \Transpose{\mP} \inp{\mH^0_n \otimes \IdentityMatrix_m} \, \mP \nonumber\\%
    &= \Factorial{n} \, \vol{\Omega} \, \mN^0~.
\end{align}
The discrete $L^2$-product of piecewise-linear functions on a simplical
complexes is obtained by assembling the quadratic forms $\mN$ of each simplex
into an operator $\mM$ on the whole complex.

is wrapped to

The quadratic form $\mN$ for the integration of the squared norm of an
$m$-dimensional linear function on any simplex $\Omega$ of dimension $n$ can
therefore be written as \begin{align} \label{eq:integration_matrix} \mN &=
\Factorial{n} \, \vol{\Omega} \, \Transpose{\mP} \inp{\mH^0_n \otimes
\IdentityMatrix_m} \, \mP \nonumber\\%     &= \Factorial{n} \, \vol{\Omega} \,
\mN^0~. \end{align} The discrete $L^2$-product of piecewise-linear functions on
a simplical complexes is obtained by assembling the quadratic forms $\mN$ of
each simplex into an operator $\mM$ on the whole complex.

however, it would be nice if it would not wrap the part inside environments
of the form \begin{xxx} ... \end{xxx} .
The same goes with

\[
xxx
\]

math blocks. Is it possible to extend the plugin to ignore these parts in latex
documents?

I added a check that will prevent it from wrapping lines that start with a backslash. It seems relatively safe to me. Considering this is not a real parser, it certainly won't handle all situations, hopefully this works for you. Worst case you can just manually select the lines you want to rewrap.