Is there a way to globally change [18] to superscript 18

Hi,

I am writing a document and have pasted in quotes that have verse numbers identified in this manner: [18] They are in square brackets and consist of a single or double digit number. I’m finding this obtrusive to the reader and would like to run a macro of some sort which would find every place there is a number in square brackets, remove the brackets, and convert the number to a superscript. Is there any way of doing that?

Thanks,

Gordon

Ideally, you would assign a character style to you sequence. After that, the appearance of your verse number can be controlled centrally. If your verse numbers aren’t too numerous, you can do that manually. Otherwise, a macro is needed to “patch” your document. Unfortunately, I have never written a macro so far and can’t help you on this.

For applying a character style, a macro is not required. Find/replace in a few steps does the trick (assuming that the verse numbers are entered as plain text, and not structural elements like footnote, endnote or “managed citation”)

First, you need the character style.

The Footnote anchor style is preset to visually do what you ask, but it is recommended to create a new style (VerseNumbering) specifically for the type of content you are working on. This separates content/meaning from visual design, and also if you change your mind you can easily change the appearance of those numbers without affecting footnotes.

Procedure:

  • Menu selection Edit - Find and replace…
  • Search for: \[([:digit:]{1,2})\]
  • Expand the “other options” and tick Regular expressions
  • Click Find all
  • Double click in the styles list to apply your character style of choice
  • In the “Replace” field enter: $1
  • Click Replace all

Reformatting all verse numbers will then be as simple as altering the character style.

Edit: Forgot to mention regular expressions on first pass. Corrected now.

5 Likes

Thank you both very much for your time. That is amazing keme1! I bring the text in from another program as a cut and paste and use the quotations paragraph style to keep it separate. I did what you said and double clicked the quotations style, and it highlighted all the numbers by slanting them over a bit. One thing, when I hit the replace all, it changed them to regular numbers. Is there a way to make them superscripts by using something other than the dollar sign?

It seems like I can continue to cut/paste the text in the way I have been doing, and then when I feel like it, run this find/replace on the document and have it change everything. Is that correct?

Edit: Wow, I went to Format before doing the replace all and clicked on superscript and sure enough, it made all the numbers superscript! Very Cool!
2nd Edit: After working with the Writer Guide and really figuring out what you were saying, I realize that what I initially did is not what you recommended. Now I think I really understand what you meant and will get this done exactly like you said. That way the verse numbers can be changed globally. I’m glad I was using a duplicate copy of the text for practice, nothing got ruined that way. Thanks again for the great advice!

If you inserted the quotes using a citation manager (e.g. Zotero, EndNote, Mendeley), the way to change this is the choice of citation style.

  • QuoteThis[123] is what you get with the “IEEE” citation style
  • QuoteThis123 is achieved by the “Nature” citation style

See e.g. this link for a description of the Nature citation style.

I have only used this in Zotero, and it was a few years ago. I am not sure whether I had to enter the Nature style definition myself or it was predefined. Neither do I know whether the Nature style is universally available like e.g. IEEE and APA styles are.