In Besse's "Einstein Manifolds," Chapter 6D, there are 2 formulas which I am interested in, which apply to compact Riemannian $4$-manifolds:
$\chi(M)=\frac{1}{8\pi^2}\displaystyle\int_M\|U\|^2-\|Z\|^2+\|W\|^2\ \mathrm{d}\mu_g$
$\tau(M)=\frac{1}{12\pi^2}\displaystyle\int_M\|W^+\|^2-\|W^-\|^2\ \mathrm{d}\mu_g$
(They are the ones in subsections 6.31 and 6.34.) Here, $\chi$ is the Euler characteristic, $\tau$ is the signature, $U, Z, W$ are the scalar, traceless, and Weyl parts of the curvature tensor, and $W^+, W^-$ come from the splitting due to the Hodge star operator. The only reference given in Besse is to a work in French that I can't seem to locate, and in any case I don't read French. Does anyone know a good alternate reference for these formulas and where they come from?
As noted in a comment above, the first formula comes from the Chern-Gauss-Bonnet formula:
$\chi(M)=(2\pi)^{-2}\displaystyle\int_M\,Pf(\Omega)$
for a $4$-dimensional manifold. $Pf$ is the Pfaffian, and $\Omega$ is the $\frak so$$(4)$-valued 2-form determined by the curvature. Computation of $Pf(\Omega)$ then yields the result. The factor of $8$ in the denominator may vary depending upon the placement of certain factors of $2$.
The second formula comes from the Hirzebruch Signature Theorem. For $4$-manifolds this yields:
$\tau(M)=\frac{1}{3}\langle p_1(M), [M]\rangle=\frac{1}{3}\displaystyle\int_M\, p_1(M)$. Computation of the first Pontryagin class, using $p_1(M)=-\frac{1}{2}trace(\Omega^2)$, will yield the result, with the same caveat about factors of $2$ as above.