The pitch of a roof is indicated by a ratio of its horizontal dimension to its vertical dimension; it is usually expressed as a fraction that shows how many inches the roof will rise in 12 inches of horizontal distance. In a gable roof with a 5/12 pitch, for example, the roof rises 5 inches for every 12 inches that it covers horizontally.
When you're framing a roof with a given pitch, you'll first need to determine the length of the roof's common rafters -- the structural members that run from the top of the building's exterior walls to the roof's peak and define the roof's slope. You'll begin by determining the horizontal distance that the rafter will cover, a dimension referred to as the rafter's run; the run is measured from the centerline of the roof ridge, which will be in the middle of the building's total width, to the outside edge of the exterior wall's top plate. Next you'll determine the vertical distance that the rafter will cover; this dimension is called the rise. Calculate the rise by dividing the run by 12 and, in the case of a 5/12 pitch, multiplying the result by 5. The rise and the run are the legs of a right triangle whose hypotenuse is the diagonal distance between the ridge and the wall; you can use the Pythagorean theorem, a construction calculator or a framing square to determine this dimension.
Use a framing square with stair gauges set to a 5/12 pitch to make a plumb cut at the correct angle at the peak end of the rafter. Then measure down the rafter the distance you calculated using the rise and run and mark another plumb line where the rafter will meet the outside of the wall. Use the framing square to mark out the bird's mouth -- the notched cut that will seat the rafter on the top of the wall; the horizontal seat cut of the bird's mouth will measure the same as the width of the wall, beginning at the plumb line you've just drawn. Finally, measure the length of the rafter overhang outward from the plumb line and cut the rafter end with another plumb cut.
The dimension you used for the rafter's run was measured from the centerline of the ridge, so it doesn't take into account the actual thickness of the ridge board. To allow for the ridge board's width, you'll divide the thickness of the ridge board by two and then cut that measurement off the top end of the rafter with a plumb cut. The length of the rafter will now be equal to the distance from the edge of the ridge board, instead of the center of the ridge, to the top of the wall.