字体属性

通过命令声明可设置字体

\documentclass{article}
\title{title}
\usepackage{ctex}

\begin{document}
	
	% 字体族设置(罗马字体、无衬线字体、打字机字体)
	\textrm{Roman Family}
	\textsf{San Serif Family} % 无衬线字体
	\texttt{Typewriter Family} % 打字机字体
	
	\rmfamily Roman Family % 此为声明方式设置字体,方式二选一
	{\sffamily San Serif Family} % 此处大括号表示限制分组,说明字体声明的作用范围
	\ttfamily Typewriter Family
	
	% 示例:
	% 表示从这里开始都是无衬线字体
	\sffamily who you are? you find self on everyone around. 
	
	Take you as the same as others!
	
	% 括号内的是打印机字体
	{\ttfamily Are you wiser than other? definitely No. In some ways, may it is true. What can you achieve? Aluxurious house? A brillilant car? An admirable career? who knows?}
	
	
	% 字体系列设置(粗细、宽度)
	\textmd{Medium Series}  \textbf{Boldface Series}
	{\mdseries Medium Series} {\bfseries Boldface Series}
	
	
	% 字体形状(直立、斜体、伪斜体、小型大写)
	\testup{Upright Shape}  \textit{Ittalic Shape}
	\textsl{Slanted Shape}  \textsc{Small Caps Shape}
	{\upshape Upright Shape} {\itshape Italic Shape}
	{\slshape slanted shape} {\scshape Caps Shape}
	
	% 中文字体
	{\songti 宋体} \quad{\heiti 黑体} \quad{\fangsong 仿宋}
	\quad {\kaishu 楷书}
	% 要使用 \usepackage{ctex},否则无法使用中文的相关设置
	
	中文字体的\textbf{粗体}与\textit{斜体}
	% 对于中文,粗体是用黑体表示,斜体是用楷书表示
	
	
	% 字体大小
	% 字体大小是通过一系列声明实现的。这些声明是与normal size相对的大小
	% normal size的大小是由文档类的参数控制的
	% \documentclass[10pt]{article}
	% normal size一般只有10、11、12磅
	{\tiny hello}\\
	{\scriptsize hello}\\
	{\foornotesize hello}\\
	{\small hello}\\
	{\normalsize hello}\\
	{\large hello}\\
	{\LARGE hello}\\
	{\huge hello}\\
	{\HUGE hello}\\
	
	% 中文字号设置命令
	\zihao{-0}你好!
	% 参数-0表示小初号,也可以改成5号等
	
\end{document}

输出如下:

image.png

image.png

image.png

image.png

\documentclass{article}
\title{title}
\usepackage{ctex}
\newcommand{\myfont}{\textit{\textbf{\textsf{Fancy Text}}}}
% 如果我们想取消斜体,就去掉\textit{}即可

\begin{document}
\zihao{5} 你好!

\myfont

\end{document}