如何在块引用中创建“本地”脚注?

如何在块引用中创建“本地”脚注?

我有一个包含脚注的块引用 - 但我不想将其放在页面末尾,而是放在引用的末尾。就像这样:

在此处输入图片描述

命令是否footnote允许这种自定义?如果不允许 - 我应该去哪里找?非常感谢!

答案1

根据此问题预测您的后续问题:更改块引用的字体?这里有一个使用 minipages 的解决方案,它也能使脚注和标记的格式正确。我还创建了一个\qfootnote命令(改编自 Gonzalo 的想法),它有 3 个参数:第一个可选参数指定脚注标记的格式。第二个参数是脚注编号。由于引用的脚注将被任意编号,因此在每个引文中手动设置它们是有意义的。第三个参数是脚注文本。此命令包括 Gonzalo 对脚注标记缩进的修改。这为您提供了对引文中脚注格式的最大灵活性。

\documentclass{article}

\usepackage{etoolbox}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\newfontfamily\quotefont{Linux Biolinum O}
\AtBeginEnvironment{quote}{\quotefont\small}
\makeatletter
\patchcmd{\@mpfootnotetext}{\footnotesize}{\footnotesize\quotefont}{}{}
\newcommand\qfootnote[3][arabic]{%
       \defcounter{mpfootnote}{#2-1}%
       \renewcommand\@makefntext[1]{\noindent\makebox[.5em][l]{\@makefnmark}##1}%
       \renewcommand{\thempfootnote}{\quotefont\csname#1\endcsname{mpfootnote}}%
       \footnote{#3}}
% Use of the \qfootnote command:
% \qfootnote[<format>]{<number>}{<text>} (default is arabic)
% example: \qfootnote[alph]{3}{text} will yield 'c' as the footnote marker.
% example: \qfootnote[roman]{4}{text} will yield 'iv' as the marker
% example: \qfootnote{2}{text} will yield '2' as the marker
\begin{document}
Some text. This is the main text.\footnote{This is a footnote in the main text.}
\begin{quote}
\begin{minipage}{\linewidth}
This is a quotation with a footnote in it.\qfootnote[alph]{4}{A footnote in the
minipage} The footnote is numbered independently of the rest of the text.
\end{minipage}
\end{quote}

\end{document}

代码输出

简化版

这个答案的第一个版本有一个更简单的解决方案。如果您知道脚注将始终具有相同类型的编号系统,那么您只需在迷你页面中使用常规脚注命令,并使用一个简单的命令来设置脚注编号。我保留了您上一个问题中对引号字体的修改。如果您不需要为引号环境使用不同的字体,那么可以通过删除行和行,并从重新定义中删除来\quotefnum使这变得更简单。AtBeginEnvironment\patchcmd\quotefont\thempfootnote

\documentclass{article}

\usepackage{etoolbox}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\newfontfamily\quotefont{Linux Biolinum O}
\AtBeginEnvironment{quote}{\quotefont\small}
\makeatletter
\patchcmd{\@mpfootnotetext}{\footnotesize}{\footnotesize\quotefont}{}{}
\makeatother
\newcommand*\quotefnum[1]{\defcounter{mpfootnote}{#1-1}}

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

\begin{document}
Some text. This is the main text.\footnote{This is a footnote in the main text.}
\begin{quote}
\begin{minipage}{\linewidth}
\quotefnum{4}
This is a quotation with a footnote in it.\footnote{A footnote in the minipage}. The footnote is numbered independently of the rest of the text.
\end{minipage}
\end{quote}

\end{document}

答案2

一种可能的简单方法是使用环境minipage内部quote

\documentclass{article}
\usepackage{lipsum}

\begin{document}

\lipsum[1]
\begin{quote}
\begin{minipage}{\linewidth}
\stepcounter{footnote}
\renewcommand\thempfootnote{\arabic{footnote}}
\lipsum[1] text\footnote{this is a footnote} text text text.
\end{minipage}
\end{quote}

\end{document}

在此处输入图片描述

这是我的答案的增强版本:现在一切都通过一个新环境来实现,fnquote该环境重新定义并适当调整计数器并像图像中那样格式化脚注标记(抑制缩进):

\documentclass{article}
\usepackage{lipsum}

\makeatletter
\newenvironment{fnquote}
  {\begin{quote}
  \begin{minipage}{\linewidth}\stepcounter{footnote}
  \renewcommand\thempfootnote{\arabic{footnote}}
  \renewcommand\@makefntext[1]{\noindent\makebox[1.2em][l]{\@makefnmark}##1}}
  {\end{minipage}\end{quote}}
\makeatother

\begin{document}

\lipsum[1]
\begin{fnquote}
\lipsum[1] text\footnote{this is a footnote} text text text.
\end{fnquote}

\end{document}

在此处输入图片描述

新版本;新的命令 \qtfootnote 可用,允许手动指定脚注标记的值:

\documentclass{article}
\usepackage{lipsum}

\newcounter{tmpfn}

\makeatletter
\newenvironment{fnquote}
  {\begin{quote}
  \begin{minipage}{\linewidth}
  \renewcommand\thempfootnote{\arabic{mpfootnote}}
  \renewcommand\@makefntext[1]{\noindent\makebox[1.2em][l]{\@makefnmark}##1}
  }
  {\end{minipage}\end{quote}}
\makeatother
\newcommand\qtfootnote[2]{%
  \setcounter{tmpfn}{\thempfootnote}%
  \setcounter{mpfootnote}{#1}\addtocounter{mpfootnote}{-1}%
  \footnote{#2}%
  \setcounter{mpfootnote}{\thetmpfn}}

\begin{document}

\lipsum[1]
\begin{fnquote}
\lipsum[1] text\qtfootnote{5}{this is a footnote} text text text.
\end{fnquote}

\end{document}

在此处输入图片描述

而第四个版本,现在通过使用包提供的功能,代码已经大大简化nccfoots;现在可以轻松地自由分配脚注标记(阿拉伯字母、字母、罗马字母等):

\documentclass{article}
\usepackage{nccfoots}

\newcommand\Text{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
Donec vehicula augue eu neque.}

\makeatletter
\newenvironment{fnquote}
  {\begin{quote}\begin{minipage}{\linewidth}
  \renewcommand\@makefntext[1]{\noindent\makebox[1em][l]{\@makefnmark}##1}}
  {\end{minipage}\end{quote}}
\makeatother
\newcommand\qtfootnote[2]{\Footnotemark{#1}\Footnotetext{#1}{#2}}

\begin{document}

\Text
\begin{fnquote}
\Text text text text text\qtfootnote{4}{this is a footnote} text text.
\end{fnquote}
\begin{fnquote}
\Text text text text text\qtfootnote{d}{this is a footnote} text text.
\end{fnquote}
\begin{fnquote}
\Text text text text text\qtfootnote{IV}{this is a footnote} text text.
\end{fnquote}

\end{document}

在此处输入图片描述

答案3

您可以将“内部”放置quoteminipage宽度\linewidth。 内的脚注minipage将在关闭时被清除。

这是一个简单的例子:

在此处输入图片描述

\documentclass{article}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
Vestibulum laoreet tincidunt convallis. Praesent eu purus 
mauris. Aliquam erat volutpat. Vivamus convallis neque 
rutrum lorem imperdiet egestas. Suspendisse potenti. Morbi 
posuere convallis mauris quis imperdiet.
\begin{quote}
  \begin{minipage}{\linewidth}
    Nunc suscipit gravida sollicitudin. Donec molestie libero nunc, 
    ac adipiscing odio. Pellentesque consectetur\footnote{Pellentesque 
    sed ante id nisl iaculis sagittis.} nulla vel nunc 
    blandit dapibus. Cum sociis natoque penatibus et magnis dis 
    parturient montes, nascetur ridiculus mus.
  \end{minipage}
\end{quote}
Morbi sodales arcu enim, et accumsan ante. Mauris sed ante erat. 
Praesent scelerisque metus ac mauris placerat vehicula. 
Nam tristique faucibus felis sed consectetur.
\end{document}

可以根据需要修改脚注编号。也许更明智的做法是定义一个blockquote包罗万象的环境:

\newenvironment{blockquote}[1]
  {\list{}{\rightmargin\leftmargin}% \begin{blockquote}
   \item\relax\minipage{\linewidth}%
   \setcounter{mpfootnote}{\numexpr#1-1}%
   \renewcommand{\thempfootnote}{\arabic{mpfootnote}}}
  {\endminipage\endlist}% \end{blockquote}

现在您可以使用

%...
\begin{blockquote}{5}
  Nunc suscipit gravida sollicitudin. Donec molestie libero nunc, 
  ac adipiscing odio. Pellentesque consectetur\footnote{Pellentesque 
  sed ante id nisl iaculis sagittis.} nulla vel nunc 
  blandit dapibus. Cum sociis natoque penatibus et magnis dis 
  parturient montes, nascetur ridiculus mus.
\end{blockquote}
%...

产生一个特定于数字的脚注:

在此处输入图片描述

指定这些具体的参考可能与hyperref. 现在可以在环境中包含附加定义blockquote

答案4

感谢大家的回答!以下是我最终所做的——对答案中表达的一些想法进行了简化和统一。

我的课程定义了一个自定义命令:

% Set the footnote number inside a minipage to a custom number
\newcommand*\footnoteNum[1]{%
    \defcounter{mpfootnote}{#1-1}
    % Set numbering to arabic
    \renewcommand{\thempfootnote}{\arabic{mpfootnote}}}

然后我在文本中使用它如下:

\begin{quote}
    \begin{minipage}{\linewidth}\footnoteNum{4} 
        “C douzième siècle,\footnote{``Publicus scriba.''}
        que le célèbre mathématicien Léonard Bonacci de            
        l’arithmétique, de l’algèbre et de la géométrie.
    \end{minipage}
\end{quote}

我喜欢这种方法的原因是:

  1. 它离开了通常的环境,如quote未修改的一样。无需记住听起来很奇怪的名字。
  2. 它调用footnote命令 - 同样,无需记住自定义命令名称。
  3. 它遵循常规脚注的常识:如果用户没有将其包装在小页面中,脚注将出现在页面底部。
  4. footnoteNum命令虽然不明显,但却很容易弄清楚,因为在编译文档并发现脚注编号为后a,用户会怀疑自己错过了一些东西,并记得设置脚注编号。

再次感谢大家的回答 - 但没有一个答案正是我需要的,所以为了后代,我想提供我自己的版本。:-)

相关内容