You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何阻止PowerPoint for Mac或macOS将双短横线(--)自动转换为长破折号(—)?

如何阻止PowerPoint for Mac或macOS将双短横线(--)自动转换为长破折号(—)?

我完全懂这种困扰——在PPT里写shell命令的双短横线参数时,自动转成em dash真的很破坏代码格式!我在PowerPoint for Mac v16.78(系统是macOS Sonoma 14.0)里也遇到了同样的问题,下面整理了我试过的各种方法、进展,以及临时解决办法:

我试过但无效的常规设置

为了阻止这个自动转换,我挨个试了常规的设置选项,但都没起作用:

  • 在PowerPoint里关闭了所有自动更正功能
  • 在PowerPoint的替换设置中,分别配置--替换为--、—替换为--
  • 在macOS系统设置>键盘>文本替换里,设置--替换为--,甚至清空了所有替换规则
  • 在macOS系统设置>键盘>所有输入源(当前为美式英语)里,关闭了自动更正拼写和使用智能引号和破折号
  • 尝试用替代文本(比如++)替换成--,但替换根本不生效

尝试过的终端配置方法(仍未解决问题)

我还想着通过系统默认配置来调整,于是用终端命令查找所有和破折号替换相关的域设置,用了这段脚本:

# 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

运行后返回了四个相关域的设置:

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;
-------------------------

我尝试修改了iBooksX的自动替换设置(把值改成false):

defaults write com.apple.iBooksX TSWPAutomaticDashSubstitution -bool false

虽然这个设置确实被修改了,但PPT里的自动转换问题依然存在。我还专门检查了PowerPoint自身的域配置:

defaults read com.microsoft.Powerpoint | grep -i 'dash'
defaults read com.microsoft.Powerpoint | egrep -iR 'dashsub'

但没找到任何和破折号替换相关的配置项,看起来这个自动转换可能是PowerPoint本身硬编码的行为。

当前可用的临时解决办法

目前我找到两个能勉强应付的临时方案:

  • 每次输入--被转成—后,立刻按Command+Z撤销替换
  • 先在纯文本编辑器里写好带--的代码内容,再一次性粘贴到PPT的文本框里

后续建议

我已经通过PowerPoint的「帮助>反馈」把这个问题提交给微软了,如果你也受这个问题困扰,建议也去提交反馈,这样能推动微软在后续更新里修复这个问题。

备注:内容来源于stack exchange,提问作者hackr

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.21 09:54:52