# float within fixme target doesn't get color

I don't know if this is possible, but I would like the abillity to put floats inside a fixme target, and then get the caption and contents of the float to be colored.

Here's my current example:

\documentclass{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[draft]{fixme}
\fxsetup{theme=color}
\begin{document}
\fxerror*{this is wrong right now}{ text and $math$ plays nice
\begin{table}
\centering
\begin{tabular}{cc}
1&1\\1&1
\end{tabular}
\caption{Hello there}
\label{tab:somelabel}
\end{table}
}
\end{document}


which yields:

It would be really cool to have the table and caption also colored in

• It is probably never a good idea to place a float inside a macro and think it applies to the float. In its very nature a float is removed from the normal processing of the document, and reinserted when the page is assembled. What are you even trying to do here? – daleif Feb 9 '18 at 15:36
• @daleif The color of the text and $math$ plays nice should also apply to the table and caption, That way people could see that the table was wrong from my fixme note (I don't care if it floats away, but if it had the same color as the text below it it would be clear that it was attatched to an error somewhere) – Thorbjørn E. K. Christensen Feb 9 '18 at 15:39
• Since you're using memoir, we can actually do something about this, but we need to hook into \fxerror*, which I have not figured out how to do automatically just yet. But in my test, placing \setfloatadjustment{table}{\color{red}} explictly before \begin{table} inside the second arg to \fxerror* does color the table, and only this table. – daleif Feb 9 '18 at 15:45
• The only reason for table is to declare the content as not part of the current document flow but rather a moveable block that can be inserted at a place convenient for page breaking, so latex goes to some effort to ensure that the line width, font and colour are not inherited. Just use atabular directly if you want it to be inside the note. – David Carlisle Feb 9 '18 at 15:49
• @daleif I think there is a color from fixme called fxtarget that should be used on the targts in the text XD – Thorbjørn E. K. Christensen Feb 9 '18 at 15:52

Since you are using memoir where are some possibilities we can use. We just need to dig up the right fixme macros to mess with (you might want to send a feature request to the fixme maintainer)

This seems to do what you are after

\documentclass{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[
draft,
%final
]{fixme}
\fxsetup{theme=color}

\usepackage{etoolbox}

\makeatletter
% only add it when final is not active
\@ifpackagewith{fixme}{final}{}{
\patchcmd\@fxtargetlayout@draft{\begingroup}{%
\begingroup%
}{\typeout{patch ok}}{\typeout{patch not working}}
% this let is the annoying part, \@fxtargetlayout is activated
% using \let, meaning any later readjustments to
% \@fxtargetlayout@draft is not applited unlet we let it again
\let\@fxtargetlayout\@fxtargetlayout@draft%
}
\makeatother

\begin{document}
\fxerror*{this is wrong right now}{ text and $math$ plays nice
\begin{table}
\centering
\begin{tabular}{cc}
1&1\\1&1
\end{tabular}
\caption{Hello there}
\label{tab:somelabel}
\end{table}
}

\begin{table}
\centering
\begin{tabular}{cc}
1&1\\1&1
\end{tabular}
\caption{A non fx error table}
\end{table}
\end{document}

• @ThorbjørnE.K.Christensen You can also swing by 1530.221 if you're in MatKant sometime. – daleif Feb 9 '18 at 16:40
• I would love to, but I'm currently an exchange student in Finland ;-) – Thorbjørn E. K. Christensen Feb 9 '18 at 16:46
• @ThorbjørnE.K.Christensen hehe – daleif Feb 9 '18 at 16:49