Reply to topic  [ 8 posts ] 
Title case macro 
Author Message

Joined: 2013-02-03 05:10:26
Posts: 33
Is there a script that will convert selected case to "title case"?

Howard


2014-03-01 19:25:04
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
Have a look at the following discussion:
viewtopic.php?f=18&t=5520&hilit=title+case

_________________
philip


2014-03-01 19:30:17
Profile

Joined: 2013-02-03 05:10:26
Posts: 33
Philip,

Thanks for the link. How do I open, change, and save the capitalization macro?

Can I save the Title Case macro in "Format | Character Case" so it appears as "Display as Title Case"? If so, how can I do that?

Howard


2014-03-02 16:32:57
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
writerhoward wrote:
Thanks for the link. How do I open, change, and save the capitalization macro?

If you have downloaded the folder you can just double-click on the files and they will open, and show you the code of the macro. You can edit the code, provided you know what you are doing :wink:
But most likely you don't need to change the macro. One of the two macros is for adjusting the list of words you want exempted from being capitalized. You can adjust that list anytime--by running the relevant macro--and that list will be active from that point on forward. This whole approach to Title Case is far from perfect. Hopefully Nisus Writer will have a more properly built-in Title Case feature someday soon.
You can use the macros, either by using "Add Macro to Menu from Fileā€¦" or by saving/moving the macro(s) to the Nisus Macro folder. The macro folder can be organized using sub-folders. The folders inside the macro folder appear as sub-menus.
If you want the macro(s) to have a different name (in the macro menu), just change the name of the macro file before or as you save it.

writerhoward wrote:
Can I save the Title Case macro in "Format | Character Case" so it appears as "Display as Title Case"? If so, how can I do that?

No, this can't be done. Macros are available through the macro menu only. But you can of course assign a keyboard shortcut to a macro to make it more convenient to call, or you can also add a macro as a button on your toolbar if you like.

_________________
philip


2014-03-02 18:38:20
Profile

Joined: 2013-02-03 05:10:26
Posts: 33
Philip,

In the style guide I follow for academic papers, all prepositions within a title are not capitalized. So, if I did not want "about" to be capitalized, would I just add it to $defaultList in the Title Case Exempted Words macro in the correct alphabetical position and then save the file?

Howard


2014-03-03 08:27:11
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
Howard,

no you don't need to change the default list. In fact if you have already run the macro once, changing the default list will do nothing.
But adjusting the list of words that you want to exempt is what the "Title Case Exempted Words" macro is for. Just run the macro and add (or remove) any words you want. The macro is going to store the list of words in a special user registry, so after you adjust the list, that list will continue to be active on your computer 'forever'. If you want to change the list, or check what's in the list, just run the macro again.

Here is what it will look like if you run the macro to add some prepositions to your list:
Attachment:
Title_Case_Macro.png
Title_Case_Macro.png [ 21.47 KiB | Viewed 4607 times ]

So run the macro, and add all the prepositions you need. If you later find that you have missed some, just run that macro again.
After you have set the list to your liking, the Title Case macro will capitalize all words in your title except for whatever is in your list.

Hope this a bit clearer now.
Philip

_________________
philip


2014-03-03 19:32:10
Profile

Joined: 2013-02-03 05:10:26
Posts: 33
Philip,

Thanks for the excellent reply. I was able to add words to the "Title Case Exempted Words" macro; however, when I run the "Title Case Capitalization" macro, the same screen appears as for the "Title Case Exempted Words" macro in which you can add/edit exempted words. I did select text to be changed, but that was unaffected.

Howard

Update: Somehow I got it to work -- sometimes. If I type a line, select it, and apply the capitalization macro, sometimes it works. It did not change this, however, though I added "Above" to the exempted list: The Above Is Not A Good Title. Also, sometimes, it works, I make a change to a word's capitalization, reapply the macro, and it does not work. For example, when I changed The "Above Is Not A Good Title" to "This Is The New Title," it did not lowercase "The."


2014-03-04 10:19:01
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
Hello again,
I'm sorry that the macro is giving you such a hard time.

writerhoward wrote:
Also, sometimes, it works, I make a change to a word's capitalization, reapply the macro, and it does not work. For example, when I changed The "Above Is Not A Good Title" to "This Is The New Title," it did not lowercase "The."

Wait a minute here. This is not what the macro is for. This macro is explicitly not about fixing your capitalisation. This macro only applies the "Display as Capitalized" style to your title in a manner that is consistent with 'true Title case', i.e., capitalisation that exempts certain 'unimportant' words. So if you capitalise "The" the macro respects this and leaves it unchanged. In fact since 'the' is an exempt word it won't even apply the "Display as Capitalized" style, so it's just showing you what you typed.

Of course one could have the macro first force lowercase on all the selected text. I think that would be stupid. What I suspect you really want (Who wouldn't?) is truly smart capitalisation, i.e., the kind that knows what needs to be capitalised and fixes things accordingly. But that is a linguistic problem, and computers can't do that. And I personally hate applications that think they can do that. [Rant about grammar checkers deleted.]

If there is a flaw with my macro as currently implemented, it has to do with the problem that I was writing about in the other thread. (viewtopic.php?f=18&t=5651) That is, since it applies "Display as Capitalized" to whole words, it actually turns "USA" into "Usa" and the like. So here is a version that fixes that problem:
Code:
[macro removed]


Anyhow I hope that clarifies where things stand. Personally I capitalise my text by hand. :)

Update: I am now uploading a revised version of the macro(s) along with a third macro, which allows one to remove the registry variable. This version also fixes some minor flaws, of the previous version. I also added a 'read me' file with some brief explanations on how to use the macros.
Attachment:
Title Case Macros.zip [16.32 KiB]
Downloaded 184 times

_________________
philip


2014-03-04 16:46:16
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software