[LaTeX Tutorial]
03. LaTeX font size setting
In LaTeX, a font has 5 properties, namely:
Font Encoding: Body Font Encoding, Math Font Encoding
Font Family: Roman, Sans Serif, Printer Font
Family: Weight, Width
Font Shape: Upright, Italic, Pseudo-Italic, Small Caps
Font Size: Small Medium Large, etc.
Font family (roman, sans serif, printer font)
Use the font family setting command here
font family | set content |
---|---|
roman font | \textrm{xx} |
sans serif font | \textsf{x} |
printer font | \texttt{xx} |
\documentclass{
article}
\begin{
document}
%\maketitle % 让导言区设置的title生成
\textrm{
\Huge XXX} % textrm设置为罗马字体罗马字体
\textsf{
\Huge XXX} % textsf设置为无衬线字体
\texttt{
\Huge XXX} % texttt设置为打印机字体
\end{
document}
font declaration
\rmfamily applies to the following text
{\rmfamily} only applies to the text inside {}
Sans serif fonts, printer fonts are also set as above
font weight, width
Use \textbf
or \bfseries
can bold the font
md is medium according to the literal meaning, bf bold font
\documentclass{
article}
% 正文区
\begin{
document}
\textmd{
aa}
\textbf{
aa} % 字体加粗
{
\mdseries aa}
{
\bfseriesaa} % 字体加粗
\end{
document}
Font Upright, Italic, Pseudo-Italic, Small Caps
% 导言区
\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}
renderings
font size
global pattern
In the introduction area
at the beginning of the document, set the font size of the entire article, such as: 12pt
\documentclass[12pt]{
article}
local mode
The commands to set the font size from small to large are:
\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}