MacTeX添加.sty文件

最新的 T e X 版本为 M a c T e X   2018 ,获取地址:http://www.tug.org/mactex/。其他系统的 L a T e X 可以从这里获取:https://www.latex-project.org/get/

M a c T e X

我直接安装了 M a c T e X   2018 完整版,这里查看一下安装的 L a T e X 的版本信息。

$tex --version

TeX 3.14159265 (TeX Live 2018)
…(此处,省略若干字)…

. s t y 文件位置

因为论文写作时需要使用一些自定义的 . s t y 样式文件,比如 N I P S https://nips.cc/Conferences/2014/PaperInformation/StyleFiles)官网给的 L a T e X 模板中,需要嵌入 n i p s 14 s u b m i t _ e . s t y 样式文件。

一般而言,如果和我安装的版本一致的话, . s t y 文件应该在以下路径下(/usr/local/texlive/2018/texmf-dist/tex/latex)。该路径下,你可以找到常见的 c t e x , a m s m a t h 等样式,不过它们命名上都没有 . s t y 后缀。但对于 U n i x 来说都是文件,命名上无区别。

拷贝 . s t y 样式

找到样式的存储位置就好办了,将自定义 . s t y 样式拷贝进去就完事了。这里由于路径位于 / u s r 目录下,需要使用 s u d o 获取管理员权限,

$sudo mv ~/Desktop/nips14submit_e.sty /usr/local/texlive/2018/texmf-dist/tex/latex 

更新 T e X

拷贝工作完成之后,需要使用 s u d o   t e x t h a s h 命令更新一下,执行时会更新一些配置文件,

$sudo texhash

texhash: Updating /usr/local/texlive/2018/texmf-config/ls-R…
texhash: Updating /usr/local/texlive/2018/texmf-dist/ls-R…
texhash: Updating /usr/local/texlive/2018/texmf-var/ls-R…
texhash: Updating /usr/local/texlive/texmf-local/ls-R…
texhash: Done.

一般到这里就结束了,我这里都是正常运行的。但是,如果你更新之后还提示丢失 . s t y ,可能需要修改一下编辑的 . t e x 内容(比如敲个空格),再重新生成 p d f

References:
[1] How do I add a .sty file to my MacTeX/TeXShop installation? https://tex.stackexchange.com/questions/10252/how-do-i-add-a-sty-file-to-my-mactex-texshop-installation, 2018-07-04


©qingdujun
2018-07-04 于 北京 怀柔

猜你喜欢

转载自blog.csdn.net/u012339743/article/details/80914240