我正在使用回忆录文档类并在我的序言中重新定义 fnmark 如下:
\documentclass{memoir}
\usepackage{footnote}
\usepackage[bottom,hang]{footmisc}
\usepackage{xcolor}
\newcommand{\blueboxedfnmark}[1]{%
\begingroup%
\setlength{\fboxsep}{2pt}%
\raisebox{7pt}{\colorbox{blue}{\color{white}{%
\tiny{#1}%
}}}
\endgroup
}
\newcommand{\whiteboxedfnmark}[1]{%
\begingroup%
\setlength{\fboxsep}{2pt}%
\raisebox{7pt}{\colorbox{blue}{\color{white}{%
\tiny{#1}%
}}}
\endgroup
}
\makeatletter % boxes footnote number
\renewcommand{\@makefnmark}{\blueboxedfnmark{\@thefnmark}}
\makeatother
\begin{document}
this is a footnote\footnote{I'm in the footer} in the document text
\end{document}
我希望页脚中的脚注始终使用blueboxedfnmark
,但在某些环境中的脚注使用whiteboxedfnmark
。这可能吗?
答案1
您可以重新定义\footnote
命令,以便首先通过 以一种样式在文本中打印标记\footnotemarker
,然后通过 以默认样式打印脚注\footnotetext
。etoolbox
您可以使用\AtBeginEnvironment
使此类更改适用于特定环境。以下是更改 中的行为的示例quotations
,为了清晰起见white
,将 更改为red
。
\documentclass{memoir}
\usepackage{footnote}
\usepackage[bottom,hang]{footmisc}
\usepackage{xcolor}
\usepackage{etoolbox}
\newcommand{\boxedfnmark}[1]{%
\begingroup%
\setlength{\fboxsep}{2pt}%
\raisebox{7pt}{\colorbox{fnboxcolour}{\color{fntextcolour}{%
\tiny{#1}%
}}}
\endgroup
}
\colorlet{fnboxcolour}{blue}
\colorlet{fntextcolour}{white}
\makeatletter % boxes footnote number
\renewcommand{\@makefnmark}{\boxedfnmark{\@thefnmark}}
\makeatother
\AtBeginEnvironment{quotation}{%
\renewcommand{\footnote}[1]{%
{\colorlet{fnboxcolour}{red}\footnotemark}%
\footnotetext{#1}}}
\begin{document}
This is a footnote\footnote{I'm in the footer} in the document text.
\begin{quotation}
This is a footnote\footnote{I'm in the footer} in a quotation.
\end{quotation}
This is another footnote\footnote{I'm in the footer} in the document
text.
\end{document}