我可以用 LaTeX 而不是 TeX 编写 cls 文件吗?
我在 XeLaTeX 文件中有一些初始化代码,我想将其放入一个单独的文件中,以便我可以在以后的文本中重用它。将 XeLaTeX 代码转换为 LaTeX 类文件的最快方法是什么?
I have some initialization code in a XeLaTeX file which I would like to put into a separate file so that I can reuse it in future texts. What is the fastest way to convert my XeLaTeX code to a LaTeX class file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将前导码放入
.cls
文件中,然后使用\documentclass{mydocstyle}
加载它。您的.cls
文件将如下所示:请注意,文档类文件可能会变得更加复杂(如果您想包含
\documentclass[option]{mydocstyle}
等选项,等),但是这个基本格式应该可以帮助您入门。将文件另存为
mydocstyle.cls
并将其与.tex
文件一起放入当前目录中。您还可以查看LaTeX2e 类和包编写器指南。它将引导您更详细地完成此操作。
You can put your preamble code into a
.cls
file and then use\documentclass{mydocstyle}
to load it. Your.cls
file will look like this:Note that document class files can get much more complicated (if you want to include options like
\documentclass[option]{mydocstyle}
, etc.), but this basic format should get you started.Save your file as
mydocstyle.cls
and put it in the current directory with your.tex
file.You can also take a look at the LaTeX2e for class and package writers guide. It'll walk you through this in more detail.