我对编写类文件了解不多,但正如我在论坛其他地方提到的,我正在尝试为 SAE 编写一个。我当前的类文件仅支持 10pt 字体大小作为 \normalsize。使用各种字体大小命令(从 \tiny 到 \Huge),我可以达到 5、7、8、9、10、12、14.4、17.28、20.74 和 24.88。
理想情况下,我希望我的 \normalsize 字体为 9pt(这是 SAE 论文的正文字体大小),但我需要 7、8、9、10、11、12 和 15pt 字体。
我的问题是,我该如何实现这一点?我在论坛上查看了许多有关自定义字体缩放的页面,但还是有点困惑。
LaTeX 手册对此没有太多说明:http://svn.gna.org/viewcvs/查看/latexrefman/trunk/latex2e.html#字体大小
我原本想遵循 amsart.sty 模板,但不确定要包含多少内容。我是否应按以下方式为每个尺寸定义特定的点尺寸:?
\renewcommand\normalsize{\@xsetfontsize\normalsize 6%
\@adjustvertspacing \let\@listi\@listI}
\DeclareRobustCommand{\Tiny}{\@xsetfontsize\Tiny 1}
\DeclareRobustCommand{\tiny}{\@xsetfontsize\tiny 2}
\DeclareRobustCommand{\SMALL}{\@xsetfontsize\SMALL 3}
\DeclareRobustCommand{\Small}{\@xsetfontsize\Small 4%
\@adjustvertspacing
\def\@listi{\topsep\smallskipamount \parsep\z@skip \itemsep\z@skip
\leftmargin=\leftmargini
\labelwidth=\leftmargini \advance\labelwidth-\labelsep
}%
}
\DeclareRobustCommand{\small}{\@xsetfontsize\small 5\@adjustvertspacing}
\def\footnotesize{\Small}
\def\scriptsize{\SMALL}
\DeclareRobustCommand{\large}{\@xsetfontsize\large 7\@adjustvertspacing}
\DeclareRobustCommand{\Large}{\@xsetfontsize\Large 8\@adjustvertspacing}
\DeclareRobustCommand{\LARGE}{\@xsetfontsize\LARGE 9}
\DeclareRobustCommand{\huge}{\@xsetfontsize\huge{10}}
\DeclareRobustCommand{\Huge}{\@xsetfontsize\Huge{11}}
\def\@xsetfontsize#1#2{%
\chardef\@currsizeindex#2\relax
\edef\@tempa{\@nx\@setfontsize\@nx#1%
\@xp\ifcase\@xp\@currsizeindex\@typesizes
\else{99}{99}\fi}%
\@tempa
}
\DeclareOption{9pt}{\def\@mainsize{9}\def\@ptsize{9}%
\def\@typesizes{%
\or{5}{6}\or{5}{6}\or{6}{7}\or{7}{8}\or{8}{10}%
\or{9}{11}% normalsize
\or{10}{12}\or{\@xipt}{13}\or{\@xiipt}{14}%
\or{\@xivpt}{17}\or{\@xviipt}{20}}%
\normalsize \linespacing=\baselineskip
}
在我开始深入研究一个我完全不了解的领域之前,我希望得到一些在这个领域有更多经验的人的指导......我真的希望能够让班级默认为以下大小:
- 脚注大小 = 7pt
- 小 = 8pt
- 正常大小 = 9pt
- 大 = 10pt
- 大 = 11pt
- 大号 = 12pt
- 巨大 = 15pt
如果你仔细查看我的类文件,它基于文章类,其中包含以下内容:
\LoadClass[twocolumn]{article}
\ExecuteOptions{times,letter,10pt}
\ProcessOptions
但是,更改 \ExecuteOptions 中的 10pt 对我的文档没有任何作用......
这是一个 MWE,它使用我当前的(有点糟糕的)类文件(类文件可在下面下载)打印出我当前的字体大小:
\documentclass[letterpaper]{saeRyan}
\makeatletter
\newcommand\thefontsize[1]{{#1 The current font size is: \f@size pt\par}}
\makeatother
\begin{document}
\thefontsize\tiny
\thefontsize\scriptsize
\thefontsize\footnotesize
\thefontsize\small
\thefontsize\normalsize
\thefontsize\large
\thefontsize\Large
\thefontsize\LARGE
\thefontsize\huge
\thefontsize\Huge
\end{document}
当前状态的类文件可以在这里找到: https://drive.google.com/file/d/0B6FxKnpluKC4NjU1TzNuZTFEWEE/view?usp=sharing
答案1
我解决这个问题的方法是首先将我的 SAE 类文件的基类从 article 更改为 extarticle:
% The extarticle class allows for 9 pt font as the normalsize font.
\LoadClass[twocolumn,9pt]{extarticle}
这解决了我需要的大多数字体大小问题,并允许我使用 9 pt 字体作为\normalsize
文档中的字体。对于无法通过常规字体大小命令获得的字体,我按以下方式定义了两个额外的字体大小:
% Define two additional exact font sizes to meet SAE guidelines. These font sizes are not included as part of the extarticle class, so we define them here. A 15pt font (baseline skip = 15*1.2 = 18), and an 11 pt font (baseline skip = 11*1.2 = 13.2). The general rule of thumb is that the baseline skip is 1.2 times the font point size. We will need to use \SAEtitlesize in the title definition, and SAEheadtwosize in the \subsection{} definition (heading level 2).
\newcommand\SAEtitlesize{\@setfontsize\SAEtitlesize{15pt}{18}}
\newcommand\SAEheadtwosize{\@setfontsize\SAEtwohead{11pt}{13.2}}
% A note about font sizes in this class: The class is based off the extarticle class, which supports 8-20pt font sizes as the default. Here we select 9pt fonts as the default \normalsize font. Thus in the SAE document class you will get the following font point sizes for each latex fontsize command:
% \tiny: 5 pt
% \scriptsize: 6 pt.
% \footnotesize: 7 pt. SAE asks that text inside tables is 7 pt. Use \footnotesize before tables for this.
% \small: 8 pt. SAE asks for caption fonts to be 8 pt. Use \small for captions.
% \normalsize 9 pt. This should be the standard fontsize for the text body, as well as for 4th level headings (in bold/italic). This should also be the size of the paper number at the top of the page (in bold), and the size of the nomenclature/definitions/abbreviations at the end of the paper.
% \large 10 pt. This should be the size of 3rd level headings (in bold, \subsubsection{}), and the affiliations
% \Large 10.95 pt.
% \SAEheadtwosize 11 pt. This custom font size should be the size of Heading level 2 (subsection{})
% \LARGE 12 pt. This should be the size of the author list (in bold), and all 1st level headings (in bold), including abstract, introduction, body headings, summary, references, contact info, acknowledgements, definitions/abbreviations, and the appendix heading.
% \huge 14.4 pt.
% \SAEtitlesize 15 pt. This custom font size should be the size of the title.
% \Huge 17.28 pt.