LaTeX 脚注

2025-09-21 13:50:18

LaTeX 脚注

原 文:Footnotes 译 者:Xovee 翻译时间:2022年10月27日

文章目录

LaTeX 脚注介绍`\footnote`命令例子

LaTeX Counter:保存脚注标号值`\footnotemark`和`\footnotetext`命令例子

其他LaTeX脚注命令

脚注的例子和应用拥有多个参考(Reference)的脚注改变标号的样式`minipage`环境中的脚注改变`minipage`脚注标号表格中的脚注要不要在表格中使用脚注呢?例子:`\footnote`在`tabular`环境中不起作用例子:来自LaTeX2e非正式参考手册例子:使用`tablefootnote`包

表格注释 Table Notes例子tex.stackexchange上的讨论

介绍

根据Wikipedia的介绍,脚注是由一个英国印刷工Richard Jugge(1514年到1577年)发明的。本文将会介绍脚注这一古老的文本修饰工具是如何在LaTeX中使用的。

\footnote命令

\footnote命令是LaTeX中创建脚注的主要命令,它主要由两种使用形式:

\footnote{text for footnote}:这一命令会自动在文本中插入一个上标数字,被称为脚注的标号(mark),同时在页面的底部插入脚注的标记和内容。\footnote[number]{text for footnote}:这一命令接受一个额外的参数number来指定脚注的标号。

例子

\footnote{Automatically generated footnote markers work fine!}将会创建标号为1的脚注\footnote[42]{...is that the answer to everything?}创建了标号为42的脚注,并且不会自动增加之前脚注的标号大小。如我们在下面所见,第三个脚注的标号为2。

I'm writing to demonstrate use of automatically-generated footnote markers\footnote{Automatically generated footnote markers work fine!} and footnotes which use a marker value provided to the command\footnote[42]{...is that the answer to everything?}.

Now, I will use another automatically-generated footnote marker\footnote{Now, footnote markers are 1, 42, but then back to 2? That will be confusing if the automatically-generated number also reaches 42!}.

LaTeX Counter:保存脚注标号值

Counter,计数器。LaTeX使用一个Counter变量来保存当前脚注的标号。在实际中,LaTeX根据不同的情况使用了两种Counter变量:

footnote:正文中的脚注mpfootnote:minipage环境中的脚注

每一次我们使用\footnote命令,Counter变量的值就会加一。如果使用\footnote[number],变量的值则不会变。

你也可以创建更多的Counter来创建脚注。

\footnotemark和\footnotetext命令

除了\footnote,LaTeX还提供了以下两个命令:

\footnotemark:显示脚注的标号\footnotetext:显示脚注的内容

这两个命令都接受一个额外的参数(使用中括号):

\footnotemark[number]:显示脚注的标号,但是不在页脚显示脚注的内容,并且脚注的标号为括号中的数字。如果你没有提供[number],那么Counter的值会加一。\footnotetext[number]{text for footnote}:显示脚注的内容,脚注的标号取决于之前的脚注的标号。如果你提供了[number],那么脚注的标号将是你提供的数字。

例子

\footnotemark和\footnotetext命令一般搭配使用在例如表格之类的地方(在这些环境中,常规的\footnote不起作用,或者其不是最佳的创建脚注的命令)。

I'm writing to test the \verb|\footnotemark| and \verb|\footnotetext| commands.

You can insert a footnote marker using the \verb|\footnotemark|\footnotemark{}

command and later, when you're ready, typeset the footnote text by writing

\verb|\footnotetext{Here's the footnote.}|. \footnotetext{Here's the footnote.}

Let's do one more to see the result\footnotemark{} which I'll comment on within the

