# Fix broken words and line breaks in text copied from a PDF

Rejoins words split by hyphens and line breaks while keeping real hyphenated words and the original formatting intact.

- Topic: Writing & Editing
- Framework: Few-Shot
- Level: Standard
- Tags: Fill-in Template
- Source: https://www.thinkwithprompt.com/prompts/fix-broken-words-and-line-breaks-in-text-copied-from-a-pdf

## Prompt

```text
Clean up text I copied from a PDF or scan so it reads normally.

**Text:** [PASTE TEXT]
**Format to keep:** [plain text / Markdown / keep the existing headings and lists]
**Language:** [e.g. English]

Fix only these problems:
1. Words split across lines with a hyphen (e.g. "infor- mation" or "infor-\nmation") - rejoin them into one word.
2. Real compound words and hyphenated terms (e.g. "well-known", "COVID-19", "long-term") - keep the hyphen. If you cannot tell whether a hyphen is real, keep it and list the word at the end.
3. Hard line breaks in the middle of sentences - join them into normal paragraphs, but keep real paragraph breaks, headings, list items, and table rows.
4. Stray page numbers, running headers, or footers repeated in the text - remove them and list what you removed.
5. Obvious extraction artifacts like doubled spaces or ligature errors (e.g. "ﬁ" shown as a broken character).

Rules: do not reword, correct grammar, change spelling, or summarize anything. The output must contain the same words in the same order.

Return:
1. The cleaned text.
2. A short list of uncertain hyphens and anything removed, so I can check them.
```

## What to fill in

- PASTE TEXT
- plain text / Markdown / keep the existing headings and lists
- e.g. English

Free to copy and use. From ThinkWithPrompt (https://www.thinkwithprompt.com/), a library of 2,663 curated AI prompts.
