Small Capitals shortcut or icon

In Writer there is a character format style called Small Capitals, which some of us employ constantly, for instance, to render a better view of roman numerals like in centuries. So, I wonder if there is a shortcut I can use, or even an icon I can put in the toolbar.

You can do this with a macro. I think you need to do this with a macro, in fact, because I can’t see where this feature can be found in the Tools > Customise... options. If you haven’t recorded a macro with LibO before, you might need some help to find out how, and that link should point in the right direction.

Meanwhile, I tried this myself, and here’s what I came up with: first, recorded the macro; then, assigned it to the toolbar. If you want to see if my macro does the job for you, try this (it should only take about five minutes):

1. Set up macro

  1. Click on Tools > Macros > Organise macros > LibreOffice Basic… (a new window opens).
  2. In the left-hand box, you should see “[+] My Macros”. Open that up by clicking on the “plus” sign to get “[+] Standard”, open it and see “Module 1”, now click on it. You should now see “Main” listed in the right-hand box, “Existing macros in: Module 1”.
  3. Click on “Main” in the right-hand box, and now the “Edit” button to the right of it. A new window opens, and in the main text area, you should see “Sub Main” followed a blank line later by “End Sub”. Good.
  4. Now we need to get the LO Basic code – the macro itself – to paste in below that “End Sub” line. I have saved this as a “gist” on Gitub, but go to the raw version, hit CTRL-A to select all, then CTRL-C to copy to clipboard.
  5. Return to the LibreOffice Macro editor, position your cursor under the “End Sub” line, then hit CTRL-V to paste it in. Press CTRL-S to save it.
  6. Close the Macro editor.

Now when you go to Tools > Macros > Organise macros > LibreOffice Basic… (and My Macros > Standard > Module 1) again, you will see SmallCapsStart and SmallCapsStop listed below Main (along with any other macros you might already have made). Good. It worked!

2. Assign to Toolbar

  1. Go to Tools > Customise..., then choose the “Toolbars” tab in the new dialog that opens.
  2. Choose which toolbar you want these to appear in: to me, it makes most sense to include it with the “Formatting” options, so find that one on the Toolbar drop-down.
  3. Click the “Add…” button on the right, go to the bottom of the list on the left, “LibreOffice Macros”, and click it so that it expands. Then, as we did above, go to My Macros > Standard > Module 1, and you should see SmallCapsStart. Click it, then click the “Add” button; then repeat, this time with SmallCapsStop highlighted (again, click “Add” button).
  4. You should now have both macros on your Formatting toolbar. Now position them where you want in the “Customise” dialog. You can assign an icon if you like, from the “Modify” button on the right.

I just renamed to scGo and scNo for the small caps start and stop:

I also like to use Linux Libertine Graphite to get “true” small caps - you might like to check it out, too, if you’re using them a lot.

Hope this helps. (Probably someone will come along with something more simple!)

Great guide. You should also be able to create a new character style (e.g., “Small capitals”) that either has the required Font effect enabled or uses the graphite feature (e.g., Linux Libertine G:c2sc or Linux Libertine G:smcp for upper-case or lower-case respectively). This style will then show up under Tools > Customize > Keyboard > Category of “Styles|Character” for assigning to a key combination.

This macro works as intended. I didn’t know the font you mentioned, but it looks great: already installed it (from Ubuntu repos) and trying for my documents. Thanks for your time.

@oweng = I considered the character style approach, but wasn’t sure if it specified too much (e.g., font-family, size, etc.) and thought the macro was more “agnostic”. But if the use case meant those factors were defined and stable, then the style approach would certainly be faster/easier to implement.

It’s a pity this isn’t implemented in the software itself (so you can have one single key combination that toggles this, like for italics or bold), but barring that this is a great solution. Thanks for taking the trouble.

Apart from the great answer @dajare gave, there is a nice quick and dirty how-to from Brian

http://permalink.gmane.org/gmane.comp.documentfoundation.libreoffice.user/14175

Short description:

  • format a word as small caps
  • mark it and define a new character style
  • use “Fill Format Mode” button and simply click on every word or sentence

In my eyes very nice for just a few words to be renamed.