I'm trying to fill in the steps from my textbook on the derivation of enthalpy departure from ideal gas behavior. My textbook gives the variation of mass-specific enthalpy with temperature pressure as $$\left ( \frac{\partial h}{\partial p} \right )_T=v-T\left ( \frac{\partial v}{\partial T} \right )_p$$
Integrating from pressure $p'$ to $p$ at fixed temperature $T$, $$h(T,p)-h(T,p')=\int_{p'}^{p}\left [ v-T\left ( \frac{\partial v}{\partial T} \right )_p\right ]dp$$
If we use the superscript $^*$ to denote ideal gas property values, adding and subtracting $h^*(T)$ from the left hand side of the equation gives $$\left [h(T,p)-h^*(T) \right ]-\left [h(T,p')-h^*(T) \right ]=\int_{p'}^{p}\left [ v-T\left ( \frac{\partial v}{\partial T} \right )_p\right ]dp$$
By the assumptions of the ideal gas model, we have
$$\lim_{p'\rightarrow 0}\left [h(T,p')-h^*(T) \right ]=0$$
and in this limit, the following expression is obtained $$h(T,p)-h^*(T)=\int_{0}^{p}\left [ v-T\left ( \frac{\partial v}{\partial T} \right )_p\right ]dp$$ This can be thought of as the change in specific enthalpy as the pressure is increased from zero to the given pressure isothermally. This equation can be evaluated with $pvT$ data.
The integral in the last equation can be expressed in terms of the compressibility factor $Z$ and the reduced temperature $T_R$ and reduced pressure $p_R$. Solving $Z=pv/RT$ gives
$$v=\frac{ZRT}{p}$$
On differentiation,
$$\left ( \frac{\partial v}{\partial T} \right )_p=\frac{RZ}{p}+\frac{RT}{p}\left ( \frac{\partial Z}{\partial T} \right )_p$$
$$v-T\left ( \frac{\partial v}{\partial T} \right )_p=\frac{ZRT}{p}-T\left [ \frac{RZ}{p}+\frac{RT}{p}\left ( \frac{\partial Z}{\partial T} \right )_p \right ]=-\frac{RT^2}{p}\left ( \frac{\partial Z}{\partial T} \right )_p$$
This equation can be written in terms of the reduced properties $T_R$ ad $p_R$ as
$$v-T\left ( \frac{\partial v}{\partial T} \right )_p=-\frac{RT_c}{p_c}\cdot \frac{T_R^2}{p_R}\left ( \frac{\partial Z}{\partial T_R} \right )_{p_R}$$
Introducing this last equation into the equation
$$h(T,p)-h^*(T)=\int_{0}^{p}\left [ v-T\left ( \frac{\partial v}{\partial T} \right )_p\right ]dp$$
gives, on rearrangement,
$$\frac{h^*(T)-h(T,p)}{RT_c}=T_R^2\int_{0}^{p_R}\left ( \frac{\partial Z}{\partial T_R} \right )_{p_R}\frac{dp_R}{p_R}=T_R^2\int_{0}^{p_R}\left ( \frac{\partial Z}{\partial T_R} \right )_{p_R}d\ln p_R$$
What I'm failing to understand is how we get from the equation
$$v-T\left ( \frac{\partial v}{\partial T} \right )_p=\frac{ZRT}{p}-T\left [ \frac{RZ}{p}+\frac{RT}{p}\left ( \frac{\partial Z}{\partial T} \right )_p \right ]=-\frac{RT^2}{p}\left ( \frac{\partial Z}{\partial T} \right )_p$$
to the equation
$$v-T\left ( \frac{\partial v}{\partial T} \right )_p=-\frac{RT_c}{p_c}\cdot \frac{T_R^2}{p_R}\left ( \frac{\partial Z}{\partial T_R} \right )_{p_R}$$
and then to the equation
$$\frac{h^*(T)-h(T,p)}{RT_c}=T_R^2\int_{0}^{p_R}\left ( \frac{\partial Z}{\partial T_R} \right )_{p_R}\frac{dp_R}{p_R}=T_R^2\int_{0}^{p_R}\left ( \frac{\partial Z}{\partial T_R} \right )_{p_R}d\ln p_R$$
In a couple books I've looked at, the algebraic and calculus manipulations are just glossed over and ignored. I'm hoping someone can help me fill in the steps.