Does enthalpy equal heat when PV work is done?
I shall start off by mentioning that your question is not so much about p-V work being done, but rather about the pressure not being constant. It is perfectly possible for p-V work to be done when the pressure is constant, and indeed under these circumstances, the equation $\Delta H = q$ is still obeyed. However, this would necessitate a change in temperature.



Well, you can always try to come up with a counterexample.

Your hypothesis would be that if pressure is not constant and p-V work is done, then $\Delta H = q$. So, let's try calculating those two quantities for a reversible isothermal expansion of $1\mathrm{~mol}$ of an ideal gas, from an initial state of $(p_1, V_1)$ to a final state of $(p_2, V_2)$. Let's just arbitrarily set $V_2 = 2V_1$. Of course, since this is an ideal gas we are talking about, $p_2$ will be equal to $p_1/2$. And since this is a reversible process, $p_\mathrm{int} = p_\mathrm{ext}$ throughout, so let's drop the int and ext subscripts.

Let's calculate the work done (on the system) first.

$$\begin{align}
w &amp;= -\int \! p\,\mathrm{d}V \\
&amp;= -\int \! \frac{nRT}{V}\,\mathrm{d}V \\
&amp;= nRT \ln{\left(\frac{V_1}{V_2}\right)} \\
&amp;= -RT \ln 2
\end{align}$$

Now the internal energy change of the system has to be zero, since this is a closed system with an ideal gas and therefore $U = U(T)$. $\Delta T = 0$ therefore implies $\Delta U = 0$. So:

$$\begin{align}
q &amp;= \Delta U - w \\
&amp;= RT \ln 2
\end{align}$$

However, the enthalpy $H$ is also only a function of temperature: $H = H(T)$. Therefore,

$$\Delta H = 0 \neq q$$

Hypothesis: disproved!