macOS下Vscode中LaTeX格式化錯誤
阿新 • • 發佈:2022-04-18
! https://zhuanlan.zhihu.com/p/451898704
macOS 下 vscode 中 LaTeX 格式化錯誤
問題描述
在 VS Code 中安裝 LaTeX Workshop 外掛後,如果按command + s
儲存,會出現如下報錯。
Formatting failed. Please refer to LaTeX Workshop Output for details.
解決方法
- 關閉 LaTeX Workshop 的程式碼格式化功能
在setting.json
中將“editor.formatOnSave:”
改為false
- 自動格式化LaTeX程式碼(推薦)
在終端依次執行以下命令
sudo /usr/bin/cpan5.18 Unicode::GCString
sudo /usr/bin/cpan5.18 App::cpanminus
sudo /usr/bin/cpan5.18 YAML::Tiny
sudo /usr/bin/perl5.18 -MCPAN -e 'install "File::HomeDir"'
sudo cpan Log::Log4perl
sudo cpan Log::Dispatch
在終端中使用which latexindent
檢視所在位置,開啟setting.json
新增配置,指明latexindent
的安裝路徑。
"latex-workshop.latexindent.path": "latexindent所在路徑",