LaTex字体属性
在LaTex中,一个字体有五种属性:
(1)字体编码:
正文字体编码:OT1、T1、EU1等
数学字体编码:OML、OMS、OMX等
(2)字体族:
罗马字体:笔划起始处有装饰
无衬线字体:笔划起始处无装饰
打字机字体:每个字符宽度相同,又称等宽字体
%字体族设置(罗马字体,无衬线字体,打字机字体)
\textrm{Roman Family}\quad
\textsf{Sans Serif Family}\quad
\texttt{Typewriter Family}
%或者用大括号进行分组,限定声明作用的范围与上面等价,声明后,其后格式一直不变,直到下一个声明出现
{\rmfamily Roman Family}\quad
{\sffamily Sans Serif Family}\quad
{\ttfamily Typewriter Family}
\sffamily who are you?
\ttfamily what can you achieve?
编译结果:
(3)字体系列:
粗细:
宽度:
%字体系列设置
\textmd{Medium Series}\quad
\textbf{Boldface Series}
{\mdseries Medium Series}\quad
{\bfseries Boldface Series}
编译结果:
(4)字体形状:
直立:
斜体:
伪斜体:
小型大写:
%字体形状(直立、斜体、伪斜体、小型大写)
\textup{Upright Shape}\quad
\textit{Italic Shape}\quad
\textsl{Slant Shape}\quad
\textsc{Small Caps Shape}
{\upshape Upright Shape}\quad
{\itshape Italic Shape}\quad
{\slshape Slant Shape}\quad
{\scshape Small Caps Shape}
编译结果:
在document中添加\documentclass[AutoFakeBold]{article}
,即可解决汉字不加粗的问题
%中文字体
{\songti 宋体}\quad{\heiti 黑体}\quad{\fangsong 仿宋}\quad{\kaishu 楷书}
中文字体的\textbf{粗体}与\textit{斜体}
编译结果:
(5)字体大小:
%字体大小\\为换行符
{\tiny hello}\\
{\scriptsize hello}\\
{\footnotesize hello}\\
{\small hello}\\
{\normalsize hello}\\
{\large hello}\\
{\Large hello}\\
{\LARGE hello}\\
{\huge hello}\\
{\Huge hello}\\
编译结果:
完整代码:
% 导言区,进行全局设置
\documentclass[AutoFakeBold]{article}
% 导入中文宏
\usepackage{ctex}
% 正文区
\begin{document}
%字体族设置(罗马字体,无衬线字体,打字机字体)
\textrm{Roman Family}\quad
\textsf{Sans Serif Family}\quad
\texttt{Typewriter Family}
%或者用大括号进行分组,限定声明作用的范围与上面等价,声明后,其后格式一直不变,直到下一个声明出现
{\rmfamily Roman Family}\quad
{\sffamily Sans Serif Family}\quad
{\ttfamily Typewriter Family}
\sffamily who are you?
\ttfamily what can you achieve?
%字体系列设置
\textmd{Medium Series}\quad
\textbf{Boldface Series}
{\mdseries Medium Series}\quad
{\bfseries Boldface Series}
%字体形状(直立、斜体、伪斜体、小型大写)
\textup{Upright Shape}\quad
\textit{Italic Shape}\quad
\textsl{Slant Shape}\quad
\textsc{Small Caps Shape}
{\upshape Upright Shape}\quad
{\itshape Italic Shape}\quad
{\slshape Slant Shape}\quad
{\scshape Small Caps Shape}
%中文字体
{\songti 宋体}\quad{\heiti 黑体}\quad{\fangsong 仿宋}\quad{\kaishu 楷书}
中文字体的\textbf{粗体}与\textit{斜体}
%字体大小\\为换行符
{\tiny hello}\\
{\scriptsize hello}\\
{\footnotesize hello}\\
{\small hello}\\
{\normalsize hello}\\
{\large hello}\\
{\Large hello}\\
{\LARGE hello}\\
{\huge hello}\\
{\Huge hello}\\
\end{document}
完整结果图: