Is there a way to stop PowerPoint or macOS from converting double-dashes ("--") to em dashes ("—")? Context: I am using a text box in a slide in PowerPoint for Mac v16.78 on a MacBook Pro running macOS Sonoma 14.0. Sometimes I need to write sample shell code with flags (each led by "--") in PowerPoint text boxes, and this feature ruins the flags.
A similar question was asked years ago in this thread, but the macOS has changed, and the remedies discussed in this thread don't seem to work in this context.
The remedies I have tried unsuccessfully to date:
- In PowerPoint, disabled all AutoCorrect features
- In PowerPoint, entered "--" as a replacement for "--"
- In PowerPoint, entered "--" as a replacement for "—"
- Under macOS System Settings > Keyboard > Text Replacements, set Replace "--" with "--"; tried "--" as a replacement for "—"; also tried no replacements at all
- Under macOS System Settings > Keyboard > All Input Sources (currently "U.S." English), disabled "Correct spelling Automatically" and "Use smart quotes and dashes"
- In PowerPoint and macOS, tried designating "--" as a replacement for alternate text (for example, "++"), but replacement doesn't happen
The main work-around I have found to date is using command+Z to undo each text substitution right after it happens. Also, you can draft the text in a text editor and then paste it into a slide all at once, but there must be a better way.
Update 1: I learned that running defaults --help
in Terminal provides some information about reading and writing (resetting) current default settings. ChatGPT-4 contributed the following code to identify which domains include a setting related to dash substitution:
# Loop through each domain
for domain in $(defaults domains | tr ',' '\n'); do
# Check if the domain contains settings related to dash substitution
result=$(defaults read "$domain" 2>/dev/null | grep -i 'dashsubstitution')
if [ ! -z "$result" ]; then
echo "Domain: $domain"
echo "$result"
echo "-------------------------"
fi
done
In my case, this returned four settings:
Domain: com.ampl.ide.rcp.product
NSAutomaticDashSubstitutionEnabled = 0;
-------------------------
Domain: com.apple.iBooksX
TSWPAutomaticDashSubstitution = 1;
-------------------------
Domain: com.apple.iChat.inputLine
automaticDashSubstitutionEnabled = 0;
-------------------------
Domain: org.tempel.findanyfile
NSAutomaticDashSubstitutionEnabled = 0;
-------------------------
The general format for changing these is as follows:
defaults write [Domain] [Key] [Value]
So you could change a setting like this (setting the boolean value to true ("1") or false ("0"), as needed). Of course, you should take note of the initial setting before changing anything.
defaults write com.apple.iBooksX TSWPAutomaticDashSubstitution -bool false
Running the code above changed the targeted setting as expected, but it did not solve the underlying issue of uncommanded em dash substitution. The following commands work individually for searching a relevant domain for settings using certain keywords, but it appears to me the behavior I am seeing has been hard-coded into PowerPoint.
defaults read com.microsoft.Powerpoint | grep -i 'dash'
defaults read com.microsoft.Powerpoint | egrep -iR 'dashsub'
I am still looking for a fix.
This problem has been reported to Microsoft through PowerPoint using Help > Feedback, which you could do as well if you would like to support a product update.
--
?