【LaTeX 教程】

03. LaTeX 字体字号设置

在LaTeX中,一个字体有5种属性,分别是:

字体编码:正文字体编码、数学字体编码
字体族:罗马字体、无衬线字体、打印机字体
字体系列:粗细、宽度
字体形状:直立、斜体、伪斜体、小型大写
字体大小:小中大等

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

这里使用字体族的设置命令
字体族设置内容
罗马字体\textrm{xx}
无衬线字体\textsf{x}
打印机字体\texttt{xx}
\documentclass{article}
\begin{document}
	%\maketitle % 让导言区设置的title生成
	\textrm{\Huge XXX} % textrm设置为罗马字体罗马字体
	
	\textsf{\Huge XXX}  % textsf设置为无衬线字体
	
	\texttt{\Huge XXX}  % texttt设置为打印机字体
	
\end{document}

在这里插入图片描述

字体声明

\rmfamily 作用于后段文字
{\rmfamily} 只作用于{}内的文字
无衬线字体,打印机字体同样为上述设置方式

在这里插入图片描述

字体粗细,宽度

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

md按照字面意思来看就是中等,bf加粗字体

\documentclass{article}
% 正文区
\begin{document}
	\textmd{aa}
	
	\textbf{aa}	  % 字体加粗
	
	{\mdseries aa}
	
	{\bfseriesaa}	% 字体加粗		
\end{document}

在这里插入图片描述

字体直立、斜体、伪斜体、小型大写

% 导言区
\documentclass{article}

% 正文区
\begin{document}
\begin{document}
	%\maketitle % 让导言区设置的title生成
	\textup{Hello world by LaTeX}	%直立
	
	\textit{Hello world by LaTeX}	%斜体
	
	\textsl{Hello world by LaTeX}	%伪斜体
	
	\textsc{Hello world by LaTeX}	%小型大写
	%只对{}括号内管用
	
	{\upshape Hello world by LaTeX}%直立
	
	{\itshape Hello world by LaTeX}%斜体
	
	{\slshape Hello world by LaTeX}%伪斜体
	
	{\scshape Hello world by LaTeX}%小型大写粗
	
\end{document}

在这里插入图片描述

效果图

在这里插入图片描述

字体大小

全局模式

在导言区
在文档的开头,有设置整个文章的字体大小,如:12pt

\documentclass[12pt]{article}
局部模式

设置字体大小的命令从小到大为:

\tiny
\scriptsize
\footnotesize
\small
\normalsize
\large
\Large
\LARGE
\huge
\Huge
\documentclass[12pt]{article}
\begin{document}
	%\maketitle % 让导言区设置的title生成
	
	Hello world by LaTeX.
	
	\tiny Hello world by LaTeX.
	
	\scriptsize Hello world by LaTeX.
	
	\footnotesize Hello world by LaTeX.
	
	\small Hello world by LaTeX.
	
	\normalsize Hello world by LaTeX.
	
	\large Hello world by LaTeX.
	
	\Large Hello world by LaTeX.
	
	\LARGE Hello world by LaTeX.
	
	\huge Hello world by LaTeX.
	
	\Huge Hello world by LaTeX.
\end{document}

在这里插入图片描述

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