Autofixing two spaces after a period.

Everything related to our flagship word processor.
Post Reply
raydaniel
Posts: 11
Joined: 2014-06-27 04:35:00

Autofixing two spaces after a period.

Post by raydaniel »

Hi,

Back in prehistoric times I used a publishing tool named Framemaker. Framemaker had a nice feature where it only allowed you to place one space after a period. You could hit the space bar as many times as you wanted after a period and it would still only place one space there.

This is a feature that seems to have been lost to antiquity, but I wonder if there is a way to set Nisus to do this. It would be quite valuable to an old touch typist like me.

Thanks!
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Autofixing two spaces after a period.

Post by martin »

There isn't any way for Nisus Writer to automatically fix the number of spaces after a period, sorry about that.

One workaround: you could use Replace All on your document after you're totally done writing to cleanup those additional spaces. You'd probably turn that Replace All into a macro, so you could run it repeatedly using a single menu.

The simplest macro would look like this:

Code: Select all

Replace All ".  ", ". "
That just replaces double spaces after periods. It wouldn't fix three spaces, or four, etc. To do that we need to switch to PowerFind Pro (aka: regular expressions, regex, grep). As a macro the Replace All looks like this:

Code: Select all

Replace All "\\.  +", ". ", "E"
But we're missing out on matching other kinds of sentence terminals (eg: question marks). We could enhance the macro to cover those cases as well:

Code: Select all

Replace All "([.!?])  +", "\\1 ", "E"
But that still leaves a common situation unaccounted for: sentences enclosed in quotes or other bracketing punctuation. To handle that the expression gets quite complicated:

Code: Select all

Replace All '(?:(?=\\.(?:[^0-9]|$))|(?=\\?)|(?=\\!))(\\p{Punct}*)  +', '\\1 ', 'E'
raydaniel
Posts: 11
Joined: 2014-06-27 04:35:00

Re: Autofixing two spaces after a period.

Post by raydaniel »

Thanks! I will try these.

It's sad that this feature was lost to time.
Þorvarður
Posts: 410
Joined: 2012-12-19 05:02:52

Re: Autofixing two spaces after a period.

Post by Þorvarður »

raydaniel wrote: Framemaker had a nice feature where it only allowed you to place one space after a period. You could hit the space bar as many times as you wanted after a period and it would still only place one space there. (…) I wonder if there is a way to set Nisus to do this.
You can do this very easily in NWP. Open a Glossary file of your choice. Place the insertion point after the last Glossary Entry Break. Now hit the space bar once to create a space; then hit the tabulator key once to create a tab, and then enter a new Glossary Entry Break from the Insert menu. Close the glossary file. From now on you will not be able to type more than one space after a period. This works exactly as you want it. You can hit the spacebar as many times as you want…, only one space will be created. This works also after question and exclamation marks and brackets (?!") — If you want this to work system wide, you could use text expanding tools, such as Typinator.
raydaniel
Posts: 11
Joined: 2014-06-27 04:35:00

Re: Autofixing two spaces after a period.

Post by raydaniel »

Thank you! This is fantastic! Works great.

Ray
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Autofixing two spaces after a period.

Post by martin »

Thank you for that tip Þorvarður. I didn't realize you could have Nisus Writer gobble up spaces like that using the glossaries.
Þorvarður
Posts: 410
Joined: 2012-12-19 05:02:52

Re: Autofixing two spaces after a period.

Post by Þorvarður »

Raydaniel and Martin, I’m glad that I could help.
raydaniel
Posts: 11
Joined: 2014-06-27 04:35:00

Re: Autofixing two spaces after a period.

Post by raydaniel »

Here I am, five years later. I tried the above instructions, but this time the glossary file has had no effect.

Is there something I need to do to enable it?

Thanks!
Þorvarður
Posts: 410
Joined: 2012-12-19 05:02:52

Re: Autofixing two spaces after a period.

Post by Þorvarður »

raydaniel wrote:Is there something I need to do to enable it?
Yes, this has changed. Try this instead:
Type a dot followed by a space and a tab, and then type a dot followed by a Glossary Entry Break.
1.png
1.png (11.28 KiB) Viewed 14045 times
credneb
Posts: 187
Joined: 2007-03-28 07:30:34

Re: Autofixing two spaces after a period.

Post by credneb »

Never noticed this thread before. All of the responses focus on finding some character (period, other punctuation mark) followed by more than one space, or Þorvarður's glossary solution.

Long past the Precambrian period of typewriters, and in the work I do, I can't think of any normal instance where I want two consecutive spaces. ASCII Art is not a concern. If aligned text is desired, a tab is more reliable. I also do many 2-byte >> 1-byte conversions that intentionally insert an extra space that is eventually not wanted. The following macro -- which runs during a clean-up process -- solves all instances of unwanted double spaces for me.

Find and Replace ' +', ' ', 'Ea'

It simply looks for one or more spaces, and replaces what's found with one space.

You can do the same in any of the R/F boxes by typing two spaces in the Find field, and one space in the Replace field. Click Replace All until there are no more finds.

It simply replaces all instances of two or more spaces with a single space. This obviously creates havoc if there are places where you intentionally want multiple consecutive spaces without tabs.
Þorvarður
Posts: 410
Joined: 2012-12-19 05:02:52

Re: Autofixing two spaces after a period.

Post by Þorvarður »

Hello Cliff [credneb],

I think the OP's primary concern was less how to remove unwanted spaces, but rather how NWP can *prevent* him from accidentally adding an extra space after a period when he's writing. :-)
credneb
Posts: 187
Joined: 2007-03-28 07:30:34

Re: Autofixing two spaces after a period.

Post by credneb »

Hi, Þorvarður.

Yes, I understood that, but there is more than one way to skin a cat (although I have never actually skinned a cat).

Another way should be for the glossary entry to trigger by any two consecutive spaces, converting to one. But there can also be complications with this. Being more interested in what goes out than typed in, I simply tried to offer a simple, and perhaps more global, solution of having multiple unwanted consecutive spaces.

Iceland Air (?) is scheduled to start direct flights from Cleveland to Iceland (and points beyond). We are particularly looking forward to the flights starting, and visiting hot springs in Iceland. They feel great already ;)

Cliff
Þorvarður
Posts: 410
Joined: 2012-12-19 05:02:52

Re: Autofixing two spaces after a period.

Post by Þorvarður »

credneb wrote:We are particularly looking forward to the flights starting, and visiting hot springs in Iceland.
That's nice to hear, Cliff. Good luck and bon voyage!

PS
If you are into literature, like me and most other Icelanders, then these articles by Chay Lemoine might perhaps be of interest to you. They describe how the FBI and CIA ruined the literary career of Halldór Laxness in the United States by preventing his books from being published. But the tide has turned. Some of his best novels have now been published again in the States.

https://laxnessintranslation.blogspot.d ... isted.html
https://grapevine.is/mag/feature/2007/0 ... d-the-cia/
http://www.icenews.is/2010/11/18/the-vi ... more-19435
Post Reply