We show that the solution of the radiative transfer equation (RTE) thr
ough a line of sight that pierces several times two alternate atmosphe
res can be obtained in terms of the solutions of the RTE through both
single atmospheres separately considered. This also applies to the res
ponse functions of the observed Stokes spectrum to perturbations of th
e physical quantities. The analytic solution of the RTE in case that t
he single atmospheres are Milne-Eddington is presented. The simplifica
tion of the solution in the case of a longitudinal or transversal (wit
h constant azimuth) magnetic field is presented as well. Finally, as a
numerical example, we synthesize the Stokes I- and V-spectrum emergin
g from a thin magnetic flux tube, achieving a considerable decrease in
computation time with respect to conventional integrations and withou
t loss of accuracy.