如何在 OSX 上安装 LaTeX .sty 文件?
我设置了一个 LaTeX 项目:
tex/
- documents/
- some_file.tex
- support/
- todonotes.sty
其中 some_file.tex
使用 todonotes
:
\usepackage[colorinlistoftodos,textwidth=0.9\marginparwidth]{todonotes}
但是当我尝试构建时,我收到“LaTeX 错误:文件`todonotes.sty' 未找到” TextMate 中的 PDF。如何向 LaTex 或 TextMate 告知我的 .sty 文件?
稍后
具体来说,我使用的是 MacPorts 中的 tetex
,尽管给出了到目前为止的答案,我可能会尝试其他发行版。
I have a LaTeX project set up:
tex/
- documents/
- some_file.tex
- support/
- todonotes.sty
where some_file.tex
uses todonotes
:
\usepackage[colorinlistoftodos,textwidth=0.9\marginparwidth]{todonotes}
But I get "LaTeX Error: File `todonotes.sty' not found" when I try to build the PDF in TextMate. How do I tell LaTex or TextMate about my .sty file?
Later
To be specific, I'm using tetex
from MacPorts, though given the answers so far, I might try another distribution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
在 Mac OS X (Snow Leopard 10.6.7) 中,将
.sty
文件放入,然后运行
texhash
命令。不要忘记保持 root 用户身份(例如 sudo -s )In Mac OS X (Snow Leopard 10.6.7) put your
.sty
file inThen, run
texhash
command. Don't forget to stay as a root user (likesudo -s
)或者,您可以将样式文件放在与文档相同的目录中,而不是放在“support”中。现在...如果您使用的是 OS X,您可能应该使用 texlive 2008。如果您使用的是 texlive 2008,请弹出打开终端并键入:
将“todonotes”替换为您要安装的软件包名称。
Or you can just put the style file in the same directory as your document instead of in "support." now... if you're on OS X, you should probably be using texlive 2008. If you are using texlive 2008, pop open a terminal and type:
replace "todonotes" with the package name you want to install.
您可以将样式文件放在
~/texmf/tex/
中,标准 LaTeX 发行版应该可以找到它们。如果您喜欢在系统范围内安装它们,可以将它们放在 LaTeX 安装中相应的 texmf/tex 文件夹中(OS X 上的安装位置根据您使用的 LaTeX 发行版而有所不同) 。您可以在命令行中使用 tlmgr conf 来列出所有发行版配置信息。
TEXMFHOME
变量给出 texmf 树的路径。You can put style files in
~/texmf/tex/
and standard LaTeX distributions should find them. If you prefer to install them system-wide, you can put them in the correspondingtexmf/tex
folder within your LaTeX installation (the location of this installation on OS X varies depending on which LaTeX distribution you used).You can use
tlmgr conf
at the command line to list all of the distribution configuration information. TheTEXMFHOME
variable gives the path to your texmf tree.如前所述,只需将自定义
.sty
放入~/texmf/tex
或/usr/share/texmf-texlive/tex/
中,但是不要忘记运行mktexlsr
或texhash
来更新 LaTeX 的本地包数据库。否则 LaTeX 根本找不到它,除非它与处理的文件位于同一目录中。As said before just put the custom
.sty
into~/texmf/tex
or in/usr/share/texmf-texlive/tex/
but don’t forget to runmktexlsr
ortexhash
to update the local package database of LaTeX. Otherwise LaTeX won’t find it at all, unless it is in the same directory of the processed file.我使用 BasicTex 2015 遇到了这个问题,以上方法都没有解决它,所以我写了一个 解决方案在这里
简而言之:
sudo tlmgr install preprint
将修复它,kpsewhich fullpage.sty
将确认修复I had this issue using BasicTex 2015 and none of the above solved it, so I wrote up a solution here
In short:
sudo tlmgr install preprint
will fix it andkpsewhich fullpage.sty
will confirm the fix有关 LaTeX 包的此页面 表示您需要安装
LaTeX安装目录下的.sty
文件(我的Ubuntu安装好像是/usr/share/texmf-texlive/tex/latex/
),或者需要有一份包含 LaTeX 源代码的每个文件中的.sty
文件——即至少在你的tex/documents
文件夹中。This page on LaTeX packages says you'll need to install the
.sty
file in the LaTeX installation directory (my installation of Ubuntu seems to be/usr/share/texmf-texlive/tex/latex/
), or you need to have a copy of the.sty
file in each file containing LaTeX source -- i.e. in yourtex/documents
folder, at the very least.我尝试了这个,它对我有用:
sudo apt-get install texlive-full
。I tried this one it is works for me:
sudo apt-get install texlive-full
.