2
文章转载自:VS Code安装LaTex-Workshop

今天打算在mac电脑上安装VS Code的 LaTex-Workshop 插件,用来编辑和预览tex文档。安装期间遇到了坑且网上没有解决方案,故特此记录,希望能对遇到同样问题的网友有帮助。

步骤

  1. 安装MiKTeXLaTex-Workshop 不带tex编译功能,需要tex系列软件支持,本人用的MiKTeX,下载地址:https://miktex.org/download。下载完后打开dmg文件,拖到application文件夹中。安装好后在lauchpad中打开,选择安装模式,推荐全局安装;
  2. 安装LaTex-Workshop插件。在VS Code界面的插件界面中搜索并安装;
  3. 新建一个以.tex结尾的文档,输入测试内容。点击左侧LaTex-Workshop图标,然后点“build LaTex project”。此时右下角会冒出错误提示,在底部面板的 output 选项卡中选择"latex workshop"的输出,可以看到以下错误:

<pre>[11:02:17] Build root file /Users/tlanyan/Desktop/two.tex
[11:02:17] Recipe step 1: latexmk, --max-print-line=10000,-synctex=1,-interaction=nonstopmode,-file-line-error,-pdf,-outdir=/Users/tlanyan/Desktop,/Users/tlanyan/Desktop/two
[11:02:17] LaTeX build process spawned. PID: 55523.
[11:02:17] Recipe returns with error: 1/null. PID: 55523. message: log4cxx: setFile(/Users/tlanyan/Library/Application Support/MiKTeX/texmfs/data/miktex/log/latexmk.log,true) call failed.
log4cxx: IO Exception : status code = 13
log4cxx: No output stream or file set for the appender named [RollingLogFile].
* The program '{name}' could not be found.
</pre>

  1. LaTex-Workshop的issue中没找到类似错误。尝试多种办法后,猜测是权限问题,于是用如下命令解决:sudo chmod -R 777 ~/Library/Application\ Support/MiKTeX/texmfs/data/
  2. 再次编译文档,一切正常。

参考

  1. https://github.com/James-Yu/L...
  2. https://miktex.org/howto/inst...

tlanyan
1.1k 声望99 粉丝