-
打酱油路过-
latex在线编辑试一下? https://www.overleaf.com/ -
Mac下配置LaTeX + Sublime Text +skim or mac自带预览
- 下载MacTex,完整安装包4GB左右
https://www.tug.org/mactex/
2. 下载文本编辑器Sublime Text
https://www.sublimetext.com/
2.1 在Sublime Text中安装package Control,网上很多教程
2.2 在Sublime Text里Command+Shift+P调出命令窗口,输入Install,之后选择LaTexTools, 我的因为已经安装过了,所以没有下面的选项,
3.下载skim, PDF阅读器,可以实时编译,有点类似overleaf在线一样的效果,设置同步,如下图。
https://skim-app.sourceforge.io/
至此,英文环境就没问题了。
在sublime中 工具- 编译系统-选择LaTeX
然后 command+B即可编译
效果如下
- 中文环境
***下面中文环境的配置仅仅简单测试过,平时不会使用中文LaTeX环境, 仅供参考
打开terminal 输入如下命令,tlmgr 是MacTex的包管理工具,顺手安装一下ctex的包
sudo tlmgr update --self sudo tlmgr install latexmk sudo tlmgr install ctex
然后在Sublime中,Preferences——Package Settings——LaTeXTools——Reconfigure LaTeXTools and migrate settings重建配置文件),在builder-settings下面新增两项配置:
"program" : "xelatex", "command" : ["latexmk", "-cd", "-e", "$pdflatex = 'xelatex -interaction=nonstopmode -synctex=1 %S %O'", "-f", "-pdf"],
简易的中文设置: 在tex文件前加上如下代码:
%!TEX program = xelatex %!TEX TS-program = xelatex %!TEX encoding = UTF-8 Unicode
使用ctex包
\usepackage[UTF8]{ctex}
- 测试
随便选了一个中文模板,中间会要求下载字体。
https://www.latexstudio.net/archives/51626.html
清华的LaTeX模版编译总会提示Error,错误Log如下
[Compiling /Users/xxxxxxxx/Downloads/thuthesis-master/thuthesis-example.tex] TraditionalBuilder: Your custom command does not allow the engine to be selected Invoking latexmk... done. Errors: /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Package fontspec Error: The font "Kaiti SC Regular" cannot be found. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Package fontspec Error: The font "Kaiti SC Regular" cannot be found. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Cannot use \XeTeXfeaturename with nullfont; not an AAT or Graphite font. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Cannot use \XeTeXisexclusivefeature with nullfont; not an AAT or Graphite font. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Cannot use \XeTeXselectorname with nullfont; not an AAT or Graphite font. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Cannot use \XeTeXfeaturename with nullfont; not an AAT or Graphite font. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Cannot use \XeTeXisexclusivefeature with nullfont; not an AAT or Graphite font. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Cannot use \XeTeXselectorname with nullfont; not an AAT or Graphite font. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Missing \endcsname inserted. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Missing \endcsname inserted. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: LaTeX Error: Missing \begin{document}. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Extra \endcsname. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Package fontspec Error: The font "Kaiti SC Bold" cannot be found. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Package fontspec Error: The font "Kaiti SC Bold" cannot be found. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Cannot use \XeTeXfeaturename with nullfont; not an AAT or Graphite font. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Cannot use \XeTeXisexclusivefeature with nullfont; not an AAT or Graphite font. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Cannot use \XeTeXselectorname with nullfont; not an AAT or Graphite font. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Cannot use \XeTeXfeaturename with nullfont; not an AAT or Graphite font. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Cannot use \XeTeXisexclusivefeature with nullfont; not an AAT or Graphite font. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Cannot use \XeTeXselectorname with nullfont; not an AAT or Graphite font. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Missing \endcsname inserted. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Missing \endcsname inserted. [\thu@set@cjk@font] /usr/local/texlive/2021/texmf-dist/tex/latex/thuthesis/thuthesis.cls:1019: Extra \endcsname. [\thu@set@cjk@font] Warnings: /Users/xxxxxx/Downloads/thuthesis-master/data/appendix.tex: LaTeX Warning: `h' float specifier changed to `ht'. /Users/xxxxxxx/Downloads/thuthesis-master/thuthesis-example.log:1: Double-click here to open the full log. [Done!]
- 如果不想使用Skim的话,可以在LatexTools中做如下设置
在Settings中的第487行,将"viewer": "",改为"viewer": "preview",这个操作会让你在Sublime Text3中build完.tex后自动弹出预览(preview),以便检查PDF文件。
- 下载MacTex,完整安装包4GB左右
-
-
@chengan-wang 没有,这是用Adobe AI做的
-
@chengan-wang 理解起来怎么样
-
提醒读者: 因近期图床地址变动,以上贴子中的图片可能失效,这里附上我个人博客中的相应页面(可以正常浏览),以供后来者参考:写给工程技术人员的 LaTeX 安装指南