I have following expression
$$-3 b_{\sigma _d}-3 b_{\sigma _v}-b-b_2+2 j-2 j_2-2 j_3+2 j_6+12$$
Mathematica input
12-b+2 j-Subscript[b, 2]-3 Subscript[b, Subscript[\[Sigma], d]]-3 Subscript[b, Subscript[\[Sigma], v]]-2 Subscript[j, 2]-2 Subscript[j, 3]+2 Subscript[j, 6]
I want to reorder this expression by partitioning the occuring symbols. Additionally, common factors of the partitions should be factored out:
Partition (given by user): $$\{\{j,j_2,j_3,j_6\},\{b,b_2,b_{\sigma_d},b_{\sigma _v}\}\}$$
The order should also be respected. The end result would look like $$2(j-j_2-j_3+j_6)-(b+b_2+3 b_{\sigma _d}+3 b_{\sigma _v})+12$$
I have considered FactorTerms[poly,{x_1,x_2,...] and Collect[expr,{x_1,x_2,...}] but was not successful to achieve this.

f[e_]would be to not print+ 0if there is not a constant number. If you know this quickly, I again would appreciate your help. I am still dissecting yourf. – Hotschke Aug 13 '19 at 13:41+/- 0. – kglr Aug 13 '19 at 13:55Switch[]but/. {_, 0} -> Nothinglooks now like a quite easy fix. – Hotschke Aug 13 '19 at 14:18