XeLaTeX ファイルにいくつかの初期化コードがあり、将来のテキストで再利用できるように別のファイルに入れたいと考えています。XeLaTeX コードを LaTeX クラス ファイルに変換する最速の方法は何ですか?
2619 次
1 に答える
7
プリアンブル コードを.cls
ファイルに入れ、 を使用\documentclass{mydocstyle}
してロードすることができます。ファイル.cls
は次のようになります。
% Declare that this document class file requires at least LaTeX version 2e.
\NeedsTeXFormat{LaTeX2e}
% Provide the name of your document class, the date it was last updated, and a comment about what it's used for
\ProvidesClass{mydocstyle}[2010/09/13 Bluetulip's custom LaTeX document style]
% We'll pass any document class options along to the underlying class
\DeclareOption*{%
\PassOptionsToClass{\CurrentOption}{article}% or book or whatever
}
% Now we'll execute any options passed in
\ProcessOptions\relax
% Instead of defining each and every little detail required to create a new document class,
% you can base your class on an existing document class.
\LoadClass{article}% or book or whatever you class is closest to
% Now paste your code from the preamble here.
% Replace \usepackage with \RequirePackage. (The syntax for both commands is the same.)
% Finally, we'll use \endinput to indicate that LaTeX can stop reading this file. LaTeX will ignore anything after this line.
\endinput
ドキュメント クラス ファイルはさらに複雑になる可能性があることに注意してください ( などのオプションを含めたい場合\documentclass[option]{mydocstyle}
) が、この基本的な形式から始める必要があります。
ファイルを名前を付けて保存し、ファイルmydocstyle.cls
とともに現在のディレクトリに配置し.tex
ます。
LaTeX2e for class and package writers guideも参照してください。これについて詳しく説明します。
于 2010-09-13T19:21:19.553 に答える