脚注は一つでなく二つのオブジェクト
TeX が \footnote{text} を見つけると、無関係な二つのことが起きます。現在の行には印を置きます。footnote カウンターをステップし、\thefootnote を \@makefnmark 経由で上付きとして組版します。ページには挿入物を置きます。注のテキストは脚注罫線とともに \footins の insert レジスタへ入り、出力ルーチンが後で \textheight の下へ継ぎ付けて \@makefntext に渡します。
脚注の不思議はすべてこの分離から来ています。印は打った場所へ、テキストはページの終わりへ。だから材料を動かすもの——float、段組み、二段組、minipage——は二分を引き離せますし、ソースを読み直すもの(目次、実行見出し、図目録)は印を二度組んで二重に数えます。
知っておくべき寸法は全部普通の長さです。\skip\footins は最後の本文行と脚注罫線の間の縦空間、\footnotesep は二つの注を分ける支柱高、注そのものは \@makefntext を通じて \footnotesize で組まれます。注が最後の本文行に詰まるなら \setlength{\skip\footins}{14pt} が直し方です。下余白へ乗り上げるなら、ページが空間を使い切って挿入物が分割されています——次の footmisc の bottom オプションへ繋がる話です。
\underbrace{\text{mark}}_{\text{in the line}} \quad \longmapsto \quad \underbrace{\text{text}}_{\text{below the rule}}
脚注を置いてはいけない場所と、代わりに書くもの
四つの場所は立入禁止で、それぞれ違う壊れ方をします。動く引数——\section、\caption、\chapter、\item の任意引数——は補助ファイルへ書かれて再組版されるので、注は宛先回数だけカウントされます。定番の結果は間違った番号と、hyperref からの Footnote ... is multiply defined 警告。float と tabular のセルは印とテキストの対応を壊します。float は別のページへ着地するからです。verbatim な材料はコマンドを一切含められません。脚注の中の脚注は挿入物をネストし、TeX はそこをサポートしていません。
見出しでの正しいレシピは三点セットです。目次用の短い形、本体の長い形、注の前へ \protect——\section[Short title]{Long title\protect\footnote{...}}。\protect は見出しを書き出す間に注が展開されるのを防ぎ、テキストはその見出しが現れるページで組まれて、目次には入りません。タイトルや著者にだけ注を添えたいなら \thanks{} を使ってください。素材を \@thanks へ集め、タイトルブロックの下で自分専用の記号列を使い、footnote カウンターから独立して組版します。
表での答えは、脚注を自分で開くことです。\footnotemark は印を出してカウンターをステップし、\footnotetext はカウンター現在の値でテキストを出します。印を tabular の中に置いて float を閉じ、カウンターを逆走させてテキストを並べましょう。\addtocounter{footnote}{-1}\footnotetext{first note}\stepcounter{footnote}\footnotetext{second note}。これは帳簿作業で、編集をまたぐと壊れやすいものです。表の注に対する長期的で堅い答えは threeparttable とその tablenotes リストで、注は表の箱の一部になるので表と一緒に浮動します。
出力を見るまで隠れている罠が二つ。p{<width>} 列は minipage なので、その中の \footnote は完全に合法で、セルの下に着地し、別口の mpfootnote カウンターで字母を振ります——読者はこれを誤植と読みます。longtable の行末にある \footnote は断片ごとに一度ずつ出ることもあります。あの注は環境の後ろへ、印とテキストの対で置いてください。
\documentclass[a4paper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage[a4paper,margin=2.5cm]{geometry}
\begin{document}
\section{Two ways to footnote a table}
% --- (1) marks inside the tabular, texts after the float -------------
% A \footnote inside a table would be swallowed by the float machinery, so
% the mark and the text are written as two halves of one operation.
\begin{table}[htbp]
\centering
\begin{tabular}{llr}
\toprule
Symbol & Quantity & Value \\
\midrule
$\alpha$ & fine structure & $7.297\times10^{-3}$\footnotemark \\
$c$ & speed of light & $299\,792\,458$\footnotemark \\
\bottomrule
\end{tabular}
\caption{Constants with two marks.}\label{tab:constants}
\end{table}
% \footnotemark has already advanced the counter twice; walk it back to the
% first mark, print that text, then step forward for the second.
\addtocounter{footnote}{-1}%
\footnotetext{Dimensionless, and measured.}%
\stepcounter{footnote}%
\footnotetext{Exact, since the metre was defined from it.}
% --- (2) the p{} column trap ----------------------------------------
% A p{} column is a minipage, so \footnote inside one does NOT go to the
% bottom of the page: it is printed under the cell, with the independent
% minipage counter (letters).
\begin{center}
\begin{tabular}{p{4.5cm}p{4.5cm}}
\hline
This cell carries a note.\footnote{Read this one under the cell, marked
with a letter, not at the foot of the page.} &
And this one is plain text. \\
\hline
\end{tabular}
\end{center}
For tables whose notes must travel with the table, the environment to reach for
is \verb|threeparttable| with its \verb|tablenotes| list and \verb|\tnote{a}|
marks; for notes that belong at the foot of the page, use the mark/text pair above.
A note in ordinary text, for contrast.\footnote{This one really does sit at the
bottom of the page.}
\end{document}
番号付け:記号、字母、ページごと、章ごと
番号はハードコードされていません。\thefootnote が展開されるものがそのまま番号なので、印の見た目は \renewcommand 一つで変わります。実際に要る設定は四つ。\arabic{footnote}(既定)、静かな学術風の \roman{footnote}、表向けの \alph{footnote}、表紙で一つのクレジット注に使う、番号を振らないアスタリスク/ダガー列の \fnsymbol{footnote}。\thefootnote を何も印字しないようにすると匿名の注になり、継続的な補注にはまさにその形が欲しかったはずです。
\fnsymbol は一文を割く価値があります。カウンターを数として使わない唯一の設定だからです。カーネルの定義は九分岐のスイッチで、アスタリスク、ダガー、ダブルダガー、節記号、段落記号、二重縦棒、その後に二重化した形 **、††、‡‡ が並びます。十番目の要求は周回せず \@ctrerr に落ちて、Counter too large で実行は止まります。この上限があるから、注が一、二個で番号付けが要らない表紙のクレジットにこの様式が使われ、ページごとにリセットせずに全体をこれへ切り替えるとゆっくりした事故になるのです。hyperref は宛先名のために別の Hfootnote カウンターを持っており、\setcounter{footnote}{0} ではそれがリセットされない点も注意してください。注番号を手で戻す文書では、本文中の * の逆参照が七番目のラベルになり得ます。
リセット地点もカウンターです。ページごとの番号付けはカーネルのクラスオプションではなく、\usepackage[perpage]{footmisc} を読みます。章ごとは汎用の仕組みで \counterwithin{footnote}{section}(カーネルのコマンド。古いインストールでは chngcntr)。ページごとに bottom を添えるのが多くの書籍クラスが使う組合せです。footmisc で他に覚える価値のあるキーは、bottom(注が本文ブロックの足元ではなく短いページの途中で浮き上がるのを防ぐ)、norule、ragged、flushmargin(行をインデントせず印を余白へ吊り出す)です。
{}^{\ast},\ {}^{\dagger},\ {}^{\ddagger},\ {}^{\S},\ {}^{\P},\ {}^{\|},\ {}^{\ast\ast},\ {}^{\dagger\dagger},\ {}^{\ddagger\ddagger}
\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage[a4paper,margin=2.5cm,bottom=3.2cm]{geometry}
\usepackage[bottom,perpage,flushmargin]{footmisc}
% bottom : push the footnotes to the very bottom of the page
% perpage : restart the numbering on every page
% flushmargin: hang the mark into the margin instead of indenting
\setlength{\skip\footins}{16pt} % gap between the text and the footnote rule
\setlength{\footnotesep}{9pt} % gap between two footnote texts
\title{Notes on notes\thanks{Collected in the title block, marked with symbols.}}
\author{A. Student}
\begin{document}
\maketitle
% --- three ways to write the number ---------------------------------
\renewcommand{\thefootnote}{\arabic{footnote}} % 1, 2, 3 (the default)
% \renewcommand{\thefootnote}{\roman{footnote}} % i, ii, iii
% \renewcommand{\thefootnote}{\fnsymbol{footnote}} % *, dagger, ddagger, S, P
% \renewcommand{\thefootnote}{} % unmarked notes
The Euler product is due to Euler.\footnote{First note on this page.}
A second claim, a second note.\footnote{Second note.}
A third one reuses the first mark---\footref{1} \verb|\footref| is supplied by
\texttt{footmisc}, and it repeats a mark without spending a new number.
\section[A short heading for the TOC]{A long heading\protect\footnote{A note in
a heading is set on the page the heading lands on, never in the table of
contents.}}
Because \verb|\section| writes its title to the table of contents, the note had
to be protected, and the heading needed a short optional form.
\subsection*{Zeroing the counter by hand}
\setcounter{footnote}{0}
After the reset the next note is number one again.\footnote{Numbered from one.}
\end{document}
display 数式の中の脚注
display 数式は自分の水平リストを持つグループなので、その中の \footnote は予測できない場所に落ちます。大抵は印が式の後ろに設定され、式がページを跨ぐまで問題に気づかないか、中央揃えの display の左端に印が出ます。堅い位置は二つです。閉じる \] の直後——読者が期待どおり句読点へ印を添える——または display を含む文の終わり。
本当に印を数式の中の記号の上に置きたいなら、そこに \footnote は使わず、手動の上付きを数式の外側へ置いてください。記号の後に \footnotemark、display の後に \footnotetext。テキストモードでも同じ手口は一般化します。x\footnotemark[3] はカウンターに手を触れず三番の印を出し、テキストは別に書けます。記法の違いに注意。\footnotemark[3] が番号を任意引数に取るのと同じで、\footnotetext[3]{...} もテキスト側を指定します。
amsmath の \intertext と \intertext* は別の理由でここで触れておく価値があります。aligned グループの中で普通のテキスト——したがって脚注——が正式に置ける唯一の場所です。展開式全体を修飾する注は、その前の文へ。一つの記号を修飾する注は最終行に接いだ \text{...} へ。整列の中に入れてはいけません。
\sum_{k=0}^{\infty} c_{k}x^{k} = f(x)^{\,\dagger}
\dagger で、まさに \fnsymbol{footnote} がページの二番目の注を描く方法です。余白の注記:marginpar が意外にやること
\marginpar{text} は見た目より古くて脆いコマンドです。書いた位置の余白に置かれるのではなく、TeX は注を記録して出現した行へ結びつけ、出力ルーチンが箱を外側の余白へ置きます。oneside と twoside の奇数ページなら左、偶数ページなら右です。既に余白にある箱と重なるなら、LaTeX は後から来た方を \marginparpush だけ下へ押します。ページに場所が無いなら次のページへ移り、Marginpar on page ... moved と警告します。箱はページ番号機構にも見えないので、迷子の \marginpar は無視されたように見えますが、実際は移動しただけです。
列を制御する三つの長さは \marginparwidth(箱の幅。標準クラスでは 11pt と 12pt で小さすぎて、「注が読めない」苦情の発生源になります)、\marginparsep(本文と注の間のガター)、\marginparpush(二つの注の最小縦間隔)です。geometry を使えば上の二つを直接設定できます——marginparwidth=2.6cm, marginparsep=8pt——ただしその分の外側余白が用紙に本当にあるか確認が必要です。無いなら注は印刷領域へ座ります。内容のスタイルは marginnote パッケージの \marginfont、memoir ではクラスの \@margincaption を通します。
\marginpar は \footnote と同じ動く引数の問題に加えて、もう一つ抱えています。float、\begin{minipage}、他の箱の中へ入れられません。注は箱ではなくページストリームへ挿入されるからです。つまり脚注の課の話が構文を変えて繰り返され、代替策は次に名前が出るパッケージです。
\documentclass[11pt,twoside]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage[a4paper,top=2.5cm,bottom=2.8cm,left=3.5cm,right=3.5cm,
marginparwidth=2.6cm,marginparsep=8pt]{geometry}
\usepackage{marginnote}
\usepackage{graphicx}
% The box width is \marginparwidth, the gutter is \marginparsep, and the
% minimum vertical gap between two notes is \marginparpush - all three are set
% above through geometry. Style the content of the box with \marginfont:
\renewcommand{\marginfont}{\scriptsize\raggedright\itshape}
\begin{document}
\section{Margin material}
A sentence that needs an aside.\marginpar{A \texttt{\string\marginpar} note: it
is anchored to the line it sits in, and if there is no room it is pushed down
the margin --- or onto the next page, with a warning.}
The rule is that \verb|\marginpar| places its box in the \emph{outer} margin of
a two-sided document, using the vertical position of the line that carried it.
\subsection*{Why marginnote exists}
The same anchor problem is solved differently by the \texttt{marginnote}
package: the note is positioned against the current line, it never changes the
page number, and --- crucially --- it can be used where \verb|\marginpar|
cannot, such as inside a float or in the caption area.
\marginnote{This note is set with \texttt{\string\marginnote}, and the optional
second argument nudges it vertically.}[-2.5ex]
\begin{figure}[htbp]
\centering
\setlength{\fboxsep}{22pt}
\fbox{\parbox{5cm}{\centering a figure}}
\caption{A float carrying a margin note.}
\marginnote{A \texttt{\string\marginpar} here would be lost or would trigger
``marginpar on page moved''; inside a float, use \texttt{\string\marginnote}.}
\end{figure}
Two vertical offsets show the difference between the two commands: the first
note above is tied to the paragraph, the second is tied to the line it was
written on.\marginpar{Second \texttt{\string\marginpar}.}
\end{document}
marginnote、そして注が実は余白見出しであるとき
marginnote パッケージは同じ視覚的な対象を三つの実務差で提供します。\marginnote{text} は注を現在の行の高さに置いて次のページへ動かさず、第二の任意引数は縦オフセットを取るので、\marginnote{...}[-2.5ex] は箱を見出しと揃えるように上へ引けます。\marginpar が断られる float や箱の中の素材でも動くのもこのパッケージです。標準クラスで \marginline 風の挙動をくれるのもそうだし、注のスタイルを決める文書化された方法も \marginfont フックです。
代価はもう一回の実行と小さな帳簿作業です。marginnote はアンカー情報を保存してオフセットを正しいページへ解決させるので、二回コンパイルしていない文書では注が行から一枚ずれて出ます。注はページ挿入物ではなくなるので、長い余白パラグラフを分割する機構もありません。余白の材料がそこまで長いなら、それは注ではなく第二の段です。そのための道具は mpar 系のクラス(memoir、Tufte 風のテンプレート)か、狭い固定列を置いた二段の tabular になります。
書く前にどの装置を使うか決めてください。脚注は読者を文から離し、下へ目線を走らせ、居場所を探させます。5 パーセントの読者しか欲しがらない補足にはそれが正しい。余白の注は目を本文列に留めます。注釈、出典、段落とともに読ませたい継続的な補足にはこちらが正しい。第三の選択肢は endnotes パッケージ経由の \quotes 風の末尾注で、すべてを末尾の一覧へ移します。注が組版を壊すほど長い法務・アーカイブ系の文書では、それが正解です。
x^{a},\ y^{b},\ z^{c} \qquad (\text{a separate counter})
レイアウト、ページ分割、そして消える注
脚注は好む好まざるとに関わらずページ分割に参加します。挿入物は本文の下に収まる必要がある箱なので、長い注のあるページは本文の行数を差し出し、収まらない注は \footins のペナルティで分割されます。本文がページの上へ引っ張られて下に大きな隙間が見えるなら、それは挿入物を置いている最中です。調整用つまみは \interfootnotelinepenalty(上げると一つの注をページを跨いで分割しなくなりますが、その分行間が空きます)、\bottomnumber(分割された注のどの程度の部分が最初のページに残るか)、footmisc の bottom オプション(注が短いページの途中で上へ這い上がるのを防ぐ)です。
バグに見える失敗パターンは、注がただ現れないケースです。ほぼ次の四つのどれか。p{} 型の tabular のセルの中の注(セルの下に印字されています)、float の中の注(float 自身の箱に飲み込まれています)、\parbox や minipage の中の注(ここでも minipage 側のカウンターです)、そして目録側——たとえば図目録——で組まれた、あなたが読んでいない場所へ飛んだ動く引数の中の注。Footnote と marginpar でログを検索してください。どちらの類も痕跡を残します。
最後に、長い文書の健全な組版を保つ二つの習慣。二度参照される注には、中に \label{fn:sources} を置いて、書き直すのではなく \autoref{fn:sources} や \footref で指し直してください。そして注の番号を手で打つのをやめる——ファイルの手前へ一つ入れた瞬間、後続のリテラルの番号は全部間違います。定理環境が手打ちの番号について語るのと同じ議論です。
このレッスンの早見表
各セクションのキーコードを一行ずつ。見出しで該当箇所へ移動、コードはそのままコピーできます。
\underbrace{\text{mark}}_{\text{in the line}} \quad \longmapsto \quad \underbrace{\text{text}}_{\text{below the rule}}
\documentclass[a4paper,11pt]{article}
\documentclass[12pt,a4paper]{article}
\sum_{k=0}^{\infty} c_{k}x^{k} = f(x)^{\,\dagger}
\documentclass[11pt,twoside]{article}
x^{a},\ y^{b},\ z^{c} \qquad (\text{a separate counter})
よくある間違い
\footnoteをtabularのセルへそのまま入れること。l/c/r列では注が失われたり違う場所に落ちたりします。セルでは\footnotemark、float の後に\footnotetext、または表をthreeparttableへ移ってください。\section{Title\footnote{...}}を短い任意形も\protectもなしで書くこと。LaTeX は見出しを目次用に再組版し、注カウンターは二度進み、hyperref は多重定義の脚注を報告します。\fnsymbol{footnote}にして一つのページに十の注を書くこと。カーネルのスイッチは九分岐で、十番目は Counter too large に落ちます。リストを繰り返す前に実行が止まるので、ページごとにカウンターを戻すか、それだけ注があるなら数字のままにしてください。\marginparは float の心配が無い場所だと思っていること。minipage、parbox、float では動きません。余白列が埋まると次のページへ移り、ログに警告だけ残します。geometryでページ余白を決めながら\marginparwidthを標準クラスの既定に放置すること。注は幅 1.5cm ほどの箱でハイフネーションなしに印字され、読めません。p{...}列の中の注がページの下に出ると思っていること。あれは minipage なので、注はそのセルの下に自分専用の字母カウンターで組まれます。ページの下へ置くなら印とテキストの対で外へ出してください。
この課に関する質問
LaTeX の表に脚注を入れるには?
\footnotemark、表環境の後に \footnotetext を置きます。float の中での完全な \footnote は確実に配置されないからです。\footnotemark はすでにカウンターを進めているので、最初の \footnotetext の前で \addtocounter{footnote}{-1} を使って引き戻し、残りの間では \stepcounter します。注がページでなく表に属するなら threeparttable と tablenotes を使ってください。脚注を数字でなく記号で振るには?
\renewcommand{\thefootnote}{\fnsymbol{footnote}}。アスタリスク、ダガー、ダブルダガー、節記号、段落記号の列へ切り替わり、単一のクレジット注に使う伝統的な様式になります。最初から並べ直したいなら \setcounter{footnote}{0} を先に置いてください。この列は九個で打ち切りで、反復はしません。脚注が消えているのはなぜ?
marginpar と marginnote の違いは?
\marginpar はカーネルのコマンドで、現れた行へアンカーし、余白が埋まると下へ押されるか次のページへ移り、箱や float の中では動きません。\marginnote(marginnote パッケージ)は現在の行の高さに置かれ、第二の任意引数で縦オフセットを取り、float の中でも動き、\marginfont で箱のスタイルを変えられます。脚注をページごとに番号付けできますか?
\usepackage[perpage]{footmisc} を読んでください。bottom を添えれば注は本文ブロックの足元に留まり、flushmargin は印を余白へ吊り出します。章ごとの番号付けには汎用の仕組み、\counterwithin{footnote}{section} を使います。同じ脚注をもう一度参照するには?
\footref{<number>} を使うと、新しい番号を消費せずに既存の印をもう一度印字します。\footnotemark[n] と \footnotetext[n]{...} はどちらも番号を任意引数に取るので、対応を手で駆動することもできます。ライブ playground:LaTeX を編集して即描画
入力すると即座にプレビューが更新されます。わざと壊してエラーの見た目も確認しましょう。
続けて読む
同じ話題への三つの入口:記法そのもの、それを教える課、そして実際に使っている記事。