  We study the origin of the resonant x-ray signal in manganites and generalize
the resonant cross-section to the band structure framework. With {\it ab
initio} LSDA and LSDA+U calculations we determine the resonant x-ray spectrum
of LaMnO$_3$. The calculated spectrum and azimuthal angle dependence at the Mn
$K$-edge reproduce the measured data without adjustable parameters. The
intensity of this signal is directly related to the orthorhombicity of the
lattice. We also predict a resonant x-ray signal at the La $L$-edge, caused by
the tilting of the MnO$_6$ octahedra. This shows that the resonant x-ray signal
in the hard x-ray regime can be understood in terms of the band structure of a
material and is sensitive to the fine details of crystal structure.
