LaTeX教程—4.LaTeX的字体字号设置


在LaTeX中,一个字体有5种属性,分别是:
①字体编码:正文字体编码、数学字体编码
②字体族:罗马字体、无衬线字体、打印机字体
③字体系列:粗细、宽度
④字体形状:直立、斜体、伪斜体、小型大写
⑤字体大小

1.字体族(罗马字体、无衬线字体、打印机字体)

使用字体族设置命令

设置内容 备注
\textrm{XXX} {}括号内的内容XXX会设置罗马字体Roman Family
\textsf{XXX} {}括号内的内容XXX会设置无衬线字体Sans Serif Family
\texttt{XXX} {}括号内的内容XXX会设置打印机字体Typewriter
% 导言区
\documentclass{article}

% 正文区
\begin{document}

	\textrm{qwertyuiopasdfghjklzxcvbnm} % textrm设置为罗马字体罗马字体

	\textsf{qwertyuiopasdfghjklzxcvbnm}  % textsf设置为无衬线字体

	\texttt{qwertyuiopasdfghjklzxcvbnm}  % texttt设置为打印机字体

\end{document}

使用字体声明设置

设置内容 备注
{\rmfamily XXX} \rmfamily后面的的内容XXX会设置罗马字体Roman Family
{\sffamily XXX} \sffamily后面的的内容XXX会设置无衬线字体Sans Serif Family
{\ttfamily XXX} \ttfamily后面的的内容XXX会设置打印机字体Typewriter
% 导言区
\documentclass{article}


% 正文区
\begin{document}

	% 字体声明,作用于后面的文本
	\rmfamily qwertyuiopasdfghjklzxcvbnm
	% 通常会使用{}限定作用域
	{\rmfamily qwertyuiopasdfghjklzxcvbnm}

	\sffamily qwertyuiopasdfghjklzxcvbnm

	\ttfamily qwertyuiopasdfghjklzxcvbnm

\end{document}

2.字体系列(粗细、宽度)

使用\textbf或者\bfseries可以对字体进行加粗

% 导言区
\documentclass{article}
\usepackage{xeCJK}

% 正文区
\begin{document}
	\textmd{这是一段文字}
	
	\textbf{这是一段文字}	% 字体加粗
	
	{\mdseries 这是一段文字}
	
	{\bfseries 这是一段文字}	% 字体加粗		
\end{document}

3.字体形状(直立、斜体、伪斜体、小型大写)

% 导言区
\documentclass{article}

% 正文区
\begin{document}
	\textup{Hello world}		%直立
	
	\textit{Hello world}		%斜体
	
	\textsl{Hello world}		%伪斜体
	
	\textsc{Hello world}		%小型大写
	
	
	{\upshape Hello world}  %直立
	
	{\itshape Hello world}  %斜体
	
	{\slshape Hello world}  %伪斜体
	
	{\scshape Hello world}  %小型大写
	
\end{document}

4.字体大小

% 导言区
\documentclass{article}

% 正文区
\begin{document}
	{\tiny Hello world}
	
	{\scriptsize Hello world}
	
	{\footnotesize Hello world}
	
	{\small Hello world}
	
	{\normalsize Hello world}
	
	{\large Hello world}
	
	{\Large Hello world}
	
	{\LARGE Hello world}
	
	{\huge Hello world}
	
	{\Huge Hello world}
	
\end{document}

猜你喜欢

转载自blog.csdn.net/m0_38068876/article/details/113273736
今日推荐