Reply to topic  [ 7 posts ] 
Spacing at ends of sentences. 
Author Message

Joined: 2004-12-15 10:16:29
Posts: 23
When I get manuscripts for stories in our local outdoors publication, many writers will double or even triple space after the end of a sentence. I then have to go through and manually change these to single spaces.

Is there any way that Xpress can do this automatically for the entire document?


2005-08-29 06:45:22
Profile

Joined: 2004-02-25 18:28:40
Posts: 419
Location: Maryland, USA
Post 
PowerFind or PowerFind Pro should do what you want.

Using PowerFind, in the "Find What" space type two spaces, then click the gear menu, then Repeat #, then 1+. In the "Replace With" space type a single space. Click Replace All.

Using PowerFind Pro, type space, space, plus ( +) in the "Find What" space and space ( ) in the "Replace With" space. Click Replace All.

--Craig


2005-08-29 08:20:11
Profile

Joined: 2003-11-21 19:25:28
Posts: 333
Location: Sydney, Australia
Here's a macro to do the job. It removes excess spaces (i.e. 2 or more) following periods in the current document, replacing them with a single space, and creates a new document containing the modifed text (so you still have the original document available, just in case). It won't remove extra spaces between words that are part of the same sentence however, if you require that it can be easily modified:

Code:
#Nisus Macro Block
#source front
#destination new
#End Nisus Macro Block
while (my $line = <>) {
   $line =~ s/(\.)(\s){2,}/\. /g;
   print $line;
}


2005-08-29 19:43:03
Profile

Joined: 2010-11-06 08:10:38
Posts: 23
I'm using the newest version of NWP, and wanted to get rid of extra spaces in a document. I found this very old thread in the forums; but unfortunately I'm not a macro author (yet), so am not quite sure how to take up the suggestion at the very end.

The details of my issue. I've just been sent a file that includes extra spaces scattered throughout the text. Sometimes these come at the start of a sentence, but more commonly they are simply appearing between words -- e.g., 3 or 4 spaces between two words. I'm not sure why or how the author did this, but she did. Anyway, I need to edit this (long) text, so it would be very welcome to automate some of this work.

I need to KEEP two spaces at the start of each sentence (i.e., after each period), but to maintain only one space between words everywhere else. Is there a macro available that would do so?

Under the existing macros (the ones that came with NWP), I see "cleanup punctuation" -- would that include this space-fixing? I don't see a description for that macro (listing what it would do) in the help file, or in the forums. Thanks!


2011-03-15 08:43:38
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
michiganuser19 wrote:
I need to KEEP two spaces at the start of each sentence (i.e., after each period), but to maintain only one space between words everywhere else. Is there a macro available that would do so?

Not offhand, but it's quick enough to make one (I used PowerFind Pro and the "macroize" feature):
Code:
Find and Replace '(?<![\\.!?]) {2,}', ' ', 'Ea'

It replaces all cases of 2 or more spaces that are not preceded by a period, exclamation, or question mark with a single space. Let me know if it gives you any trouble.


2011-03-15 10:20:28
Profile WWW

Joined: 2010-11-06 08:10:38
Posts: 23
Thanks very much! That's really terrific. And it does precisely what I need.

Is there a listing somewhere of the (presumably multiple) changes that would be made by the predefined macro "clean up punctuation"?

Thanks again --


2011-03-18 10:03:51
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
If you open the macro for editing, the comments (after the "#" sign) somewhat list the changes, eg:
Code:
Find and Replace ‘  +‘, ‘ ‘, ‘aE’ #Replace multiple spaces with one,
Find and Replace ‘([,;:\!\?])\1+‘, ‘\1‘, ‘aE’ #Remove duplicate consecutive punctuation
...


2011-03-18 13:43:47
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software