TL;DR How can you create two substitution rules in Google Docs where one is a prefix of the other?

Details and motivation

In How to create an em dash in Google Documents?, there is an excellent explanation of how to create automatic substitution rules in Google Docs in order to be able to type -- to get an n-dash, or an m-dash, or maybe --- to get an m-dash.

Now, I would like to take this one step further, and have -- automatically replaced by an n-dash, and --- automatically replaced by an m-dash, since I use both of these characters in writing and I want to be able to carefully select the right one at each use.

However, when the -- substitution is enabled, it is triggered too soon and the --- substitution is effectively hidden. Typing the third hyphen triggers the n-dash substitution and it's too late after that to get the m-dash. I've tried adding a rule that maps n-dash+hyphen to m-dash, but that also did not work.

Does anyone know how to solve this? The obvious work-around is to use something different for m-dash, maybe -_, but that's really not intuitive to my LaTeX-trained fingers, so I'm hoping there a way to make the two and three hyphens both work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.