Per-tone pulse shaping has been proposed as an alternative to time domain spectral shaping for Discrete MultiTone (DMT) transmitters, e.g. VDSL modems. This enables the transmitter to use more tones without violating the Power Spectral Density (PSD) mask constraint for data transmission. The computational complexity of the per-tone pulse shaping and transmit power is evenly distributed over tones, however, resources (computational complexity and power) can be better exploited by using different filter lengths for different tones and by resorting to power loading. For a fixed pulse shaping filter length, the contribution of a particular tone to the stop band energy depends on the power allocated to the tone and on the distance of the tone from the band edges. The use of high order pulse shaping filters for the tones at the band edges (as well as the use of lower power) will reduce their contribution to the out of band PSD, whereas for the tones at the middle of the band these factors will have less effect on the out of band PSD. Therefore, the combination of both power loading and a variable length pulse shaping filter can be used to achieve a high data rate under resource and PSD constraints. In this paper we present an algorithm to optimally allocate the resources i.e. power and filter taps, using a dual problem formulation. This solves the problem of optimally distributing power and filter taps over tones for a given PSD mask constraint, with a relatively low complexity.