17. A machine readable medium storing a program which when executed by at least one processing unit analyzes a document that comprises a plurality of glyphs, each glyph having location coordinates, the program comprising sets of instructions for: identifying sets of glyphs to associate as words; defining a potential alignment guide for a set of words in different text lines based on the location coordinates of the glyphs at the edges of the words; identifying a plurality of alignment elements within the potential alignment guide by removing particular locations from the potential alignment guide based on an analysis of the group of vertically aligned words within each set of text lines, wherein each particular location of the potential alignment guide corresponds to a particular text line, each identified alignment element indicating a particular alignment for a set of text lines that contain a group of vertically aligned words; using the identified alignment elements to specify additional structural elements within the document; and defining a structured document based on the glyphs, the aligned groups of text lines, and the structural elements.
24. The machine readable medium of claim 17 , wherein the set of instructions for identifying alignment elements within the potential alignment guide based on the analysis of the words in the text lines comprises a set of instructions for determining quantities of consecutive text lines with words that begin in the potential alignment guide.