nisus.com
https://www.nisus.com/forum/

Spacing at ends of sentences.
https://www.nisus.com/forum/viewtopic.php?f=8&t=1199
Page 1 of 1

Author:  wolfcreekads [ 2005-08-29 06:45:22 ]
Post subject:  Spacing at ends of sentences.

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?

Author:  cchapin [ 2005-08-29 08:20:11 ]
Post subject: 

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

Author:  dshan [ 2005-08-29 19:43:03 ]
Post subject:  Spaces at End of Sentences

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;
}

Author:  michiganuser19 [ 2011-03-15 08:43:38 ]
Post subject:  remove extra spaces throughout?

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!

Author:  martin [ 2011-03-15 10:20:28 ]
Post subject:  Re: remove extra spaces throughout?

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.

Author:  michiganuser19 [ 2011-03-18 10:03:51 ]
Post subject:  Re: Spacing at ends of sentences.

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 --

Author:  martin [ 2011-03-18 13:43:47 ]
Post subject:  Re: Spacing at ends of sentences.

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
...

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/