floatrow 包中的 \floatfoot 导致意外的颜色变化

floatrow 包中的 \floatfoot 导致意外的颜色变化

我用floatrow它来格式化我的浮点数,并注意到一些意外行为。在\InsertTable我创建的命令中,如果存在最后一个可选[]参数(该参数应该是可选的表格脚注),则下一段中的以下文本颜色将更改为黑色(而它应该是白色)。我已将其追溯到命令\floatfoot。也许这是一个小错误?它出现在 CTAN 上,这个包自 2009 年以来就没有更新过,也许我应该考虑使用其他包来帮助我的浮点数?

启用 [脚注] 后 注释掉 [脚注]

\documentclass{scrartcl}
\usepackage{xcolor}
\usepackage{ifthen}
\usepackage{xparse}

\usepackage{floatrow}

\NewDocumentCommand{\DoIfnotEmpty}{m m O{}}{\ifthenelse{\equal{#1}{}}{#3}{#2}}

\NewDocumentCommand{\InsertTable}{ s O{htbp} D<>{} m m O{#5} m O{} }{%
    \begin{table}[#2]% htbp! settings
        #3% pre-amble
        \IfBooleanTF{#1}{% if star, use the wide format
            \captionsetup{labelformat=default}\floatsetup{margins=raggedright}%
            \RawCaption{\caption[#6]{#5}}#7% caption outside ttbabbox, and freed from float width
            \ttabbox{}{#4\DoIfnotEmpty{#8}{\vspace{1ex}\floatfoot*{#8}}}% if no star then use hanging
        }{% if not, use the hanging style
            \ttabbox{\caption[#6]{#5}#7}{#4\DoIfnotEmpty{#8}{\vspace{1ex}\floatfoot*{#8}}}%  if floatfoot removed, expected behaviour
        }%
    \end{table}%
}

\pagecolor[rgb]{0.2,0.2,0.25}
\color[rgb]{0.98,0.98,0.93}

\begin{document}

\section{Section}

hello

\InsertTable[htbp]%
{A placeholder for a table}%
{Caption}%
{\label{t.label}}%
[Footnote]% complied with this here, or commented out. Different colors on next paragraph

\section{Section}

This part is black (when white is expected) if the table above has a footnote (final argument present).
It appears that floatfoot* causes this.

\end{document}

答案1

floatrow 不保护 \normalcolor,因此它会在表格之后重置颜色。你可以试试这个

\makeatletter
\renewcommand\FB@putfoots{%
  \ifvoid\flrow@foot\else\FR@ifFOOT
    {\vskip\floatfootskip\color@begingroup\normalcolor
    \unvbox\flrow@foot\@@par\color@endgroup}\relax
  \fi} 
\makeatother  

相关内容