LaTeX 字体、字号、字体样式

142 篇文章 4 订阅
4 篇文章 0 订阅

LaTeX 字体

原  文:Font sizes, families, and styles
译  者:Xovee
翻译时间:2022年11月11日

介绍

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 12
sans serif 非衬线\textsf{Xovee 12}\sffamily Xovee   12 \textsf{Xovee 12} Xovee 12
typewriter (monospace) 等宽\texttt{Xovee 12}\rmfamily Xovee   12 \texttt{Xovee 12} Xovee 12

字体样式

样式命令转换命令示例
medium 中等\textmd{Xovee 12}\mdseries Xovee 12 \textmd{Xovee 12} Xovee 12
bold 粗体\textbf{Xovee 12}\bfseries Xovee   12 \textbf{Xovee 12} Xovee 12
upright 直立的\textup{Xovee 12}\upshape Xovee 12 \textup{Xovee 12} Xovee 12
italic 斜体\textit{Xovee 12}\itshape Xovee   12 \textit{Xovee 12} Xovee 12
slanted 斜体\textsl{Xovee 12}\slshape与斜体类似
small caps 小型大写字母\textsc{Xovee 12}\scshape在这里插入图片描述

延伸阅读

  • 9
    点赞
  • 39
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值