Space before footnote references

Everything related to our flagship word processor.
Post Reply
lellius
Posts: 48
Joined: 2002-08-15 22:06:44

Space before footnote references

Post by lellius »

Hi all
Suppose I have a text with footnotes and obviously footnote references — which are usually superscripted numbers — but running certain macros I get a space preceding these numbers, which I don’t want.
Is there any wild card or macro or Find Pro expression to delete this space that precedes the footnote reference number (and not the number and the footnote text, obviously)?
Thanks
lellius

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

Re: Space before footnote references

Post by martin »

Using find and replace for this task isn't too easy because normally Nisus Writer skips note references during find. But it isn't hard to accomplish with a macro. Here's macro code that should do what you like, to delete any space characters in front of footnote/endnote references in your main body text:

Code: Select all

$doc = Document.active
$count = 0

$space = ' '
$spaceChar = $space.characterAtIndex(0)

ForEach $note in $doc.allNotes
	$docText = $note.documentText
	$docRange = $note.documentTextRange
	If $docText && ($docRange.location > 0)
		# check for a space character
		$spaceRange = Range.new($docRange.location - 1, 1)
		$prevChar = $docText.characterAtIndex($spaceRange.location)
		If $prevChar == $spaceChar
			$docText.deleteInRange($spaceRange)
			$count += 1
		End
	End
End

If $count > 0 
	Prompt "Deleted $count spaces in front of footnote/endnote references." 
Else
	Prompt "No spaces were found in front of footnote/endnote references."
End
Here a link for the same thing: a Nisus macro file that deletes spaces before all footnote and endnote references in your document's main body text.

I hope that helps!

lellius
Posts: 48
Joined: 2002-08-15 22:06:44

Re: Space before footnote references

Post by lellius »

Martin!
many many thanks. It works wonderfully.
lellius

Post Reply