BlogBooks & scholarship9 min read
Keep the printed page numbers in a converted Arabic book
Word's pages will never match the printed edition, so keep the print's page numbers as text markers such as [ج١ ص٤٢] at the point where each printed page begins. Agree one format, delete the running heads and printed numbers, insert markers against the scan, then run a sequence check for gaps, duplicates and mixed digits.
Researchers cite a classical text by its printed edition: volume and page of a named muhaqqaq edition, such as ج٢ ص١٤٥. Once a scanned book becomes an editable Word file, that reference has nothing to point to. Word lays out its own pages from the font, margins and page size, so Word's page 145 is generally not the print's page 145, and it moves again the moment someone changes the font.
The fix is old and simple: keep the printed page numbers as text inside the body, at the
place where each printed page begins. Digital editions have done this for decades. The TEI
Guidelines encode it as a <pb> (page beginning) element whose n attribute holds "the number
or other value associated with this page", placed "at the start of the page which it
identifies". EPUB 3.3 has a page list that maps reading positions to "static page boundaries",
including print. A Word file needs the same information as plain text that survives copying,
translation and reflow.
This guide goes deeper than the one line about page markers in the QA checklist before delivery and the footnotes guide. It is for an editor, translator or publisher who has a converted Arabic book and has to deliver a file people can cite from.
What goes wrong without markers
- Citations can't be checked. A reviewer reads "ج١ ص٤٢" in a footnote of the new edition and has no way to find that passage in your file except by searching for words.
- Comparison with the scan is slow. Proofreading a converted book means looking at the scan of one page next to the text of the same page. Without markers, every comparison starts with finding where the page begins.
- Translations drift from the source. A translator who keeps markers lets readers of the translation cite the Arabic edition. Without them, the translation can only cite itself.
- The printed numbers end up in the wrong place. OCR usually keeps the running head and the page number as paragraphs in the body. Left alone, they split sentences, get translated and get indexed as text.
Step 1: agree one marker format
Choose the format before inserting a single marker, and write it into the delivery brief. One workable convention:
| Situation | Marker | Notes |
|---|---|---|
| Single-volume book | [ص ٤٢] | Page only |
| Multi-volume work | [ج٢ ص٤٢] | Volume and page; no space after ج or ص keeps it on one line |
| English-language edition | [2:42] or [p. 42] | If the recipient works in Latin script |
| Unnumbered printed page (plate, blank, title page) | [ص —] or skip | Decide and record which |
| Front matter numbered with letters (أ، ب، ج) | [ص أ] | Keep the print's own sequence |
What matters is that the format is unique and searchable: square brackets, a fixed letter
and digits, with nothing else in the book that looks the same. Check that the edition doesn't
already use square brackets for something else, such as editorial insertions. Many muhaqqaq
editions do. If it does, pick another delimiter, for example {ص ٤٢} or ⟦ص ٤٢⟧, and use it
everywhere.
Also choose the digits. Arabic-Indic digits (٠–٩, U+0660–U+0669) and Extended Arabic-Indic digits (۰–۹, U+06F0–U+06F9, used for Persian and Urdu) look alike in some fonts but are different characters in the Unicode Arabic block. A search for ص٤٥ will not find ص۴۵. Pick one set, or Western digits, and stick to it.
Step 2: clear the page furniture first
Before adding markers, remove what the print put on every page:
- Search for the running title (the book's or chapter's name repeated at the top of each page) and delete each occurrence that sits in the body. In Word, Find and Replace (Ctrl+H) can replace it with nothing once you are sure the title doesn't also occur in the text itself.
- Find paragraphs that hold only a number. They are almost always the printed page number. Keep a note of the value: it tells you which marker belongs there.
- Rejoin sentences that the page break split. Remove the paragraph mark between the last line of one page and the first line of the next, but only after the marker is in (Step 3), so you don't lose the position.
Step 3: insert each marker at the start of its page
Work against the scan, one printed page at a time. Put the marker at the first word of the printed page, following the TEI rule that a page-beginning mark sits at the start of the page it names:
- If the page starts with a new paragraph, the marker goes at the start of that paragraph:
[ج١ ص٤٢] باب .... - If the page starts mid-sentence, the marker goes inside the sentence, between the last word
of the previous page and the first word of this one:
وهو أصل عظيم [ج١ ص٤٢] من أصول الدين. - If a word is split across the page break (rare in Arabic print, but it happens with long compounds and in some older printings), put the marker after the whole word and note the choice in the brief.
- Footnotes belong to the page where they are printed. If you have turned the notes into real Word footnotes, the body marker already identifies their page; no marker is needed inside the note itself.
When a passage has to be quoted across editions, record which edition the numbers belong to.
TEI's ed and edRef attributes exist for exactly this case, where page 145 of one edition
starts somewhere else in another. In Word, say it once at the top of the file: "Page markers
follow the edition of [publisher, year]."
Step 4: run a sequence check
Markers inserted by hand go wrong in predictable ways: a page skipped, a page entered twice, a typo that sends the numbers backwards, a digit typed from a Persian keyboard layout. Reading 400 pages for that is slow. A short script is not.
The script below reads a .docx directly (no extra packages; Python 3) and reports:
- paragraphs that hold only a number, which are probably printed page numbers left in the body
- markers that skip pages, repeat a page or go backwards
- a new volume that doesn't start at page 1
- markers that mix Arabic-Indic, Extended Arabic-Indic and Western digits
import re, sys, zipfile, unicodedata
W = '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}'
DIGITS = '0-9٠-٩۰-۹'
MARKER = re.compile(r'\[(?:ج\s*([' + DIGITS + r']+)\s*)?ص\s*([' + DIGITS + r']+)\]')
BARE_NUMBER = re.compile(r'^[\s\-–—()]*[' + DIGITS + r']+[\s\-–—()]*$')
def paragraphs(path):
import xml.etree.ElementTree as ET
with zipfile.ZipFile(path) as z:
root = ET.fromstring(z.read('word/document.xml'))
for p in root.iter(W + 'p'):
yield ''.join(t.text or '' for t in p.iter(W + 't'))
def value(s):
return int(''.join(str(unicodedata.digit(c)) for c in s))
def digit_set(s):
c = s[0]
if '٠' <= c <= '٩': return 'Arabic-Indic'
if '۰' <= c <= '۹': return 'Extended Arabic-Indic'
return 'ASCII'
def check(path):
problems, prev, seen, sets = [], None, set(), {}
count = 0
for i, text in enumerate(paragraphs(path), 1):
if BARE_NUMBER.match(text):
problems.append(f'para {i}: paragraph is only a number "{text.strip()}" (printed page number left in body?)')
for m in MARKER.finditer(text):
count += 1
vol = value(m.group(1)) if m.group(1) else None
page = value(m.group(2))
for g in (m.group(1), m.group(2)):
if g:
paras = sets.setdefault(digit_set(g), [])
if i not in paras: paras.append(i)
key = (vol, page)
if key in seen:
problems.append(f'para {i}: {m.group(0)} duplicate')
seen.add(key)
if prev:
pv, pp = prev
if vol != pv:
if page != 1:
problems.append(f'para {i}: {m.group(0)} new volume does not start at page 1 (check front matter)')
elif page < pp:
problems.append(f'para {i}: {m.group(0)} goes backwards after page {pp}')
elif page > pp + 1:
problems.append(f'para {i}: {m.group(0)} skips {page - pp - 1} page(s) after page {pp}')
prev = key
if len(sets) > 1:
detail = ', '.join(f'{k} in paras {v[:3]}' for k, v in sets.items())
problems.append(f'mixed digit sets in markers: {detail}')
print(f'{count} page markers checked')
for p in problems: print(' -', p)
print(f'{len(problems)} finding(s)')
if __name__ == '__main__':
check(sys.argv[1])
Save it as check_page_markers.py and run python3 check_page_markers.py book.docx. It
only reads the main body of the document (word/document.xml), not footnotes, endnotes, headers
or footers, and it ignores text deleted with tracked changes. Accept or reject tracked changes
first. If your marker format differs from [ج١ ص٤٢], change the MARKER pattern to match.
We ran it in this session (Python 3.11) on two small test files built for the purpose. The first had eight paragraphs with deliberate mistakes: a bare page number left in the body, page 43 skipped, page 44 entered twice, page 45 typed with Persian digits, a marker that went back to 43, and volume 2 starting at page 5. It printed:
7 page markers checked
- para 3: paragraph is only a number "٤٢" (printed page number left in body?)
- para 4: [ج١ ص٤٤] skips 1 page(s) after page 42
- para 5: [ج١ ص٤٤] duplicate
- para 7: [ج١ ص٤٣] goes backwards after page 45
- para 8: [ج٢ ص٥] new volume does not start at page 1 (check front matter)
- mixed digit sets in markers: Arabic-Indic in paras [1, 2, 4], Extended Arabic-Indic in paras [6]
6 finding(s)
The corrected file (pages 41–43 of volume 1, then page 1 of volume 2) printed
4 page markers checked and 0 finding(s). Those are synthetic files, not a real book, and no
ScribeTools output was part of the test.
Not every finding is an error. Many printed volumes leave their first pages unnumbered and start the visible numbering at 5 or 7, and some editions skip numbers where plates were bound in. Check each finding against the scan, and record the real exceptions in the brief so the next person doesn't "fix" them.
Step 5 (optional): add bookmarks for navigation
Text markers are what readers cite. If the people working in the file also need to jump to a
page quickly, add Word bookmarks at selected markers, for example at the start of each chapter
or every tenth page. Microsoft's steps: select the location, choose Insert > Bookmark, type
a name and select Add. Bookmark names must begin with a letter, can contain letters and
numbers, and can't contain spaces, so use names such as v1_p042. To jump, press Ctrl+G,
choose Bookmark under "Go to what", and pick the name.
Bookmarks don't replace the text markers. They don't show in the text by default, they may not survive conversion to other formats, and a reader of a PDF or printout can't see them.
Illustrative example
This example is invented to show the decisions involved, not taken from a real project.
A translator receives a converted Word file of a two-volume Arabic commentary and must deliver
an English translation that readers can cite against the Arabic edition. Before translating,
they agree the format [ج١ ص٤٢] with the publisher, remove the running head (the title of the
work at the top of every page) and the printed page numbers, and insert markers against the
scan. The sequence check finds three skipped pages; two are the translator's slips, one is a
plate the print left unnumbered, which goes into the brief. In the translation the markers
become [1:42], one for each Arabic marker, so a reader can go from any English paragraph to
the printed Arabic page.
Checklist before delivery
- Marker format agreed and written into the brief, including the edition it refers to
- Delimiter not used for anything else in the book (editorial insertions, verse numbers)
- One digit set used in every marker
- Running heads and bare page-number paragraphs removed from the body
- Every printed page has a marker at its first word, including mid-sentence page starts
- Sentences split by page breaks rejoined after the markers went in
- Sequence check run on the final file; every finding fixed or recorded as a real exception
- Unnumbered pages, plates and letter-numbered front matter handled as the brief says
- A sample of pages checked against the scan: the marker sits before the right word
- Markers survive the recipient's next step (CAT tool import, EPUB build, typesetting)
Checking the result
The script proves the numbers run in order. It cannot prove that each marker sits in the right place, because a marker one paragraph too early still makes a clean sequence. Check placement by sampling: pick pages from the start, middle and end of each volume, plus any page the script flagged, and compare the words around the marker with the top of the printed page.
Then count. The number of markers in a volume should equal the number of printed pages you
decided to mark. Word's Find (Ctrl+F) shows a result count in the Navigation pane when you
search for the opening of your marker, for example [ج١ ص.
If the file goes on to a translator, check one marker after the CAT tool import. Square brackets with Arabic letters are ordinary text there, so they will be offered for translation; tell the translator whether to keep them as they are or convert them, as in the example above. See the guide on preparing OCR Word files for CAT tools for the rest of that preparation.
Limitations
- Inserting markers is manual work, about one decision per printed page. Nothing here speeds up reading each page against the scan.
- The script checks sequence and digits, not position. It ignores footnotes, endnotes, headers
and footers, and text inside text boxes may be read twice. A marker format other than
[ج… ص…]needs a change to the pattern. - Markers are text, so they are also translated, spell-checked and searched as text. A search for a phrase that crosses a page boundary won't find it while the marker sits in the middle. Keep a marker-free copy if full-text search across pages matters more than citation.
- If the recipient wants page boundaries as structure rather than text, for example a TEI file or an EPUB page list, the text markers are a good starting point for conversion but not the final form.
ScribeTools converts scanned Arabic and Urdu books into editable Word files. See how it handles digitizing Arabic books and Arabic PDF to Word. Review the output, including where each printed page begins, before you rely on it.