Journal page number or PDF page number: how Agent Bayes keeps both
Journal page number or PDF page number? A citation needs the published label, while a PDF reader needs the file position. Agent Bayes stores both and uses neighbouring pages to infer missing labels.

A citation needs the page label printed in the source, while a PDF reader needs that page's position in the file. Agent Bayes stores both, so reading a cited passage does not require treating those numbers as interchangeable.
Imagine an article whose first page is printed as 447. Add a publisher's cover sheet, and printed page 447 becomes the second page of the PDF. Citing page 2 identifies a position in that particular file. Citing page 447 identifies the page in the published article.
For the citation rule, see which page number to cite from a PDF. This post explains the engineering behind the number: how Agent Bayes reads printed labels, infers missing ones, and keeps the file position available when an agent opens the source.
A printed page label and a PDF position answer different questions. We keep separate values because a research tool needs to answer both.
A PDF can contain three different page identifiers
The visible number on a page is only one way a PDF can identify that page. Consider the illustrative article above:
| Identifier | Example | What it identifies |
|---|---|---|
| File position | 2 | The second page stored in this PDF |
| Printed label | 447 | The label visible on the article page |
| PDF metadata label | 447, if configured | A label a compatible viewer can display instead of the file position |
PDF metadata can make a viewer's page control agree with the printed document. W3C's page-numbering technique describes the /PageLabels entry for this purpose, including Roman numerals and appendix prefixes. A viewer's displayed number is therefore not always a file position.
Reading that metadata is a useful option when labels are present. PyMuPDF, for example, exposes Page.get_label(), which returns a label string or an empty string when no label is defined. That method reads a stored label, rather than recognising a number in a scanned page image. See the PyMuPDF documentation.
Agent Bayes reads the visible page during indexing. This gives the indexing process a way to obtain a printed label even when the PDF has no label metadata.
Read the visible label before inferring a missing one
To preserve what the source actually shows, Agent Bayes separates reading a label from inferring one. During optical character recognition, or OCR, a vision model transcribes the page and returns a separate page_label field.
The OCR prompt asks for the printed label exactly as shown. A label can be an ordinary number, a Roman numeral such as ii, or a prefixed value such as A-3. When no label appears, the model is instructed to return null rather than invent one.
The database stores this result as actual_page, alongside page_number, the file position counted from one. The label is text because converting every label to an integer would lose Roman numerals and appendix prefixes.
An extracted label stays unchanged during missing-label inference. The next stage only considers pages classified as citable whose label is still missing. Covers and blank pages can provide context without becoming targets for inference.
Missing-label inference fills gaps in the extracted labels. Labels that OCR has already supplied remain outside this step, including any extraction errors. Reading the label and filling a gap are separate operations.
Infer missing labels from neighbouring pages
A missing label can sometimes be recovered from its neighbours. In an illustrative sequence, file positions 2 and 4 carry printed labels 447 and 449. If the intervening page continues the article, 448 is a plausible label for file position 3.
But adding one to every label is not a sufficient rule. A document can switch from Roman numerals to ordinary numbers, restart numbering, or include unnumbered material. A useful inference needs context about the pages as well as their positions.
The reconcile_actual_pages activity collects up to five neighbouring pages on either side of each missing label. Each context entry includes the file position, any known label, whether the page is citable, its category, and a short text preview.
When two missing labels have overlapping windows, the activity includes each context page once. It sends the combined context in one inference request. If every citable page already has a label, the activity skips that request.
The prompt asks the model to respect numbering restarts and changes in numbering style. It also instructs the model to omit a label when the surrounding pages do not support a confident inference. The model decides which missing labels it can infer from that context.
For each accepted result, the activity checks that the returned position belongs to a requested missing page and that the label is nonempty. It then stores the label with actual_page_inferred set to true, distinguishing inference from direct extraction in the stored record.
An inferred page label remains an inference about the source. Keeping that distinction makes the stored result more informative than a number with no indication of how it was obtained.
Preserve the page span when a passage crosses a boundary
A citation may refer to a passage that continues onto another page. Agent Bayes retains the passage's starting and ending file positions, then derives a separate printed page range from the labels at those boundaries.
The range builder has explicit rules:
| Available boundary labels | Printed range stored for the passage |
|---|---|
| Both labels are known and differ | Start label through end label |
| Both labels are the same | A single label |
| Only one boundary has a label | That known label |
| Neither boundary has a label | n. p. |
The n. p. marker records that neither boundary label resolved. With only one known boundary, the stored label describes that boundary alone. The original file span remains available separately in both cases.
This separation matters beyond display. A printed range helps a researcher cite the passage, while the file span tells the software which pages contain it. Deriving a display label must not erase the positions needed to open the source.
Ask for a printed page or a PDF position explicitly
Resolving a label during indexing only helps if later reading tools preserve its meaning. Agent Bayes requires its page-reading tool to specify whether a request uses printed or pdf numbering.
When a document has printed labels, a printed-page request looks up those labels. A PDF-page request uses file positions. If the document has no stored printed labels at all, the resolver can use numeric file positions as a fallback.
That fallback is document-wide. If some printed labels exist but a requested label is missing, the resolver does not silently reinterpret the requested number as a PDF position. The agent can instead request a file position explicitly.
The request must say which numbering system the number belongs to. Without that distinction, asking for page 2 could mean either the second PDF page or a page printed with the label 2.
Agent Bayes also keeps both values when giving an agent context about the document open in the reader. The context can include pdf_page and printed_page separately. When an agent views a rendered page image, the caption names the PDF position and includes the printed label when available.
These fields let an agent connect what the researcher is viewing with what a citation says. They avoid making the model infer the meaning of an otherwise unexplained page number each time it reads a source.
Check a citation against its source page
A useful check starts with a paper whose printed numbering differs from its PDF positions. The question is concrete: does the citation show the publication's label, and does opening the source reach the passage bearing that label?
In Agent Bayes, open a library and use Upload PDFs, then Index. Indexing currently costs about 0.35 credits per page, according to the credits guide. The charge includes processing the paper, rather than a separate purchase for page labels.
Open a project attached to that library. In the mindmap chat, ask: “Find this paper's main finding and add it as a claim with a citation.” Open the claim's Indexed Citations tab and follow the source into the PDF reader. The research run also uses credits, with cost depending on the model and work performed.
New posts, straight to your inbox
No newsletter fluff, just an email when we publish something new.
Email me when a new post is published on the Agent Bayes blog. You can unsubscribe anytime. We'll first send a confirmation email, and we only use your details for this. See our Privacy Policy.