Description
Given a list L of n integers, the weight order on a polynomial ring in n variables is defined by: x^A > x^B if A_1 L_1 + ... + A_n L_n > B_1 L_1 + ... + B_n L_n.
The leading component of a polynomial under a weight order need not be a monomial. When two monomials have the same weight, by default they are further distinguished with the GRevLex order.
i1 : R = QQ[a..d,MonomialOrder=>{Weights => {1,2,3,4}},Global=>false];

i2 : f = a^2 + b+ c^2 + b*d
2 2
o2 = c + b*d + b + a
o2 : R

i3 : leadTerm f
2
o3 = c
o3 : R

However, we can retrieve the entire leading component with the command
leadTerm(1,f). The plain
leadTerm f is in this case the same as
leadTerm(2,f): they both use the full specification of the monomial ordering, first by weight and then by the
GRevLex order. In contrast,
leadTerm(1,f)only distinguishes monomials by the first, i.e., weight, specification.
i4 : leadTerm(1,ideal(f))
o4 =  c2+bd 
1 1
o4 : Matrix R < R

The weight order may be combined with further ordering elements to break ties. In the following example, we use a second weight vector to break ties under first weight vector.
i5 : R = QQ[a..d,MonomialOrder=>{Weights => {1,2,3,4}, Weights => {2,4,2,1}}];

i6 : f = a^6 + b^3+ c^2
6 3 2
o6 = a + b + c
o6 : R

i7 : leadTerm(f)
6
o7 = a
o7 : R

i8 : leadTerm(1, ideal(f))
o8 =  a6+b3+c2 
1 1
o8 : Matrix R < R

i9 : leadTerm(2, ideal(f))
o9 =  a6+b3 
1 1
o9 : Matrix R < R

i10 : leadTerm(3, ideal(f))
o10 =  a6 
1 1
o10 : Matrix R < R

leadTerm(3, ideal(f)) uses both the specified weights and the
GRevLex order to calculate the leading component.
When the number of weights is smaller than the number of variables, the remaining variables are given weight 0. In the following example,
c and
d have weight 0.
i11 : R = QQ[a..d,MonomialOrder=>{Weights => {1,2}, Lex}];

i12 : f = a^2 + b+ c^2 + b*d
2 2
o12 = a + b*d + b + c
o12 : R
