I can't make use of todonotes
(or marginnote
but this isn't in the MWE because I don't think I have the prerequisites setup for this correctly) in an inline enumerated list.
I think I am getting the margin par error because I am in an align environment (maybe I am wrong here) I tried to augment my function with a check for the align environment so that I could provide an alternative to switch to marginnote
but this didn't work.
Actually, this align check won't even compile so I have had to comment it out.
I don't know if this makes any difference, but in my non-MWE example this new command is in a cls file, and as you can see below I have tried with and without the \makeatletter
/
\documentclass{article}
\usepackage{expl3}
\usepackage{xparse}
\usepackage{xpatch}
\usepackage{letltxmacro}
\usepackage{amsmath}
\usepackage{todonotes}
\usepackage{marginnote}
\usepackage{enumerate}
\usepackage[shortlabels,inline]{enumitem}
%\makeatletter
\DeclareDocumentCommand{\TODOblock}{ O{@general} +m }
{
\ifdefined\HCode
\textbf{\textbf{(NOTE: #2)}}
\else
%\IfNoValueF {#2} { lightslategray }
\todo[inline,color=#1]{\unexpanded{\unexpanded{\textbf{#1:\\}#2}}}
\fi
}
\DeclareDocumentCommand{\TODOnote}{ O{@general} +m }
{
\ifdefined\HCode
\textbf{\textbf{(NOTE: #2)}}
\else
%\ifinalign@
% TEXT%\marginnote[size=\scriptsize,color=#1]{\unexpanded{\unexpanded{\textbf{#1:\\}#2}}}
%\else
\todo[size=\scriptsize,color=orange]{\unexpanded{\unexpanded{\textbf{#1:\\}#2}}}
%\fi
\fi
}
%\makeatother
\begin{document}
Hi heres a list \TODOnote{Of course I can do this}
\begin{enumerate}
\item an item \TODOnote{I can do this}
\item next item
\end{enumerate}
Hi heres a list that is inline
\begin{enumerate*}
\item an item
\item next item %\TODOnote{I can't do this}
\end{enumerate*}
\end{document}
UPDATE
In response to an answer that seems to have been removed, I tried nesting my custom TODO in a marginpar i.e.: \marginnote{\todo[inline,size=\scriptsize,color=orange]{\unexpanded{\unexpanded{\textbf{#1:\\}#2}}}}
but this doesn't align the boxes well when there are a lot of comments virtually stacked upon each other. This did get around the align problem, but the align detection still doesn't work, so I can't make use of this possibility even specifically for the limited occurrences of the align environments.
UPDATE 2
This answer that was removed also proposed a work around of using an inline version. I would be fine with this as a limited work around in the few align environments I have, but this still hinges on the \ifinalign@
structure working...
\ifinalign@
is true inamsmath
display environments and has nothing to do withenumerate*
. The problem is, apparently, thatenumerate*
is typeset in a box and\todo
wants to be at the outer level.