search and replace for abbreviated ordinals

For all things Mellel

Moderators: Eyal Redler, redlers, Ori Redler

Post Reply
Vaissiere
Read the guide!
Posts: 39
Joined: Sun Dec 26, 2010 10:46 am
Location: Paris

search and replace for abbreviated ordinals

Post by Vaissiere »

Hello

is there any convenient way to make a search and replace of abbreviated ordinals, for instance 2nd, by 2nd with the final nd in upperscript, that is the correct typography of such an ordinal? What I can see right now is to search for all "2nd", change "2nd" to upperscript, and then search for all the "2" and change them back to normal. But it is almost impossible to do that with languages making use of Roman numerals : for instance "vie" is both a very common word and sequence of letters in french, but VIe means 6th…

yours

Etienne
Vaissiere
Read the guide!
Posts: 39
Joined: Sun Dec 26, 2010 10:46 am
Location: Paris

Re: search and replace for abbreviated ordinals

Post by Vaissiere »

or to put it differently : any automated way to have the typographically correct abbreviated form for ordinals, that is with the final letters in upperscript?
ahankinson
Knows everything, can prove it
Posts: 83
Joined: Tue Oct 25, 2005 5:37 pm

Re: search and replace for abbreviated ordinals

Post by ahankinson »

There is no automated way to do this, but you could set superscript as a character style variant. Then you can change it with a keyboard shortcut.
Bill
Read the guide!
Posts: 39
Joined: Thu Oct 20, 2005 8:19 pm
Location: CT USA

Re: search and replace for abbreviated ordinals

Post by Bill »

I use Text Expander for this, in combination with Charis SIL font, but it's a "mixed bag."

The beauty of the Charis SIL font is that it has a full set of numerical superscripts and subscripts, and numbers and letters are nicely aligned in their superscript or subscript positions. This is a great solution if you are writing things down only for yourself, or if you share documents in pdf format.

However, if you intend to share your words with other users in any format other than pdf, this solution does not work. Computers that don't have the Charis SIL font installed, substitute it for an already installed font. Abbreviations like 1ˢᵗ, 2ⁿᵈ, or ¹⁶O₂ can end up looking terrible on other computers, depending on the font substitution that takes place when Charis SIL is not installed. Most popular fonts lack consistent, good looking superscript and subscript characters.
Bill
macsailor
Knows everything, can prove it
Posts: 367
Joined: Thu Oct 20, 2005 1:10 pm
Location: Linköping, Sweden

Re: search and replace for abbreviated ordinals

Post by macsailor »

Bill wrote:I use Text Expander for this, in combination with Charis SIL font, but it's a "mixed bag."

The beauty of the Charis SIL font is that it has a full set of numerical superscripts and subscripts, and numbers and letters are nicely aligned in their superscript or subscript positions. This is a great solution if you are writing things down only for yourself, or if you share documents in pdf format.

However, if you intend to share your words with other users in any format other than pdf, this solution does not work. Computers that don't have the Charis SIL font installed, substitute it for an already installed font. Abbreviations like 1ˢᵗ, 2ⁿᵈ, or ¹⁶O₂ can end up looking terrible on other computers, depending on the font substitution that takes place when Charis SIL is not installed. Most popular fonts lack consistent, good looking superscript and subscript characters.
Thanks for the tip. Will check it out.
Peter Edwardsson
..............................
Truth is not always popular, but it is always right.
Vaissiere
Read the guide!
Posts: 39
Joined: Sun Dec 26, 2010 10:46 am
Location: Paris

Re: search and replace for abbreviated ordinals

Post by Vaissiere »

I am coming back to this old request of mine. In "Find/Replace" we can only choose a style for a whole word or sequence of words. It is impossible to apply a specific style to each letter. But it would be very useful. As a historian I have always to deal with (in French) ive, ve, vie, viie, viiie siècles (4th to 8th centuries). It would be extremely convenient to find all "viie" with the Find function and to replace it with the sequence "vii" in Small Caps + the final "e" as upperscript.

This is a more general request. There might be several cases in workflow in which we might need a precise styling, letter by letter, in the Find and in the Replace functions

yours
Etienne
Icelander
Knows everything, can prove it
Posts: 366
Joined: Mon Aug 18, 2014 10:59 pm

