Page 1 of 1
Space before footnote references
Posted: 2020-03-17 03:15:25
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
Re: Space before footnote references
Posted: 2020-03-17 08:05:36
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!
Re: Space before footnote references
Posted: 2020-03-18 00:27:14
by lellius
Martin!
many many thanks. It works wonderfully.
lellius