macro based layout generation