Re: search and replace for abbreviated ordinals

Post by Icelander »

Hello Etienne,
In "Find/Replace" we can only choose a style for a whole word or sequence of words. It is impossible to apply a specific style to each letter. But it would be very useful.
You mean like in Nisus? Yes, that would be useful if Mellel users could do that too. — You should send this as a feature request directly to the Redlers, because NO official person is reading the forum posts or cares about what we are saying here.
I didn't first realize that this thread actually started 8 years ago (when I was not a member of this forum)! Amazing that nobody has yet come up with the correct solution.
is there any convenient way to make a search and replace of abbreviated ordinals, for instance 2nd, by 2nd with the final nd in upperscript, that is the correct typography of such an ordinal?
Yes, you can do this very easily if you first go through the rigmarole of creating a FindSet with the necessary Find Actions.
What I can see right now is to search for all "2nd", change "2nd" to upperscript, and then search for all the "2" and change them back to normal.
This would be far too time-consuming.

@ahankinson
you could set superscript as a character style variant. Then you can change it with a keyboard shortcut.
This option works only if you type the text manually yourself, but it fails when you import documents from the Internet or copy and paste text from PDFs where superscripts have got lost.

@Vaissiere
It would be extremely convenient to find all "viie" with the Find function and to replace it with the sequence "vii" in Small Caps + the final "e" as upperscript.
You can do this in Mellel, almost as conveniently as in Nisus. :–)

Instead of describing the Find Actions here in detail, I uploaded the complete FindSet as a Compressed Archive (.ZIP) for you. Inside is the FindSet as a .pfs file. All you need to do is to import it. Don't double-click on it! That might cause another program to open it. Follow instead these instructions from the Mellel Guide on p. 219:

F. Importing a Find Set
To import an external Find Set to use in your documents:
1 Choose Edit > Find > FindSet from the menu bar, or press Cmd + Shift + F to open the Find 
Set window.
2 Click the Settings button (in the lower left corner).
3 Choose Import Find Set from file.
4 Locate and select the Find Set file (with a .pfs extension).
5 Click Open.

The "Superscript English ordinals" are for English, the "Superscript French ordinals" are for French. You can run them both together to simultaneously superscript ordinals in both languages, in case you have both types of ordinals in your document.

There is also a gibberish TEST file in Mellel format in the uploaded folder. Download it and double-click on it to open, then select and run all the Find Actions I created for you in the FindSet in one go to see how all the ordinals are instantly superscripted.

Enjoy!

http://www.mediafire.com/file/9kcxdh5gf ... e.zip/file
Last edited by Icelander on Fri Apr 22, 2022 9:55 am, edited 1 time in total.
Vaissiere
Read the guide!
Posts: 39
Joined: Sun Dec 26, 2010 10:46 am
Location: Paris

Re: search and replace for abbreviated ordinals

Post by Vaissiere »

Thanks a lot I will give it a try!

but more generally, I do think that the ability to create stylistically complex find/replace directly in a single action would be useful
yours

Etienne
Icelander
Knows everything, can prove it
Posts: 366
Joined: Mon Aug 18, 2014 10:59 pm

Re: search and replace for abbreviated ordinals

Post by Icelander »

the ability to create stylistically complex find/replace directly in a single action would be useful
That's pretty obvious. But this is not going to happen (in the near future), so the question is: can this be easily achieved in another way. And the answer is yes.

Let me know when you have imported the FindSet I made for you. If you have specific questions regarding how to use it, then just ask.

PS
Greet the Sogdian traders from me. :–)
Yes, I own the book … in James Ward's translation.
Vaissiere
Read the guide!
Posts: 39
Joined: Sun Dec 26, 2010 10:46 am
Location: Paris

Re: search and replace for abbreviated ordinals

Post by Vaissiere »

The Sogdian Traders was written with MS Word, but the next one "Samarcande et Samarra" was written in Mellel. It allowed me to incorporate without problem Arabic, Chinese, but also (the only book in the world!) Sogdian in a font I have created, by hacking the Arabic unicode range: Mellel thinks it is just another RTL Arabic font : ))


The find set works fine, thank you

yours

Etienne
Post Reply