footnote\footnotetext{Specifically, I'd write comments in this one.}.

其他LaTeX脚注命令

现在我们介绍了三种命令:

\footnote[number]{text for footnote}\footnotemark[number]\footnotetext[number]{text for footnote}

LaTeX还提供了一些额外的与脚注有关的命令:

\footnotesize:改变脚注的大小\footins:正文和脚注的距离\footnoterule:显示正文和脚注之间的横线。它在\vspace{\skip\footins}之后执行。它的厚度应当是0,也就是说,它应当有一个负的位移来补偿它自身所占用的空间。\footnotesep:脚注之间的距离

脚注的例子和应用

拥有多个参考(Reference)的脚注

下面我们介绍如何创建同一个脚注的多个参考链接(References)。我们使用的命令是\footnotemark[\value{footnote}],它会在当前位置创建脚注的标号,并且不增加标号的值。

I'm writing to test\footnote{Footnotes work fine!} several footnote features.

You can insert the footnote marker\footnotemark{} using the \verb|\footnotemark|

command and later use the \verb|\footnotetext| command to typeset the footnote

text by writing \verb|\footnotetext{Text of second footnote.}|

\footnotetext{Text of second footnote.}.

I can use the same footnote\footnotemark{} more than

once\footnotemark[\value{footnote}].

\footnotetext{A footnote with two references.}

改变标号的样式

LaTeX中,标号的值存在计数器中,而它的样式则由命令\thefootnote控制。我们可以用这个命令来改变标号的样式。例如,\renewcommand{\thefootnote}{\roman{footnote}}将会使用罗马数字来显示标号。你可以在preamble中使用这个命令来控制正文中脚注的样式。

其他可选的标号样式包括:

\arabic{counter variable}: 阿拉伯数字\Roman{counter variable}: 大写罗马数字\alph{counter variable}: 小写字母\Alph{counter variable}: 大写字母fnsymbol{counter variable}: 使用9种特殊的符号

有关计数器Counter的信息,请参考这篇文章。

下面是一个使用该命令的例子:

I'm writing to test\footnote{Footnotes work fine!} several footnote features.

You can insert the footnote marker\footnotemark{} using the \verb|\footnotemark|

command and later use the \verb|\footnotetext| command to typeset the footnote

text by writing \verb|\footnotetext{Text of second footnote.}|

\footnotetext{Text of second footnote.}.

I can use the same footnote\footnotemark{} more than

once\footnotemark[\value{footnote}].

\footnotetext{A footnote with two references.}

\renewcommand{\thefootnote}{\roman{footnote}}

Now a footnote marker using lowercase Roman numerals\footnote{This footnote marker uses lowercase Roman numerals.}.

minipage环境中的脚注

该环境中的脚注的行为是不一样的,因为命令\footnote和\footnotetext被暂时重定义了:

它们出现在minipage的底部,而不是正文的底部使用了名为mpfootnote的计数器

例子:

This is the start of a paragraph of text just before we switch to a \texttt{minipage} environment. This is an in-page footnote\footnote{Footnote before a minipage}.

\vspace{10pt}

\begin{minipage}{0.7\textwidth}

This is text in a \texttt{minipage} environment. Here is the first \texttt{minipage} footnote\footnote{First minipage footnote.}. And another \texttt{minipage} footnote\footnote{Second minipage footnote.}.

\end{minipage}

\vspace{10pt}

This is the start of a standard paragraph of text just after we finished a \texttt{minipage} environment. This is an in-page footnote\footnote{Footnote after a minipage}.

改变minipage脚注标号

在上面的例子中,我们发现minipage中标号使用的是小写字母。我们仍然可以使用\renewcommand命令来重定义标号的样式。例如:

\renewcommand{\thempfootnote}{\arabic{mpfootnote}}

\renewcommand{\thempfootnote}{\arabic{mpfootnote}}

\begin{minipage}{0.7\textwidth}

This is text in a \texttt{minipage} environment. Here is the first \texttt{minipage} footnote\footnote{First minipage footnote.}. And another \texttt{minipage} footnote\footnote{Second minipage footnote.}.

\end{minipage}

表格中的脚注

要不要在表格中使用脚注呢?

一个经常被问起的LaTeX问题是如何在表格中使用脚注。但是一般来说,在表格中我们推荐使用表格注释(note)而不是脚注(footnote)。总之,LaTeX提供了多种选择。

例子:\footnote在tabular环境中不起作用

\begin{table}

\centering

\begin{tabular}{lcc}

\midrule

\TeX{} engine & Native UTF-8 support & Unicode math support\\

\midrule

\hologo{pdfTeX} & No\footnote{Some UTF-8 support via \LaTeX{} kernel commands.} & No\\

\Hologo{XeTeX} & Yes & Yes\\

\Hologo{LuaTeX} & Yes & Yes\\

\midrule

\end{tabular}

\caption[\TeX{} engine features]{%

\TeX{} engine feature comparison\footnote{Draft version. Additional feature comparisons will be added.}.}

\end{table}

我们发现页脚并没有出现脚注。

一个解决办法是将tabular环境放入一个minipage环境:

\begin{minipage}{\textwidth}

\centering

\begin{tabular}{lcc}

\midrule

\TeX{} engine & Native UTF-8 support & Unicode math support\\

\midrule

\hologo{pdfTeX} & No\footnote{Some UTF-8 support via \LaTeX{} kernel commands.} & No\\

\Hologo{XeTeX} & Yes & Yes\\

\Hologo{LuaTeX} & Yes & Yes\\

\midrule

\end{tabular}

\end{minipage}

你可以使用\renewcommand{\thempfootnote}{\arabic{mpfootnote}}命令来改变标号的样式。

例子:来自LaTeX2e非正式参考手册

LaTeX2e非正式参考手册中提供了一个非常有趣的例子。一般来说,minipage环境中的脚注位于minipage的底部。在下面的例子中,我们使用\footnotemark和\footnotetext命令,以及一个新的计数器(mpFootnoteValueSaver)来保证表格脚注出现在文档的底部。

当表格创建好后,LaTeX代码\setcounter{mpFootnoteValueSaver}{\value{footnote}}设置了计数器的值等于当前footnote计数器的值;这确保了我们在表格中的脚注的标号与正文的标号同步。

newcounter{mpFootnoteValueSaver}

\begin{center}

\begin{minipage}{\textwidth}

\setcounter{mpFootnoteValueSaver}{\value{footnote}} \centering

\begin{tabular}{l|l}

\textsc{Woman} &\textsc{Relationship} \\ \hline

Mona &Attached\footnotemark \\

Diana Villiers &Eventual wife \\

Christine Hatherleigh Wood &Fiance\footnotemark

\end{tabular}

\end{minipage}% percent sign keeps footnote text close to minipage

\stepcounter{mpFootnoteValueSaver}%

\footnotetext[\value{mpFootnoteValueSaver}]{%

Little is known other than her death.}%

\stepcounter{mpFootnoteValueSaver}%

\footnotetext[\value{mpFootnoteValueSaver}]{%

Relationship is unresolved in XXI.}

\end{center}

例子:使用tablefootnote包

\documentclass{article}

% Using the geometry package with a small

% page size to create the article graphic

\usepackage[paperheight=6in,

paperwidth=5in,

top=10mm,

bottom=20mm,

left=10mm,

right=10mm]{geometry}

\usepackage{hologo} % for TeX engine logos

\usepackage{booktabs} % for nice tables

\usepackage{tablefootnote} % for table footnotes

\begin{document}

\begin{table}

\centering

\begin{tabular}{lcc}

\midrule

\TeX{} engine & Native UTF-8 support & Unicode math support\\

\midrule

\hologo{pdfTeX} & No\tablefootnote{Some UTF-8 support via \LaTeX{} kernel commands.} & No\\

\Hologo{XeTeX} & Yes & Yes\\

\Hologo{LuaTeX} & Yes & Yes\\

\midrule

\end{tabular}

\caption[\TeX{} engine features]{%

\TeX{} engine feature comparison\tablefootnote{Draft version. Additional feature comparisons will be added.}.}

\end{table}

\end{document}

表格注释 Table Notes

你也可以选择在表格中插入注释而不是脚注:通过threeparttable包。

例子

threeparttable包的文档非常简单,我们直接提供一个直观的例子:

\begin{table}

\begin{threeparttable}[b]

\caption[\TeX{} engine features]{\TeX{} engine feature comparison\tnote{1}}

\centering

\begin{tabular}{lcc}

\midrule

\TeX{} engine & Native UTF-8 support & Unicode math support\\

\midrule

\hologo{pdfTeX} & No\tnote{2}& No\\

\Hologo{XeTeX} & Yes & Yes\\

\Hologo{LuaTeX} & Yes & Yes\\

\midrule

\end{tabular}

\begin{tablenotes}

\item [1] This is an early draft.

\item [2] Some UTF-8 support via \LaTeX{} kernel commands.

\end{tablenotes}

\end{threeparttable}

\end{table}

tex.stackexchange上的讨论

tex.stackexchange上有很多人提供了有意思的解决方案:

footnotes for tables in LaTeXfootnote in table