A further suggestion if you use Roger's method. If you have had the clutch off or apart, fit the gearbox initially while the unit is on the bench, this ensures the clutch plate and therefore the splines are centred and in line with the dog on the gearbox shaft. A tip for doing this is to operate the clutch lifting mechanism with a suitable lever (piece of wood!) and wedge it so that the clutch plate is free. This allows the gearbox to align itself more easily!!! once the gearbox is inserted and pushed completely home into the clutch bell housing, release the clutch so as to lock the plate in the central position. Remove the gearbox and put the engine into the frame as described by Roger. It is possible to swing the back of the engine upwards to help in aligning the gearbox. If you are doing this on your own a wooden support across the frame tubes holds the clutch housing firmly. I often put the front engine bolt in to act as the swivel point, it allows the engine to go forward but not to swing sideways damaging paint and Fingers!!
If the mag is fitted and engine timed it can be a help to slip the dynamo out, with the aluminium clamp removed there is more room.
Have fun, if you align the box first time your a better man than I! but persevere it will eventually fit
(Maybe the next morning it will go straight in!!)
Dave