  The slope of the locally measured spectrum of cosmic rays varies from 2.8 for
protons with energies below 200 GeV down to 2.5 for heavy nuclei with energies
in the TeV-PeV range. It is not clear if the locally measured slope values are
representative for those of the overall population of Galactic cosmic rays and
if the slope of the cosmic ray spectrum varies across the Galaxy. We use the
data of Fermi Space gamma-ray Telescope to derive a measurement of the slope of
the cosmic ray spectrum across the Galactic Disk and to compare it with that of
the Large Magellanic Cloud cosmic rays. A special choice of the background
estimation regions allows us to single out the neutral pion decay component of
the gamma-ray flux in the energy range above 10 GeV and to separate it from (a)
emission from the local interstellar medium around the Solar system and (b)
from the inverse Compton emission produced by cosmic ray electrons. Results.
The spectrum of the pion decay gamma-ray emission from the Galactic disk in the
energy band 10 GeV - 1 TeV has the slope 2.4. There is no evidence for the
variation of the slope with Galactic longitude / distance from the Galactic
Centre. The slope of the spectrum of cosmic rays derived from the gamma-ray
data, 2.45, is harder than the slope of the locally observed cosmic ray proton
spectrum. Pion decay emission from a powerlaw distribution of cosmic rays with
the same hard slope also provides a fit to the gamma-ray spectrum of the Large
Magellanic Cloud. Identical and hard slopes of the spectra of cosmic rays in
the Milky Way and in the Large Magellanic Cloud are consistent with a
straightforward theoretical model in which cosmic rays are injected by shock
acceleration with the spectrum with the slope 2...2.1 which is subsequently
modified by 1/3...1/2 by the energy-dependent escape of cosmic rays through the
turbulent Galactic magnetic field.
