LaTeX 字体
原 文:Font sizes, families, and styles 译 者:Xovee 翻译时间:2022年11月11日
文章目录
LaTeX 字体介绍字号(字体大小)字体字体样式汇总参考指南字体大小默认的字体家族字体样式
延伸阅读
介绍
LaTeX会自动为不同的文档内容选择恰当的字体和字号,例如正文和标题的字体大小是不一样的。当然,你也可以自定义文档各部分的字体。
下面的例子介绍了如何使用LaTeX中定义的最小字号(\tiny)以及Small Cap字体样式(\textsc{...}):
This is a simple example, {\tiny this will show different font sizes} and also \textsc{different font styles}.
字号(字体大小)
字号一般由特殊的名字定义,它们的大小并不绝对,而是文档默认字体大小的相对值(在\documentclass声明中定义)。
在下面的例子中,{\huge huge font size}命令将大括号中的文字设置为huge字号(超大字号)。LaTeX中定义的字号名称请见文末。
In this example the {\huge huge font size} is set and
the {\footnotesize Foot note size also}. There's a fairly
large set of font sizes.
字体
默认情况下,LaTeX一般使用罗马衬线字体(Roman serif font)。你也可以使用其他类型的字体,例如非衬线字体或者等宽字体:
In this example, a command and a switch are used.
\texttt{A command is used to change the style
of a sentence}.
\sffamily
A switch changes the style from this point to
the end of the document unless another switch is used.
上面的例子中使用了等宽字体命令(\texttt{...})和一个非衬线字体转换命令(\sffamily)。转换命令会将命令之后的文字变为命令所指定的字体。
你也可以将非衬线字体作为文档的默认字体:
\renewcommand{\familydefault}{\sfdefault}
类似地,将罗马字体作为默认字体的命令为:
\renewcommand{\familydefault}{\rmdefault}
字体样式
LaTeX文档中最常用的字体样式有三种:粗体、斜体和下划线。当然,还有一些其他类型的字体样式。
在下面的例子中,我们使用\textsl命令将文字设置为slanted样式(一种类似于斜体,但是不完全一样的样式)。文末列出了更多可用的字体样式。
Part of this text is written \textsl{in a different
font style} to highlight it.
如果你想使用正常字体样式,使用\textnormal{...}命令或者\normalfont字体样式转换命令。
汇总
下面的例子汇总了本文所介绍的与字体有关的命令:
\documentclass{article}
\begin{document}
%Example of different font sizes and types
This is a simple example, {\tiny this will show different font sizes} and also \textsc{different font styles}.
\vspace{1cm}
%Example of different font sizes and types
In this example the {\huge huge font size} is set and the {\footnotesize Foot note size also}. There's a fairly large set of font sizes.
\vspace{1cm}
%Example of different font sizes and types
In this example, a command and a switch are used. \texttt{A command is used to change the style of a sentence}.
\sffamily
A switch changes the style from this point to the end of the document unless another switch is used.
\rmfamily
\vspace{1cm}
%Example of different font sizes and types
Part of this text is written \textsl{in different font style} to highlight it.
\end{document}
参考指南
字体大小
从小到大:
\tiny\scriptsize\footnotesize\small\normalsize\large\Large\LARGE\huge\Huge
t
i
n
y
s
c
r
i
p
t
s
i
z
e
f
o
o
t
n
o
t
e
s
i
z
e
s
m
a
l
l
n
o
r
m
a
l
s
i
z
e
l
a
r
g
e
L
a
r
g
e
L
A
R
G
E
h
u
g
e
H
u
g
e
\tiny{tiny}\quad\scriptsize{scriptsize}\quad \footnotesize{footnotesize}\quad \small{small} \quad \normalsize{normalsize} \quad \large{large} \quad \\\Large{Large} \quad \LARGE{LARGE} \quad \huge{huge} \quad \Huge{Huge}
tinyscriptsizefootnotesizesmallnormalsizelargeLargeLARGEhugeHuge
默认的字体家族
字型/字体家族命令转换命令示例serif (roman) 衬线(罗马)\textrm{Xovee 12}\rmfamily
Xovee 12
\textrm{Xovee 12}
Xovee 12sans serif 非衬线\textsf{Xovee 12}\sffamily
Xovee
12
\textsf{Xovee 12}
Xovee 12typewriter (monospace) 等宽\texttt{Xovee 12}\rmfamily
Xovee
12
\texttt{Xovee 12}
Xovee 12
字体样式
样式命令转换命令示例medium 中等\textmd{Xovee 12}\mdseries
Xovee 12
\textmd{Xovee 12}
Xovee 12bold 粗体\textbf{Xovee 12}\bfseries
Xovee
12
\textbf{Xovee 12}
Xovee 12upright 直立的\textup{Xovee 12}\upshape
Xovee 12
\textup{Xovee 12}
Xovee 12italic 斜体\textit{Xovee 12}\itshape
Xovee
12
\textit{Xovee 12}
Xovee 12slanted 斜体/歪体\textsl{Xovee 12}\slshapesmall caps 小型大写字母\textsc{Xovee 12}\scshape
延伸阅读
字体粗体、斜体、下划线文字对齐多栏文档段落格式换行和空白多语言支持
