Hotkey (or similar) to quickly switch to a monospace font ("teletype") in either LibreOffice or Microsoft Office

I find myself doing a lot of writing where I would have to change fonts for certain parts of the text. The obvious example is writing code documentation, where you'd have to reference code frequently, and it's much more readable to write code in a font that distinguishes it from non-code.

In markdown, such as on sites like this one, doing this is super fast and I merely have to use backticks.

Is there some way that I can use backticks or a hotkey to type monospace characters in either LibreOffice Writer or Microsoft Office Word? I don't care if it's only available in one of the two.

It doesn't have to be a hotkey, all I require is that I can use it very quickly while I type instead of having to use the mouse.


Apparently yes! In LibreOffice:

  • Click menu Tools -> Customize... -> Keyboard. A dialog like below will show:

Now, to enable switching to "monospace"/"fixed-width" font, via e.g. Alt-1 shortcut:

  • In Shortcut keys, scroll down to e.g. Alt-1 (was empty for me) and click it;
  • In Category, scroll all the way down to Styles, click it to open, then click Character;
  • In Function, choose Source Text;
  • Click the Modify button (don't forget to do this!). Your Alt-1 should now show in the Keys area (bottom-right).

To enable easy switching back to "regular" font, repeat above steps, but use e.g. Alt-0 instead of Alt-1, and Function Default Style instead of Source Text.

(Based on a reddit answer to a similar question.)

Hints

And by the way, some related shortcuts available by default, apparently:

  • Ctrl-1, ..., 5 -- paragraph style: Heading 1, ..., 5
  • Ctrl-Shift-0 / Ctrl-0 -- paragraph style: Default Style / Text Body
  • F12 / Shift-F12 -- Numbering on/off / Bullets on/off
  • Ctrl-Shift-P/B -- character style: suPerscript / suBscript

I was recently reminded of this question and decided to see if Office 2013 has anything. I managed to find a solution:

In the options menu, go to customize ribbon > keyboard shortcuts:

Then in the fonts category, you'll be given a full list of available fonts which you can assign hotkeys to:

The assigned hotkey will switch to that font. It's not a toggle, so you'll need hotkeys for every font you intend to use (fortunately, I never find myself with more than 3 fonts in the same document, and tend to use the same sets of fonts everywhere).

It's kind of limited since you only get to choose the font family and not other properties of the font such as the font size (although these have different hotkeys and you could use something like AutoHotkey to create a single hotkey that just calls the other hotkeys).