Shortcut to turn line breaks into paragraph breaks?

So I copy a lump of text, and when I paste it into Pages, some breaks are line breaks and some are Paragraph breaks. I’d like them all to be paragraph breaks, so no line breaks present.

Is there a shortcut or way to turn the line breaks into paragraph breaks, please?

Many thanks,

Robert

I searched internet for “how to search for line breaks in pages mac” and found the following which gives pretty clear instructions for using find/replace in Pages using the codes for new line and paragraph mark (Pilcrow):

https://discussions.apple.com/thread/8660630

I don’t know how nor pursued how to make a short cut as it’s probably not necessary. Up to you, though. Starting is to get the find/replace going.

3 Likes

Apps like TextSoap can clean up line endings and re-wrap paragraphs. And coding editors like BBEdit and Textastic, for example, can do the search and replace, too.

1 Like

Heck, even Microsoft Word can do it – they make using “special” search characters more visible than Pages for user in the find/replace dialog box. If Pages does make special characters visible for searching, I didn’t spot it.

Knowing the codes for searching, Pages works.

1 Like

You’re absolutely right. And if that’s what people have, it’s good to know how to do some of the less obvious tasks that crop up. I just dislike MS Word after having to use it at work for decades. :slightly_smiling_face:

1 Like

The OP was in Pages, so I didn’t consider giving alternative products to use.

I think Microsoft Word is excellent, actually. Yes, people like to bash it, but there you go. I even wrote a book about how to use it “effectively” especially with teams of collaborators. That got some consulting gigs out of that to get teams doing complex and big documents (destined for gov’t approvals). That being said, I’m not going to renew my Office 365 subscription in Feb as I really have no use for those tools anyway. I use other products.

1 Like

Thank you for the replies. I’m a dedicated Pages user, who likes to use MS Word as little as possible. I’ll look around to see if the Find and Replace can be automated.

Robert

I’m not for a moment suggesting you use Word! The conversation just diverted when other tools mention by @karlnyhus See my reply to you at top with link showing how.

Now I’m unsure what you are trying to do when you see more automation. As it is, you can do a “replace all” and do the entire document at once for each pair of find/replace characters. That not work?

Or, perhaps the incoming text is random about incorrect use of newlines vs. Pilcrows and if so, that would be hard to automate.

Expressing this as an algorithm in words, how do you see the automation would work? Once the process is defined and set into the short-cut, then you can call it. But without the algorithm, I’m puzzled. Maybe just me.

The technical meat boils down to “what characters are a line break and what are a paragraph break?” Then it’s a matter of processing the string to replace one by the other. But I’ve not seen the answer to this question in this thread - yet.

Thanks @rms - and for showing how the find and replace can do this. That is a big help.

I guess that I’m asking to have my cake and eat it, which may not be possible! The lump of text that I paste in for some reason gives me a random mixture of line and paragraph breaks. I have to do it 4 times each week at present. Ultimately I’d love to be able to select the pasted text, hit a Keyboard Maestro hotkey or button on my StreamDeck and voilà, linebreaks are gone, replaced by paragraph breaks.

Using Pages Find/Replace explained in link at top. “Trick” is to know how to represent the newline and Pilcrow special characters in the built-in Pages function.

As to how to make a Keyboard Maestro (or equiv) script … leave that to others. I don’t use that product.

So, the “algorithm” is to replace all newlines with Pilcrows? So all you need is a Keyboard maestro that tells Pages to run the Find/Replace menu comment, add-in to the dialog box the Find “newline character” and add the “pilcrow character” to the replace box, then activate the “Replace All” button. Simple as that? I can’t think that would be difficult for someone who knows Keyboard Maestro, or equiv.

But …

Or, are some of the new lines actually have to be replaced with spaces to to keep the two lines within the same paragraph. If so, how to tell the computer how to make that decision? And are some of the pilcrows also supposed to be space, or even newlines? If in fact the incoming text throws a “random mixture” at you, it sounds to me difficult to automate without human decisions.

And you do this 4 times a week. Do you do exactly the same thing each time, or are their four “situations” that need to be changed each week? Exactly what do you do each time? (That helps define the algorithm).

I’m not really answering your question, but as someone who does some copy-editing on the side, I am intrigued to know whether the issue is coming from the source, or if Pages is introducing a new problem. I.e. is the source using line breaks and paragraph breaks indiscriminately, or is Pages reading them wrong for some reason and giving you a remixed version of the copy?

There used to be a glitch with Word (I’m talking years ago and I don’t know if it still happens as I don’t use Word) where for whatever reason it sometimes converted line breaks to paragraph breaks when pasting. People had to find workarounds, but if the issue here is that Pages isn’t handling the source text properly, that’s a problem that Apple should be fixing.

It’s the source. I’m using someone else’s original work from a while back - and they seem to use line breaks and paragraph breaks indiscriminately!

Many thanks.

Robert

This is where an app like TextSoap comes in. I can do any text cleaning and automation that I need in Keyboard Maestro and BBEdit apps, but if these are not your cup of tea, then TextSoap has many text cleaning mini-tools that can be assembled into what today we are pleased to call an “automation.”

Indeed “random”. I cannot discern a pattern to suggest how to automate. Looks to me that the best way forward is to change all new-lines to paragraph pilcrows and format line spacing for paragraphs to be zero space after. That way there are no new-lines characters at all.

The indentation of six spaces (if I’m counting them correctly–hard to see) in Pages would more correctly be done with one tab and and a tab stop set where you wanted it, but as long as you use fixed width fonts it will work as it is, I guess.

I prefer to use Pages formatting differently, but it probably is too much work to do the changes every week like you say you do. (I would have new lines inside paragraphs where a new line is wanted, tabs to make indentations, pilcrows at the last line of the paragraph, no extra pilcrow after the last line, and set “after line spacing” for paragraphs to be, say 6pt or whatever.

That being said, does it really matter? Does it not now, before changes, come out as you expect with regard to line breaks and spacing?

1 Like

I use Pastebot for stuff like this.

Pastebot has a “Change Line Endings” filter that is customizable. You can choose which type of line ending your pasted text will have. I just did a test and formatted some text with carriage returns (line breaks) and linefeeds (paragraph breaks) like your example text has, and then I pasted it with the filter set to make them all paragraph breaks. It worked.

You can set up the filter once and then assign a keyboard shortcut to it so that when that key combo is pressed, Pastebot takes whatever is on the clipboard and applies that filter to it.

You can also stack multiple filters into one action, sort of like how you’d build a rule in other apps. It includes a “Find and Replace” filter that would probably also do what you need, by different means, and could be set up to remove multiple spaces and anything else you’d use a find and replace function to do, all in one fell swoop.

It also allows for the use of regular expressions, if you’re looking for a way to waste several hours of your life before descending into uncontrollable fits of rage.

I use Pastebot only because it’s the one I started using when I decided it was time to stop doing the kind of stuff that this text is forcing you to do. I’m sure Keyboard Maestro, or another dedicated clipboard manager app, would have a similar function.

2 Likes