Write a macro which toggles a character style?

asked 2019-09-23 22:42:36 +0200

mrodent gravatar image

updated 2020-07-12 04:27:51 +0200

Alex Kemp gravatar image

If you go Ctrl-B you toggle on the Bold attribute. If you then go Ctrl-B you toggle it off again.

Is there any way of doing this with a character style of your own devising? I have created a style called "commentary" and then assigned Alt-D as a shortcut for it.

I have also set a shortcut for the "Character Default Style" (Alt-Shift-0). So a sort of workaround is to go Alt-D... write something... and then go Alt-Shift-0.

But this is not a toggle (i.e. using the same hotkey to switch on and off). And supposing the character style is some other character style than "Character Default Style" when I start writing "commentary"?

edit retag flag offensive close merge delete



The CtrlB is not a toggle either: it just apply direct formatting twice and can create a lot of formatting trouble in your document. To erase direct formatting you should use CtrlM and to erase a character style you can only use, as you found, the default character style.

RGB-es gravatar imageRGB-es ( 2019-09-23 23:22:48 +0200 )edit

@RGB-es rather insightful. thank you for the info.

blashrkh gravatar imageblashrkh ( 2020-06-11 07:04:56 +0200 )edit