#StackBounty: #align #resize Scale each line of a multi-line equation separately if it exceeds the linewidth

Bounty: 50

I have many long equations, some in the order of 7-8 lines. I know that there are probably thousands of people here that instantly are urged to comment “don’t scale in Latex”, but I want to, so please take this as a requirement and don’t suggest other methods.

I would love an environment that works in exactly the same way as align, but automatically scales lines which are too wide for a page to the appropriate width.

With appropriate width I mean that all lines except for the last are allowed the full page width, however the last one should have enough margin, such that the equation number still fits within the same line.

As an example of a very challenging equation, please take this one (I know that the below typesetting is not nice, especially the … additional alignments, since I did not want to use && alignment tags and the appearance was fine to me):

begin{align}
epsilon_rho &cong resizebox{0.92hsize}{!}{$Bigg[frac{g_0 hat{M}}{k hat{T}_{ex}^2} Bigg( zeta + frac{hat{T}_0}{hat{T}_0'} lnbigg(frac{hat{T}_0}{hat{T}(zeta)}bigg)Bigg) - frac{1 + hat{alpha} + hat{gamma}}{hat{T}(zeta)} left(1 - frac{hat{T}_{ex} - hat{T}(zeta)}{hat{T}_{ex} - hat{T}_0} (1 + hat{sigma}zeta)right)$}nonumber\
&    + frac{g_0}{k hat{T}_{ex}^2} Bigg(zeta + frac{hat{T}_0}{hat{T}_0'} lnbigg(frac{hat{T}_0}{hat{T}(zeta)}bigg)Bigg) left(frac{sumdisplaylimits_{i=1}^{n_text{species}} M_i^2 hat{n}_i}{sumdisplaylimits_{i=1}^{n_text{species}} M_i hat{n}_i} - hat{M}right)nonumber\
&    resizebox{0.92hsize}{!}{$+ frac{1 - frac{hat{T}_{ex} - hat{T}(zeta)}{hat{T}_{ex} - hat{T}_0} (1 + hat{sigma}zeta)}{hat{T}(zeta)} left(hat{alpha } + hat{gamma} - frac{sumlimits_{i=1}^{n_text{species}} M_i hat{n}_i alpha_i}{hat{n}hat{M}} - frac{sumlimits_{i=1}^{n_text{species}} M_i hat{n}_i gamma_i}{hat{n}hat{M}}right)vast] delta T_{ex}$}nonumber\
&+ resizebox{0.92hsize}{!}{$Bigg[frac{g_0 hat{M}}{k hat{T}_{ex}hat{T}_0'} lnleft(frac{hat{T}(zeta)}{hat{T}_0}right) - frac{1 + hat{alpha} + hat{gamma}}{hat{T}(zeta)} left(frac{hat{T}_{ex} - hat{T}(zeta)}{hat{T}_{ex} - hat{T}_0} (1 + hat{sigma}zeta) - frac{hat{T}(zeta)}{hat{T}_0}right)$}nonumber\
&    + frac{g_0}{k hat{T}_0' hat{T}_{ex}} lnleft(frac{hat{T}(zeta)}{hat{T}_0}right) left(frac{sumdisplaylimits_{i=1}^{n_text{species}} M_i^2 hat{n}_i}{sumdisplaylimits_{i=1}^{n_text{species}} M_i hat{n}_i} - hat{M}right)nonumber\
&    resizebox{0.92hsize}{!}{$- frac{frac{hat{T}(zeta)}{hat{T}_0} - frac{hat{T}_{ex} - hat{T}(zeta)}{hat{T}_{ex} - hat{T}_0}(1+hat{sigma}zeta)}{hat{T}(zeta)}left(hat{alpha} + hat{gamma} - frac{sumlimits_{i=1}^{n_text{species}} M_i hat{n}_i alpha_i}{hat{n}hat{M}} - frac{sumlimits_{i=1}^{n_text{species}} M_i hat{n}_i gamma_i}{hat{n}hat{M}}right)vast] delta T_0$}nonumber\
&+frac{sumdisplaylimits_{i=1}^{n_{text{species}}} M_i hat{n}_i exp(delta G_i)}{hat{n}hat{M}} - 1nonumber\ 
&+ epsilon_n epsilon_M
label{eq:epsRhoCombined}
end{align}

The output of above code is:

enter image description here

–> Any help on defining a resizedalign-environment which automatically takes care of the overlong tines (that may be identified via the resizeboxes) is highly appreciated.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.