In English an orphan is:
A paragraph-opening line that appears by itself at the bottom of a page or column, thus separated from the rest of the text
Thus, in English typography it is understood in the context of the whole paragraph. Single line of a new paragraph, left alone on the preceding page (before page break) is not allowed.
Polish language is more strict by that and “explores” an alternative (less known) definition of “orphan”. In Polish typography this term is understood in the context of single line and regarded as a:
Single word (single letter in most cases) left along at the end of line (next to right paragraph).
And similarly this is prohibited in Polish typesetting.
In this article you can find a Word macro for removing such orphans from your text.
There’s no magic feature or rule that can be applied here. The solution isn’t anything more than just a dully search and replace. Where each single letter (
z) is found and a regular space that follows it is replaced with non-breaking space.
This causes that single letter to be “glued” together with a word that follows it. If such single letter “lands” at the end of line, it is pushed to the next line, by the longer word that it is “glued” to.
For a very short text, you can obtain this manually:
- Read through your text, closely looking at a single characters by the end of line (next to right margin)
- Select each space that follows such single letter with Shift+→
- Hit Ctrl+Shift+Space it replace it with a non-breaking space
For a longer blocks of text an automated solution is a must.
Microsoft Word macro
In Microsoft Word (example based on old Word 2010):
- Go to View tab → Macros frame and hit Macros button
- Put some name (i.e.
OrphansRemovalinto Marco name field
- Check, if Macros in field is set correctly (i.e. where you are creating your new macro)
- Hit Create button
- Paste following code and save the macro by hitting Ctrl+S or clicking Save button
The code to paste:
Sub OneLetterWordRemoval() ' ' OneLetterWordRemoval Macro ' ' Removes single letters (A, a, I, i, O, o, U, u, W, w, Z and z) ' from the end of each line by replacing simple space following ' each single letter with non-breaking space instead. ' ' https://wp.me/p2T7KS-Sx ' https://tex.stackexchange.com/q/345936 ' https://english.stackexchange.com/q/116800/22996 ' https://en.wikipedia.org/wiki/Widows_and_orphans#Definitions ' https://pl.wikipedia.org/wiki/Sierotka_(typografia) ' Dim sFind As String Const cLets As String = "([AaIiOoUuWwZz]) " Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = True .MatchSoundsLike = False .MatchAllWordForms = False End With sFind = " " & cLets Selection.Find.Execute FindText:=sFind, _ ReplaceWith:=" \1^s", Replace:=wdReplaceAll sFind = "^s" & cLets Selection.Find.Execute FindText:=sFind, _ ReplaceWith:="^s\1^s", Replace:=wdReplaceAll End Sub
Then save your file (see next part).
When later you open any document that contains your macro, you can again go to View tab → Macros frame and hit Macros button, then select OneLetterWordRemoval macro in the list and hit Run button.
A word about saving macros in Word
You can save your macro for either:
- single usage (in .docm file — Macro-enabled Word Document) or
- multiple usage (in .dotm file — Macro-enabled Word Template)
Note that this particular macro is “one-time runner”. You have your text, you process it one time to remove are single letters from the end of all line and you’re done. If you continue editing this text, you will most likely use manual method, described above, to avoid future “orphans”.
For this reason you don’t have to keep your text in .docm (macro-enabled document), a format which is considered a “risky” by many apps and services (since macros can contain viruses). Once you’re done with the automatic replacement, you can easily save your file as a regular document (.docx; macro-free document) and continue editing there.
Alternatively, you can:
- Open Microsoft Word with a blank document
- Add macro in the way described above, selecting Normal.dotm (global template) in Macros in:
- Save file in %APPDATA%\Microsoft\Templates as Normal.dotm template (overwriting original)
This is a little bit risky in some scenarios (you’re overwriting a global template after all). But as a result you will have your macro available in every Word document that you create, even those macro-free (.dotx).
You just have to make yourself sure that you are adding new macro to global template:
Note that there is a “shortcut” in thinking above. You can’t overwrite Normal.dotm file from Word, because this global template is locked (in use) when any copy of Microsoft Word is run. You have to instead:
- Save your macro in a different name (i.e. xxx.dotm)
- Close all copies of Word
- Delete original Normal.dotm file
- Rename xxx.dotm into new Normal.dotm
- Restart Word to see, if everything works.
This is the risky part.
The problem with the above macro is that it adds non-breaking spaces everywhere within the text, not only at the end of lines, but also inside. And since NBSP is visually longer than a regular space, this can produce an not so nice effect of having too expanded text with visually too big spaces between words.
I’d also suggest to re-think the idea of adding this makro to your Normal.dotm template. In certain rare situations even newest version of Word gets wako and warns about every file created based on Normal.dotm template, that macros in such document has been disabled due to security issues. Even though all Word templates are placed in the folder considered by Word as a safe location.