Free energy of an ideal gas
Let $H^0$ be the heat of formation of the gas at $298~\mathrm{K}$ and $1\ \mathrm{atm}$. and let $G^0$ be the free energy of formation of the gas at these same conditions.  The enthalpy of the gas at temperature $T$ (any pressure) is then:
$$H(T)=H^0+C_p(T-298)$$  First let's get the free energy at temperature T and 1 atm.  At constant pressure, the change in free energy with respect to temperature can be calculated from:
$$\frac{d(G/T)}{dT}=-\frac{H}{T^2}$$
If we integrate this equation by parts, we obtain:

$$\frac{G(T,1~\mathrm{atm})}{T}-\frac{G^0}{298}=\frac{H(T)}{T}-\frac{H^0}{298}-\int_{298}^T{\frac{C_p}{T}dT}$$
Some algebraic manipulation of this equation yields:
$$G(T,1~\mathrm{atm})=G^0+\frac{(G^0-H^0)}{298}(T-298)+C_p(T-298)-TC_p\ln(T/298)$$
If we define $S^0=\frac{(H^0-G_0)}{298}$, this equation becomes:
$$G(T,1~\mathrm{atm})=G^0-S^0(T-298)+C_p(T-298)-TC_p\ln(T/298)$$
Adding the free energy change between $1~\mathrm{atm}$ and pressure $P$ at temperature $T$ yields:
$$G(T,P)=G^0-S^0(T-298)+C_p(T-298)-T[C_p\ln(T/298)-R\ln(P/P_0)]\tag{1}$$
where $P_0=1~\mathrm{atm}.$  The term in brackets in this equation is the same as $S(T,P)-S^0$.  If we substitute this into the previous equation, we obtain:
$$G(T,P)=G^0-S^0(T-298)+C_p(T-298)-T[S(T,P)-S^0]$$
If we combine terms in this relationship, we obtain:
$$G(T,P)-G^0=C_p(T-298)-(TS(T,P)-298S^0)$$
The term $C_p(T-298)$ is $\Delta H$, and the term $(TS(T,P)-298S^0)$ is $\Delta (TS)$.  So, as expected, the equation is the same as $$G(T,P)-G^0=\Delta H-\Delta (TS)$$
where 
$$S=S^0+C_p\ln(T/298)-R\ln(P/P_0)]\tag{2}$$
Either Eqn. 1 or Eqn. 2 can be applied, depending on preference.