How artificial intelligence works when building an outline from a scanned textbook begins with a reading problem. A science chapter has a large heading called ‘Photosynthesis’, a smaller subheading called ‘Light and Chlorophyll’, then another subheading called ‘Factors Affecting the Rate’. A page-by-page OCR tool can read those words but return them as ordinary paragraphs. The student loses the hierarchy that made the chapter easy to navigate.
Did you know that identifying heading text is different from deciding heading depth? A detector may confidently mark ‘Factors Affecting the Rate’ as a section heading yet not know whether it belongs under Photosynthesis or another chapter. Font size, numbering, indentation, running headers, bookmarks and surrounding sections all supply clues. Tools such as Docling now document a separate heading-hierarchy stage because layout classification alone can produce a flat, misleading outline.
The useful sequence is scan pages → detect text and layout regions → identify headings separately from body text and page furniture → recover reading order → analyse numbering, typography and available PDF bookmarks → assign parent-child levels → preserve page references → validate the outline against original pages. AI helps reconstruct the document’s organisation, but it must not invent chapters or silently convert a bold vocabulary word into a new section.
Five questions to recover a chapter outline
- Which text blocks are genuine headings?
- What reading order connects the blocks?
- What numbering, bookmarks or typography show their levels?
- Which definitions, captions and exercises need separate roles?
- Can every node be checked on the original page?
1. Why a textbook outline matters
A textbook’s hierarchy tells readers how ideas are grouped. A chapter introduces a broad subject, a section explores one component, and a subsection develops a narrower part. Students use these relationships to preview reading, locate exam revision topics and understand why facts belong together.
When a PDF is flattened into plain OCR text, the content may survive while the structure disappears. An automated summary may then present one subsection as if it were a whole chapter or mix examples from unrelated topics.
A good outline preserves the author’s conceptual boundaries rather than simply listing every line printed in large type. It should help a reader navigate the real source, not create a novel curriculum based on model expectations.
2. What a heading actually is
A heading is a label that introduces a section or another structural region of a document. It usually differs visually or linguistically from surrounding prose through size, weight, spacing, numbering or placement.
Textbooks also contain large figure captions, decorative callouts, running page headers, highlighted definitions and titles within diagrams. Those objects can resemble headings without functioning as parents in the chapter hierarchy.
The first stage must therefore classify region roles rather than assume bold or large means section. A visual model can propose a heading region, while document context decides whether it belongs in the outline.
3. The difference between a title and a section header
The book title, chapter title and section heading represent different scopes. A large title on a cover page may identify the whole book, while a smaller heading on page 43 starts one topic within a chapter.
A model trained on scientific articles may know categories called Title and Section-header, but textbooks use designs with much greater variation. A chapter can begin with an illustration or a question rather than a standard numbered heading.
The correct output needs a stable hierarchy and a link to each source region. Labelling every large line as ‘Title’ without a scope definition loses the distinction the student needs.
4. OCR recovers letters, not structural roles
Optical character recognition estimates the characters visible in an image. It may read ‘Plant Nutrition’ perfectly, but its plain text output does not necessarily reveal whether the phrase is the page header, a chapter heading or a labelled picture.
A layout-analysis model predicts regions such as text, title, section heading, caption and table. These are complementary tasks: the OCR supplies the words and the layout stage supplies the tentative role.
Even correct text and role labels may not fully establish nesting depth. A heading can be visually recognised yet attached to the wrong chapter if the system never reconstructs section order.
5. DocLayNet provides a concrete layout example
DocLayNet is a large, manually annotated dataset for document-layout segmentation, described in a KDD 2022 paper. It contains 80,863 unique pages annotated with eleven classes including Title, Section-header, Text, List-item, Caption, Table and page headers and footers.
The distinction between section headers and running page headers is particularly relevant for textbook outlines. A book’s repeated chapter name at the top margin should not automatically become a new heading every time it appears.
The dataset contains diverse document types but is not equivalent to every photographed school textbook. Its published annotation sources are predominantly digital documents, and OCR quality and schoolbook styles may differ substantially from the tested conditions.
6. Detect candidate heading regions
A visual detector can find short text blocks with distinctive typography and spacing. It may use features such as font height, boldness, alignment, surrounding whitespace, numbering and proximity to other content.
Different books use different visual conventions: one publisher has coloured heading bars, another uses bold serif type, and a third marks subsections with blue labels in the margin. Models need diverse examples to generalise beyond one template.
The predicted heading box should include actual page coordinates and any confidence cues. A useful review interface shows the crop so an editor can reject a decorative callout without altering the printed source.
7. Reading order must come before parent-child structure
Suppose a page uses two columns. A heading at the top of the right column may follow the entire left column, not the bold phrase immediately above it in image coordinates. A purely geometric top-to-bottom parser can attach it to the wrong section.
Reading-order reconstruction establishes the logical sequence of blocks on the page and across pages. Only then can the system decide which heading opens a section and when that section ends.
This task is related to, but different from, full outline recovery. A correct reading order lists blocks in sequence; a heading tree additionally says which blocks belong inside which section.
8. A fictional Biology chapter outline
Imagine a science chapter called Photosynthesis. It contains two sections, Light and Chlorophyll and Factors Affecting the Rate. The second section contains smaller headings for Light Intensity, Temperature and Carbon Dioxide.
A correct outline places the three smaller headings beneath Factors Affecting the Rate. It does not flatten them into six unrelated chapter headings, nor does it place Carbon Dioxide under an adjacent figure caption.
Now imagine a small sidebar labelled Did You Know? beside Light Intensity. The sidebar should remain a sidebar or callout unless the source explicitly uses it as a heading. This chapter and layout are invented teaching examples.
9. Numbering can supply strong hierarchy clues
An author may use headings such as 1, 1.1 and 1.1.1. The numbering directly suggests levels: section 1.1 is inside section 1, and 1.1.1 is nested further. This makes the hierarchy easier to reconstruct even when font differences are subtle.
But not all numbered text is a heading. A list of steps, a numbered exercise and a chapter’s example sequence may use similar symbols. The parser must distinguish structural section numbering from ordinary list items.
Numbering systems also vary by publication. A chapter can use Roman numerals, letters and parenthesised numbers in different combinations. A rule should be tested against the source’s actual convention rather than applied universally.
10. What Docling’s heading-level stage does
Docling’s current documentation describes a heading-hierarchy stage that can assign levels after reading order. Its published explanation uses a combination of PDF bookmarks, numbering conventions and visual style to recover heading depth.
This is notable because the layout model may recognise section headers without knowing their nesting. The hierarchy stage turns a flat sequence of headers into a meaningful tree, while recognising that wrong depth can be worse than leaving some items unclassified.
The documentation also states that the feature is disabled by default in its described configuration. That is a practical reminder that inferred hierarchy should be evaluated before being enabled in an existing document-processing workflow.
11. Why PDF bookmarks are valuable
A born-digital PDF may include a navigation outline or bookmarks created by the publisher. When those bookmarks reliably match the actual document, they provide declared section relationships that an AI might otherwise need to infer.
Docling’s heading-hierarchy documentation treats confidently matched bookmarks as an authoritative signal before numbering and style heuristics. That can help distinguish a heading from a visually similar list entry.
Scanned image PDFs may lack bookmarks entirely, or a reused outline may be incomplete or out of date. A robust system should check whether a bookmark’s title and page correspond to the actual source instead of trusting the metadata blindly.
12. Typography is a clue, not a universal rule
A chapter heading is often larger and bolder than a subheading, but book designers can use identical sizes with colour or spacing to show level. Some textbooks have large colourful vocabulary cards that are not headings at all.
Font measurements are especially difficult on scans because the system sees pixels instead of actual font attributes. Camera distance, skew, compression and page curvature can change apparent text size.
The classifier can compare typography within the same document, but should also use context and repeated section patterns. A ten-pixel height difference alone does not prove a parent-child relationship.
13. Page headers and footers can mimic sections
A book may repeat the chapter name at the top of every page. A naive parser might create a new Photosynthesis heading thirty times, making the extracted outline unusable.
Page-furniture detection can recognise repeated placement and wording across neighbouring pages. GROBID’s documented segmentation stage distinguishes page header and footer regions from the body in its supported article-processing workflow.
That classification is transferable as an idea, not a claim that a scientific-article parser perfectly reads every textbook. The source layout and publishing convention remain important.
14. Headings can continue across a page break
A long chapter may span many pages without repeating its main title. The system needs to keep the current section active as subsequent pages are processed, rather than resetting the hierarchy at every physical page boundary.
New headings can begin near the bottom of a page, with their paragraphs continuing on the next. A page-by-page parser that attaches only text on the same page may create an empty section and lose the following explanation.
Document-wide context is therefore essential. The outline should represent logical reading structure across pages, with page references used for navigation rather than treated as automatic section endings.
| Region | Typical appearance | Outline treatment |
|---|---|---|
| Book or chapter title | Large prominent text | Top-level scope |
| Section heading | Bold, numbered or spacious | Section node |
| Subsection heading | Smaller or deeper number | Child node |
| Running page header | Repeated text near margin | Page metadata, not new section |
| Figure caption | Text beside image | Attach to figure |
| Exercise label | Numbered activity block | Exercise or child content type |
| Highlighted definition | Coloured callout | Annotation or glossary entry |
15. Examples and exercises deserve separate roles
School textbooks contain numbered exercises, worked examples, review questions and answer sections. A line reading Exercise 3 may look like a heading but may be part of a question block rather than a subsection of the science explanation.
A practical hierarchy can represent exercises as their own content type and associate them with the parent topic. That supports searching without incorrectly merging every numbered problem into the main chapter outline.
The exact design depends on the use case. Students may want exercises navigable, while a formal chapter outline may show only conceptual headings. The software should offer a declared policy rather than silently guessing.
16. What to do with sidebars and highlighted definitions
A highlighted definition box can be important for revision, but not necessarily a section boundary. It may relate to one paragraph or sit beside a longer explanation without interrupting reading order.
A model can retain such blocks as callouts with source coordinates. Turning them into top-level headings could produce a misleading chapter structure and break the intended conceptual grouping.
An accessible digital edition can offer both a navigation outline and a list of definitions. Preserving the difference makes the material easier to study rather than forcing every important text fragment into the heading tree.
17. Ambiguous heading levels are a real problem
Suppose two headings use the same typography and have no numbering. One might be a subsection; the other could start a parallel chapter section. Without other cues, their hierarchy may be uncertain.
A model can examine surrounding blocks, table-of-contents entries or repeated page patterns. But a plausible tree is still an inference if the source does not distinguish the levels unambiguously.
An honest output can mark a heading level uncertain or retain a flatter structure pending review. That is preferable to building a confident but wrong tree that distorts the textbook’s argument.
18. A heading outline must preserve exact source words
An AI may be tempted to rewrite a long heading into a shorter phrase. That could improve a search interface but it should be a separately labelled summary, not the extracted source heading.
For example, a textbook heading Factors Affecting the Rate of Photosynthesis might be shortened to Photosynthesis Rate in a study guide. Those phrases are related but not identical source text.
A faithful outline stores the original heading, then optionally adds keywords or a paraphrase. This maintains traceability to the printed edition and protects quoted content from undocumented changes.
19. Accessibility benefits from correct hierarchy
Screen-reader navigation and digital table-of-contents tools work better when headings have meaningful levels. A flat list of every bold line does not communicate which ideas are subordinate to others.
Exporting to Markdown or structured HTML may use heading levels to reflect the recovered tree. Incorrect nesting can make navigation confusing and detach supporting explanations from their main topics.
Therefore evaluate the hierarchy on actual readers’ tasks: can someone jump to Factors Affecting the Rate and find all its subsections without missing related paragraphs or entering an unrelated exercise?
20. How to evaluate heading extraction fairly
A research dataset can include annotated heading regions and true parent-child relationships. Evaluate layout detection, exact heading transcription, level assignment and source-page linking separately.
A system might find every heading correctly yet assign all of them level one. Another could recover levels but mistake figure captions for sections. One overall OCR accuracy score would conceal these structural failures.
Test on scanned textbooks with images, varied fonts, sidebars and page curvature. A model trained on born-digital reports may perform differently on photographs of schoolbooks; benchmark conditions need to be stated honestly.
21. A step-by-step classroom outline exercise
Write a page with a large heading Plants, two medium headings Roots and Leaves, and two smaller headings under Leaves: Photosynthesis and Transpiration. Add a brightly coloured Did You Know? box near the margin.
Ask a classmate to draw the parent-child tree and explain why the box is not necessarily a section heading. Then remove heading numbers and make the two medium headings the same size as the smaller headings. Which relationships are now uncertain?
This exercise shows that font size, numbering, reading order and context each contribute evidence. No private textbook scans are required; an original practice page is sufficient.
| Error | Effect on learners | Safeguard |
|---|---|---|
| All headings assigned level one | Chapter structure flattened | Use numbering and bookmarks |
| Page header treated as section | Hundreds of duplicates | Check repeated margins |
| Exercise number treated as chapter | Wrong navigation | Classify activity role |
| Two-column order incorrect | Subheading attached wrongly | Recover reading order |
| Bold definition becomes heading | False hierarchy | Preserve callout role |
| Uncertain level forced | Misleading tree | Flag for review |
22. Why headings and footnotes should not be conflated
A footnote may contain bold text or a numbered reference but belongs to a specific passage rather than opening a new main section. A figure caption similarly describes a figure instead of reorganising the whole chapter.
Document analysis should preserve these links independently. A model that groups footnotes and captions as heading children can misrepresent what evidence supports a claim.
Keeping a structured document graph makes it possible to have multiple relationships: section containment, figure-caption association and footnote reference links. The main outline uses the section relationships only.
23. A good proof pack for every heading
Each extracted heading can retain its exact text, page identifier, image coordinates, predicted type, proposed depth and evidence such as numbering or a matched bookmark. Editors can inspect why a heading was placed beneath a particular parent.
If the level is changed manually, record that correction while keeping the original source image. A corrected hierarchy can then be used for digital navigation without erasing the earlier model prediction.
Such a proof pack turns a fluent AI table of contents into an auditable artifact. It supports revision when a scanned edition, publisher style or interpretation changes.
24. Common misconceptions
First, OCR reading a heading is not the same as recognising it as a heading. Second, recognising a heading is not the same as assigning its level. Third, every bold or colourful line is not necessarily a structural section.
Fourth, page headers can repeat without creating new sections. Fifth, numbering can refer to exercises as well as chapter headings. Sixth, the absence of PDF bookmarks does not justify inventing a perfect hierarchy.
The useful question is which source cues support each heading’s role and relationship to surrounding sections. A trustworthy outline makes those cues inspectable.
25. The larger lesson: documents contain meaning in their structure
Textbook-outline reconstruction illustrates the difference between extracting words and recovering how a document teaches. Headings, subsections and exercises form relationships that help a learner understand the progression of ideas.
Computer vision detects regions, OCR reads text, and hierarchy reasoning links the blocks. Structured PDF bookmarks and numbering may strengthen the result when available. Each step should preserve source evidence and allow uncertain choices.
The durable principle is to make a book easier to navigate without rewriting its intellectual organisation. AI is helpful when it recovers structure faithfully, not when it supplies an attractive but invented table of contents.
Frequently asked questions
How does AI find textbook headings?
It detects layout regions, reads the heading text and evaluates typography, numbering and context.
Can OCR alone build a reliable outline?
No. Reading words does not identify their structural roles or parent-child relationships.
What is DocLayNet?
A manually annotated dataset for document-layout segmentation, including section-header and title classes.
Does DocLayNet provide heading depth automatically?
Its layout categories identify section headers, but hierarchy requires additional inference or source structure.
How does Docling infer heading levels?
Its documented stage uses signals such as PDF bookmarks, numbering and visual style after reading order.
Why are PDF bookmarks helpful?
They can record an author-declared navigation hierarchy when present and correctly matched.
Are page headers part of the chapter outline?
Usually not. Repeated running headers are normally page furniture.
Can exercises have headings?
They can, but their role should be represented according to the textbook’s layout and the reader’s needs.
What if two headings have identical formatting?
Context, numbering or metadata may help; otherwise the nesting can remain uncertain.
What should a good extracted outline retain?
Exact source heading text, hierarchy, page coordinates and reviewable evidence.
Primary documentation and connected learning
- DocLayNet: KDD 2022 Document Layout Dataset
- DocLayNet: Dataset and Eleven Layout Classes
- Docling: Heading Levels and Document Hierarchy
- GROBID: Segmentation Annotation and Page Furniture
- How AI Finds the Correct Reading Order on a Scanned Page
- How AI Keeps Footnotes Separate From the Main Text in Scanned PDFs
- How AI Joins Tables Continued Across PDF Pages
- eduKateSG | How X Works Hub
Editorial note: The Biology textbook, headings and outline described here are invented teaching examples, not an analysis of a named publication. Document-layout research does not guarantee reliable hierarchy on every photographed book. Extracted levels must be checked against source pages and declared source structure before use in consequential educational content.