The ideal gas law in 2D would be:
PA = nRT
Where A is the area. The work done in compressing or expanding the gas is:
dW = -P dA
= -(nRT/A)*dA
Assuming an isothermal reaction, nRT = constant:
A2
W = -nRT ∫ dA/A where A1 is the starting area and A2 in the ending area
A1
W = -nRT (lnA2 - lnA1)
W = -nRT ln(A2/A1)