I want to turn it into
How can I achieve this in general? That is I am looking for more or less universal and scalable solution.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.Sign up to join this community