4

I wish to be able to type `simple code` in between backticks as shown, and have Word automatically change the font to some monospace variant.

I am aware of alternatives such as LaTeX, but would like to use Word for this if possible.

2
  • I don't think it'd be possible through standard options. One workaround can be to use find and replace from time to time, another one is to write a macro. Jan 18, 2016 at 20:29
  • Do you have backticks anywhere else besides where you want this to happen? You could have an event macro do it, but an errant backtick would be pretty disastrous. Apr 20, 2017 at 19:59

2 Answers 2

1

In MS Word you can use Search and Replace with wildcards like in the picture. Of course, the replacement does not occur automatically as you type, but maybe you're happy to do the formatting explicitly by executing the Search&Replace. enter image description here

3
  • 1
    Thanks for the answer. How would you convert it to monospace? Would the search and replace highlight all the instances, and then just change the formatting?
    – enigma
    Jun 29, 2019 at 15:34
  • It's already there: Replace|Format is set to Courier New (which is a monospace font), so the part between the backticks will be formatted to be CourierNew and hence be monospace. When you click "Alle Ersetzen / Replace All" Search&Replace will do replacements on all found instances. Therefore, you may want to modify the SearchRange ("Suchen / Search") to "Gesamt / All" instead of "Nach unten / Downwards".
    – Traveler
    Jun 29, 2019 at 16:40
  • Ahh cool. While it would be nice to have it automatically formatted as I type, I'll accept the answer because I imagine it's as close as possible. Cheers!
    – enigma
    Jun 29, 2019 at 16:51
1

The closest workaround I know is to make a new character style you can apply by hitting "Ctrl+1" and turn off by hitting "Ctrl+Space".

  • Open the Styles Pane and click New Style.
  • Make a Character style with monospace font.
  • Click Format, Shortcut key and set to Ctrl+1.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .