Here are some rules for the angle of the beam within a group of notes.
For groups of 2 notes, the note which is furthest away from the centre line of the stave determines the stem direction.
For groups of 3 or more notes the stem direction is determined by the poisiton, form the centre of the stave, of the majority of the notes
If there is no majority the note furthest from the centre of the stave determines the direction
When stem direction patterns are set it is better to stick with it and not break it.
Whenever a slur is placed over notes the stems should go down regardless of the rules and vice versa
The beam usually follows the direction of the group of notes
When the group goes in different directions the first and last note determine the slant
The following table shows the amount of slant that a beam should have when in a group of two notes
* A space is the with between two stave lines
For rules about tuplets click here.