I need to find all instances of a superscript digit that indicates a footnote.
Actually, I need to find instances of two or more superscript digit strings, each separated by a space, that indicate footnotes, and replace each with the same found strings but separated by a comma.
The problem is that my reference manager has entered a few instances of multiple footnote superscripts that indicate multiple footnotes, but it has separated them by a space. It seems that strictly I should separate them with a comma; i.e., no spaces between them are strictly allowed.
Trouble is, I can't seem to set up a "find" expression that will find even one superscript, let alone any number of them separated by spaces.
Any ideas?
How to find instances of superscripts?
Re: How to find instances of superscripts?
G'day, nev et al
For some strange reason, if you first select a slab of text containing one or more Note References and then perform a Find In Selection, you can do what you want.
Set the Find field to a space, select that space, then Format > Character Style > Note Reference, and have the Formatting Sensitive checkbox ticked.
Set the Replace field to a comma, then Replace All.
I'd recommend doing this on a copy of your document, rather than the original.
Cheers,
Adrian
For some strange reason, if you first select a slab of text containing one or more Note References and then perform a Find In Selection, you can do what you want.
Set the Find field to a space, select that space, then Format > Character Style > Note Reference, and have the Formatting Sensitive checkbox ticked.
Set the Replace field to a comma, then Replace All.
I'd recommend doing this on a copy of your document, rather than the original.
Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
macOS Ventura
Nisus Writer user since 1996
Re: How to find instances of superscripts?
Hi, and thanks for answering, but that doesn't work for me, whatever sized 'slab' of text I use.
(I am talking about the superscripted 'Note Reference' character style in the main body of the text, just to ensure we're reading from the same hymnsheet.)
Surely there's a way of doing this? I can't even select superscripted Note References.
Edit: I should make clear that it''s the spaces between superscripted note references that I want to target and replace, not the note references themselves..

(I am talking about the superscripted 'Note Reference' character style in the main body of the text, just to ensure we're reading from the same hymnsheet.)
Surely there's a way of doing this? I can't even select superscripted Note References.
Edit: I should make clear that it''s the spaces between superscripted note references that I want to target and replace, not the note references themselves..
Re: How to find instances of superscripts?
G'day, nev et al
I understood what you meant and my method worked for me, but the way Note References were generated in your document may be different from mine.
A couple of things you might try:–
(1) Before you apply the Note Reference Character Style to the space in the Find field, apply the top two options in the Format menu to it, so you're then searching for a "pure" Style.
(2) Select a small string containing a Note Reference, then look at the Formatting Examiner Palette to see what Styles are actually represented in it.
Cheers,
Adrian
I understood what you meant and my method worked for me, but the way Note References were generated in your document may be different from mine.
A couple of things you might try:–
(1) Before you apply the Note Reference Character Style to the space in the Find field, apply the top two options in the Format menu to it, so you're then searching for a "pure" Style.
(2) Select a small string containing a Note Reference, then look at the Formatting Examiner Palette to see what Styles are actually represented in it.
Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
macOS Ventura
Nisus Writer user since 1996
Re: How to find instances of superscripts?
If I select the space before or after the superscripted note reference, that doesn't show as Note Reference in Format > Character Style; in fact no character style is checked. So I'm not sure how your method could have targeted it.
If I select just a superscripted digit, it shows as Note Reference.
This is also reflected in the Formatting Examiner palette.
The only way I can find a superscripted Note Reference is to make a containing selection, and then use the wild card "AnyDigit" using the "In Selection" option in "Where". Of course I have to keep the selection small, as it might pick up 'regular' digits in the text. And thus it's no good as a find & replace method. I don't have to define any styling sensitivity in the find & replace dialog to do this.
I don't think Nisus can do what I need here. I might conceivably do a find-and-replace on a selection as above, but first I have to find them, so I might as well do it manually.

Edit: Ah, but I can select the whole document and keep using "Where: In Selection"... I'll try that
If I select just a superscripted digit, it shows as Note Reference.
This is also reflected in the Formatting Examiner palette.
The only way I can find a superscripted Note Reference is to make a containing selection, and then use the wild card "AnyDigit" using the "In Selection" option in "Where". Of course I have to keep the selection small, as it might pick up 'regular' digits in the text. And thus it's no good as a find & replace method. I don't have to define any styling sensitivity in the find & replace dialog to do this.
I don't think Nisus can do what I need here. I might conceivably do a find-and-replace on a selection as above, but first I have to find them, so I might as well do it manually.

Edit: Ah, but I can select the whole document and keep using "Where: In Selection"... I'll try that
Re: How to find instances of superscripts?
Well, the last method I mentioned finds them, but I can see no way to replace the space with a comma.
Arrgh!
Arrgh!
Re: How to find instances of superscripts?
Well I did it (I hope) by using this:
... where the tiny character between "Captured 1" and "Captured2" in the Replace field is a comma, selected and formatted to be Format > Character Style > Note Reference.
... where the tiny character between "Captured 1" and "Captured2" in the Replace field is a comma, selected and formatted to be Format > Character Style > Note Reference.
Re: How to find instances of superscripts?
No, it didn't do it. It screwed up the replacements.
Back to the backup.

Edit: It did do some. It just mangled one set of two superscripted note references, and I don't know why.
Back to the backup.

Edit: It did do some. It just mangled one set of two superscripted note references, and I don't know why.
Re: How to find instances of superscripts?
I believe the whole problem is that those Footnote markers are strange beasts, and not seen as digits at all. There may also be issues with the formatting of the space between the markers.
Here is a macro that will check all footnote markers, and if they are one character apart will replace any space with a comma. It will also select the replaced cases at the end, so you can adjust the formatting (and see what it did).
Here is a macro that will check all footnote markers, and if they are one character apart will replace any space with a comma. It will also select the replaced cases at the end, so you can adjust the formatting (and see what it did).
- Attachments
-
Replace Spaces between Footnote Markers with Comma.nwm
- (6.07 KiB) Downloaded 284 times
philip
Re: How to find instances of superscripts?
I think you're right. The spaces of the mangled ones did look odd with invisibles turned on.
Thank you for the macro — I'll endeavour to understand how to use it!
Thank you for the macro — I'll endeavour to understand how to use it!
Re: How to find instances of superscripts?
G'day, all
It's great that this problem appears to have been resolved with a Macro. I suspected it would require the Macro Language because there are in fact a number of bugs in Find & Replace when it comes to searching for Note References. And there appears to be a fundamental design issue here as well.
Start with a digit wild card in the Find field. Select it and remove all formatting. Then format it as a Note Reference (in the Character Style submenu of the Format menu). Ensure the Formatting Sensitive checkbox is ticked.
OK. Now try Find Next and Find All in the Entire File. Both fail.
Now select a slab of text containing Note References, then set the Find dialog box to search In Selection. Find All fails. Find Next finds the first instance of a Note Reference in the selection. Then, curiously, repeating Find Next multiple times results in cycling through the Note References in the erstwhile selection — while it is no longer selected!
No wonder it was so difficult to resolve the original problem in any consistent way using Find & Replace. Oh, and just for the record, spaces and commas I inserted between contiguous Note References in my experiments were selected manually and then had the Style applied as above. (Otherwise, the baseline would have been that of ordinary text.) I knew that, almost certainly, nev's Note References would have been generated differently and likely in some unorthodox manner, at least as far as NWP is concerned. So it's good that Philip's Macro is able to capture those spaces.
What nev's question also highlights, though, is that Nisus Writer does not handle multiple contiguous Note References well. The Footnote item in the Style Sheet allows one to set one or more characters before and/or after a Note Reference, but you then end up with leading and/or trailing junk (such as a comma after the second of two Note References). If you don't set some interpolated character(s), the appearance will be wrong; eg, Note Reference 2 and Note Reference 3 will look like Note Reference 23. There really needs to be some option in the Style Sheet that allows specification of the manner in which contiguous Note References should be separated.
Cheers,
Adrian
It's great that this problem appears to have been resolved with a Macro. I suspected it would require the Macro Language because there are in fact a number of bugs in Find & Replace when it comes to searching for Note References. And there appears to be a fundamental design issue here as well.
Start with a digit wild card in the Find field. Select it and remove all formatting. Then format it as a Note Reference (in the Character Style submenu of the Format menu). Ensure the Formatting Sensitive checkbox is ticked.
OK. Now try Find Next and Find All in the Entire File. Both fail.
Now select a slab of text containing Note References, then set the Find dialog box to search In Selection. Find All fails. Find Next finds the first instance of a Note Reference in the selection. Then, curiously, repeating Find Next multiple times results in cycling through the Note References in the erstwhile selection — while it is no longer selected!
No wonder it was so difficult to resolve the original problem in any consistent way using Find & Replace. Oh, and just for the record, spaces and commas I inserted between contiguous Note References in my experiments were selected manually and then had the Style applied as above. (Otherwise, the baseline would have been that of ordinary text.) I knew that, almost certainly, nev's Note References would have been generated differently and likely in some unorthodox manner, at least as far as NWP is concerned. So it's good that Philip's Macro is able to capture those spaces.
What nev's question also highlights, though, is that Nisus Writer does not handle multiple contiguous Note References well. The Footnote item in the Style Sheet allows one to set one or more characters before and/or after a Note Reference, but you then end up with leading and/or trailing junk (such as a comma after the second of two Note References). If you don't set some interpolated character(s), the appearance will be wrong; eg, Note Reference 2 and Note Reference 3 will look like Note Reference 23. There really needs to be some option in the Style Sheet that allows specification of the manner in which contiguous Note References should be separated.
Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Ventura
Nisus Writer user since 1996
macOS Ventura
Nisus Writer user since 1996