Realization of stripes and slabs in two and three dimensions