我想在页边空白处添加旁注(替代脚注)。我在 Latex 社区网站上找到了此代码。
\newcommand{\sidenote}[1]{%
\refstepcounter{sidenote}\mbox{\textsuperscript{\alph{sidenote}}}%
\marginpar{\footnotesize \mbox{\textsuperscript{\alph{sidenote}} }#1}%
}
\newcounter{sidenote}
总体来说,它是有效的,但我想进行一些个性化设置:
我想将我的旁注放在对面(内部)边缘。我尝试将 改为
\marginpar
,\reversemarginpar
但没有成功。它实际上将我的旁注放在了正文中!我希望这些内容适合段落样式。(我使用该
fnpara
包对脚注实现类似的效果。)
MWE(按要求):
\documentclass[letter]{book}
\newcommand{\sidenote}[1]{%
\refstepcounter{sidenote}\mbox{\textsuperscript{\alph{sidenote}}}%
\marginpar{\footnotesize \mbox{\textsuperscript{\alph{sidenote}} }#1}%
}
\newcounter{sidenote}
\begin{document}
In the beginning\sidenote{Gn 1:1; Pr 8:22-31; Jn 8:58; 17:5; Cl 1:17-18; He 1:8-12; 7:3; 13:8; 1Jn 1:1; Rv 1:4,8,11,17; 2:8; 3:14; 21:6; 22:13} the Word\sidenote{Is 55:11; Jn 1:14; He 4:12; 1Jn 1:1; 5:7; Rv 1:2; 19:13} was \ldots
\end{document}
答案1
奇数页和偶数页的边距设置不同。因此,您需要进行调整,\marginparwidth
以便\marginpar
适合内边距:
\documentclass[letter]{book}
\renewcommand{\verse}[1]{\textsuperscript{#1}}
\newcommand{\sidenote}[1]{% \sidenote{<side note>}
\refstepcounter{sidenote}\mbox{\textsuperscript{\alph{sidenote}}}%
\marginpar{\footnotesize\raggedright\strut\mbox{\textsuperscript{\alph{sidenote}} }#1}%
}
\newcounter{sidenote}
\setlength{\marginparwidth}{.8in}
\reversemarginpar
\newcommand{\note}[1]{[#1]}
\begin{document}
\verse{1} \note{\textbf{P}} In the beginning%
\sidenote{Gn 1:1; Pr 8:22-31; Jn 8:58; 17:5; Cl 1:17-18; He 1:8-12; 7:3; 13:8; 1Jn 1:1; Rv 1:4,8,11,17; 2:8; 3:14; 21:6; 22:13}
the Word\sidenote{Is 55:11; Jn 1:14; He 4:12; 1Jn 1:1; 5:7; Rv 1:2; 19:13}
was \note{\textit{the Word already existed; there was the Word}}.
\newpage
\verse{2} \note{\textbf{P}} In the beginning%
\sidenote{Gn 1:1; Pr 8:22-31; Jn 8:58; 17:5; Cl 1:17-18; He 1:8-12; 7:3; 13:8; 1Jn 1:1; Rv 1:4,8,11,17; 2:8; 3:14; 21:6; 22:13}
the Word\sidenote{Is 55:11; Jn 1:14; He 4:12; 1Jn 1:1; 5:7; Rv 1:2; 19:13}
was \note{\textit{the Word already existed; there was the Word}}.
\end{document}
我添加了\raggedright
对齐\marginpar
以便于更好地阅读。
以下是使用flowfram
管理从一页到下一页的文本流。事实上,flowfram
模仿了geometry
通过设置框架(静态、动态和流程)。我们使用后两个来创建解决方案。
流动框架包含文本块细节,而动态框架包含旁注。每个奇数/偶数页使用自己的流动和动态框架,后者在使用时会附加新的旁注。\sidenoteblock
会保留一个补充来测量页面上旁注的高度。如果旁注添加量超出了文本块高度,\newpage
则会发出一个并重置旁注。
\documentclass{book}
\newlength{\innermargin}\setlength{\innermargin}{\dimexpr1in+2em}
\setlength{\marginparwidth}{.75in}
\usepackage[twoside,hmargin={\innermargin,1.5in}]{geometry}% http://ctan.org/pkg/geometry
\usepackage{flowfram}% http://ctan.org/pkg/flowfram
\usepackage{everyshi}% http://ctan.org/pkg/everyshi
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
% Regular odd/even text blocks
% \newflowframe[<page list>]{<width>}{<height>}{<x>}{<y>}[<label>]
\newflowframe[odd]{\textwidth}{\textheight}{0pt}{0pt}[oddpage]
\newflowframe[even]{\textwidth}{\textheight}{0pt}{0pt}[evenpage]
% Inner odd/even margin blocks
% \newdynamicframe[<page list>]{<width>}{<height>}{<x>}{<y>}[<label>]
\newdynamicframe[odd]{\marginparwidth}{\textheight}
{\dimexpr-\marginparsep-\marginparwidth}{0pt}[oddsidenote]
\newdynamicframe[even]{\marginparwidth}{\textheight}
{\dimexpr\textwidth+\marginparsep}{0pt}[evensidenote]
\EveryShipout{% At every shipout
\setdynamiccontents*{oddsidenote}{\rule{0pt}{1em}\footnotesize\raggedright}% Clear odd side notes
\setdynamiccontents*{evensidenote}{\rule{0pt}{1em}\footnotesize\raggedright}% Clear even side note
\gdef\sidenoteblock{\footnotesize\raggedright}%
}
\AtBeginDocument{% At \begin{document}
\setdynamiccontents*{oddsidenote}{\rule{0pt}{1em}\footnotesize\raggedright}% Clear odd side notes
\setdynamiccontents*{evensidenote}{\rule{0pt}{1em}\footnotesize\raggedright}% Clear even side note
\gdef\sidenoteblock{\footnotesize\raggedright}%
}
\AtEndDocument{% At \begin{document}
\appenddynamiccontents*{oddsidenote}{\par}% Finalize odd side notes
\appenddynamiccontents*{evensidenote}{\par}% Finalize even side notes
}
\makeatletter
\newcounter{sidenote}\renewcommand{\thesidenote}{\arabic{sidenote}}
\newcommand{\sidenoteblock}{}
\newcommand{\sidenote}[1]{% \sidenote{<side note>}
\refstepcounter{sidenote}%
\protected@edef\the@sidenote{\textsuperscript{\thesidenote}}% http://tex.stackexchange.com/a/40006/5764
\expandafter\g@addto@macro\expandafter\sidenoteblock\expandafter{\the@sidenote #1\space}%
\sbox0{\begin{minipage}{.75in}\sidenoteblock\end{minipage}}%
\ifodd\value{page}%
\getdynamicid{\@tempb}{oddsidenote}%
\else
\getdynamicid{\@tempb}{evensidenote}%
\fi%
\ifdim\dimexpr\ht0+\dp0>\textheight%
\appenddynamiccontents{\@tempb}{\par}%
\newpage\addtocounter{sidenote}{-1}%
\sidenote{#1}%
\else
\textsuperscript{\thesidenote}%
\expandafter\appenddynamiccontents\expandafter{\expandafter\@tempb\expandafter}\expandafter{\the@sidenote #1\space}%
\fi
}
\makeatother
\begin{document}
\sidenote{Here is the first side note.}\lipsum[1]
\sidenote{Here is the second side note.}\lipsum[2]
\sidenote{This is the third side note.}\lipsum[3]
\sidenote{Here is another, now the fourth, side note.
Here is another, now the fourth, side note.
Here is another, now the fourth, side note.
Here is another, now the fourth, side note.
Here is another, now the fourth, side note.
Here is another, now the fourth, side note.
Here is another, now the fourth, side note.
Here is another, now the fourth, side note.
Here is another, now the fourth, side note.
Here is another, now the fourth, side note.
Here is another, now the fourth, side note.
Here is another, now the fourth, side note.}\lipsum[4]
\sidenote{Side note number five.}\lipsum[5]
\sidenote{Another, the sixth one.}\lipsum[6]
\sidenote{More side notes are coming. This is number seven.}\lipsum[7]
\sidenote{Eight, yes, this is the eighth.}\lipsum[8]
\end{document}
警告:如果旁注的长度超过文本块高度,则上述解决方案不适用。
您可以定义
\newcommand{\sidenote}[2]{% \sidenote{<word>}{<side note>}
\refstepcounter{sidenote}%
\protected@edef\the@sidenote{\textsuperscript{\thesidenote}}% http://tex.stackexchange.com/a/40006/5764
\expandafter\g@addto@macro\expandafter\sidenoteblock\expandafter{\the@sidenote #2\space}%
\sbox0{\begin{minipage}{.75in}\sidenoteblock\end{minipage}}%
\ifodd\value{page}%
\getdynamicid{\@tempb}{oddsidenote}%
\else
\getdynamicid{\@tempb}{evensidenote}%
\fi%
\ifdim\dimexpr\ht0+\dp0>\textheight%
\appenddynamiccontents{\@tempb}{\par}%
\newpage\addtocounter{sidenote}{-1}%
\sidenote{#1}{#2}%
\else
#1\textsuperscript{\thesidenote}%
\expandafter\appenddynamiccontents\expandafter{\expandafter\@tempb\expandafter}\expandafter{\the@sidenote #2\space}%
\fi
}
允许您使用\sidenote{<word>}{<side note>}
,这确保<word>
和<side note>
始终在一起,而旁注引用始终跟在单词后面;类似于
... 等等等等字7等等等等...
答案2
您可以使用footmisc
带选项的软件包side
,它替换了编号 \marginpar
s,重新\thefootnote
格式化字母引用
\renewcommand{\thefootnote}{\alph{footnote}}
请注意,如果您有较长的脚注,则可能需要加载marginfix
处理分页符。此外,即使有marginfix
,如果脚注太多,也可能会Too many floats
出错。
以下是 MWE:
\documentclass[twoside]{article}
\usepackage[side]{footmisc}
\renewcommand{\thefootnote}{\alph{footnote}}
\usepackage{kantlipsum}% dummy text
\usepackage{marginfix}
\begin{document}
This is a short footnote\footnote{Short footnote.} and another\footnote{Another short footnote.}.
\kant*[3]\footnote{Yet another short one.}
\kant*[4]\footnote{But: Too many (or too long) footnotes won't work for these are still marginpars. \emph{That's why we need \textbf{marginfix}}}
\kant*[5]\footnote{\kant*[6]}
\kant*[7]\footnote{\kant*[8]}
\kant*[9]\footnote{\kant*[10]}
Marginfix however might have a limit for too many footnotes will become too many floats, and you might end up with none being typeset.
\end{document}
这memoir
该类还提供了\sidebar
和命令:后者的行为与(注释排版在其锚点旁边)\sidefootnote
非常相似,而第一个将所有旁注排版在页面底部。\marginpar