我想知道是否有办法将 .sty
文件的内容直接放入 LaTeX 的 .tex
文件中。我的 myfile.sty
文件中有一些 (TeX?) 宏定义,我希望能够将它们直接集成到我的 LaTeX 文件中,而不是保留在一个单独的包中并使用 \usepackage{myfile}
加载它们。是否有这样的方法?
通常情况下,你可以直接将你的.sty
文件的内容复制到你的文档中。
注释掉任何特定于包的内容,比如\ProvidesPackage{myfile}
如果你的包在宏名称中使用了@
,你需要用\makeatletter ... \makeatother
进行包装
\documentclass{article}
\makeatletter
%\ProvidesPackage{myfile}
\newcommand{\foo}{bar}
\makeatother
\begin{document}
\foo
\end{document}
\makeatletter
和\makeatother
正是我在寻找的魔法。原来使用@符号进行谷歌搜索效果出奇的低效... - user3004015