Generalization of the H‐κ stacking method to anisotropic media