There are many conventions for specifying magnetic fields in terms of a multipole, polynomial, or Taylor expansion, which leads to potential confusion. In elegant (as in MAD), magnet strengths are specified in terms of Taylor series. For normal multipoles and y = 0, the expansion is
where B0 is the dipole, B1 is the quadrupole, etc. In general,
elegant follows MAD  in using a right-handed coordinate system (x,y,z) in which z is along the beam direction, x is to the left, and y is up.
This expansion for the normal multipole terms can be related to a multipole expansion that includes both normal and skew components. In this convention, positive normal multipole coefficients give positive By for x > 0 and y = 0. Rotating a positive normal multipole with N poles π∕N clockwise about the vector along the beam direction will convert it into a positive skew multipole. As a result, for a positive skew multipole, By will be non-negative and Bx will be negative for x > 0 along the line ϕ = π∕N.
We can satisfy these conventions if we write the scalar potential as
where, as we’ll see, Am are skew components and Bm are normal components for a 2(m + 1)-pole. The coordinates (x,y) are in a right-handed system with the longitudinal coordinate z. Δϕ is the rotation angle of the magnet, where a clockwise rotation about the nominal trajectory corresponds to Δϕ > 0. The minus sign in e-inΔϕ is because we rotate the magnet while keeping the coordinate system fixed.
The magnetic fields are
We can relate the coefficients to the Bm quantities used in MAD and elegant by noting that for Δϕ = 0
Note the minus sign in the last equation, which differs from commonly asserted conventions.
Multipole errors are typically specified as fractions of the main field harmonic at a reference radius R, e.g.,
where m is the main harmonic and n is the error harmonic.
For electrons, the deflection from a thin element is
where H = Bρ = -p∕e is the beam rigidity and p = mecβγ is the momentum. The geometric strengths Kn are defined as
By convention in elegant, a positive Kn value deflects a particle at x > 0 toward x = 0. E.g., a positive K1 value indicates a horizontally focusing quadrupole.