LATEX cls模版文件编写(一)
LATEX模版编写
排版常用命令
单位
- in - 英寸(inch)
- mm - 毫米(millimeters)
- cm - 厘米(centimeters)
- pt - points (大约 1/72 inch)
- em - 接近当前字体的字符 “M”的宽度(approximately the width of an “M” in the current font)
- ex - 接近当前字体的字符 “x”的高度approximately the height of an “x” in the current font
水平距离
- hspace{}
垂直距离
- vspace{}
设置变量参数
% 实际例子
% 定义命令
\DeclareRobustCommand{\nsmajorc}{}
\DeclareRobustCommand{\nsmajore}{}
\DeclareRobustCommand{\nsmajor}[2]{
\renewcommand{\nsmajorc}{#1}
\renewcommand{\nsmajore}{#2}
}
%调用
\nsmajor{XXXXX}{YYYY}
%此时\nsmajorc则代表XXXXX,nsmajore代表YYYY
正文字体设置
- 衬线字体(mainfont)
- 无衬线字体 (sansfont)
- 等宽字体(monofont)
```Tex
%%% 用来设置英文字体
\setmainfont{TeX Gyre Termes} %相当于MS Word中的Times new Roman。
\setsansfont{TeX Gyre Heros} %相当于MS Word中的Helvetica。
\setmonofont{TeX Gyre Cursor} %相当于MS Word中的Curier。
%%% 设置中文字体
\setCJKsansfont{Adobe Heiti Std}
\setCJKmonofont{Adobe Song Std}
%%中文字体加粗斜体这些都需要单独定义。BoldFont表示加粗,ItalicFont表示斜体
\setCJKmainfont[BoldFont={Adobe Heiti Std}, ItalicFont={Adobe Kaiti Std}]{Adobe Fangsong Std}
%使用\let\XXXX\relax可以让XXXX命令失效,然后再重新定义
\let\songti\relax
% [AutoFakeBold]可以实现自动加粗
\newCJKfontfamily\songti{Adobe Song Std}[AutoFakeBold]
```