
Dentro de uma minipágina utilizo notas de rodapé que devem ser impressas no final da minipágina. Eu também uso marginnote
e redefino \marginpar
be \marginnote
, porque os uso dentro de outros carros alegóricos (principalmente, carros alegóricos). Além disso, costumo todonotes
imprimir, enfim, todos na margem.
Se eu usar tudo junto, uma todonote em uma minipágina "engole" todas as notas de rodapé que já foram digitadas mas ainda não impressas e imprime as notas de rodapé em sua própria parte inferior, ou seja, na parte inferior da todonote.
MWE
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{marginnote} % Enhanced marginpar
\usepackage{todonotes}
%
% We need to redefine \marginpar.
% \marginpar does not work inside floats, but \marginnote does.
% Also \todo uses \marginpar internally and this way it actually uses \marginnote.
% See manual for marginnote and sec. 1.6.8 in the manual for todonotes.
%
\renewcommand{\marginpar}{\marginnote}
\begin{document}
\begin{figure}[htbp]\centering
\begin{minipage}{.5\linewidth}
This is a sentence with a footnote.\footnote{It only serves as an example.}
Now a sentence with \todo{The footnote ends up in the margin.}a \texttt{todo}-note follows.
However, the last footnote is printed at the end of the minipage\footnote{Because it is inserted after the \texttt{todo}-note.}.
\end{minipage}
\end{figure}
\end{document}
A saída:
Como posso corrigir esse comportamento? Nb, noto que preciso ou uso notas de rodapé dentro de uma todonote ou qualquer outra nota de margem. Portanto, uma solução viável poderia ser desativar as notas de rodapé das notas marginais, se isso for possível.
MWE estendido para corrigir o bug da resposta abaixo
Oresposta originalmente proposta(veja abaixo) possui alguns bugs apontados pelo seguinte MWE estendido: a) Também desenha uma linha de separação, se a minipágina não contiver nenhuma nota de rodapé. b) As notas de rodapé são completamente perdidas, se for utilizado um ambiente de lista dentro da minipágina.
\documentclass[american]{article}
\usepackage[TS1,T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{marginnote}
\usepackage{todonotes}
%
% We need to redefine \marginpar.
% \marginpar does not work inside floats, but \marginnote does.
% Also \todo uses \marginpar internally and this way it actually uses \marginnote.
% See manual for marginnote and sec. 1.6.8 in the manual for todonotes.
%
\renewcommand{\marginpar}{\marginnote}
\newsavebox{\mpfootsave}
\makeatletter
\newcommand{\mytodo}[1]{%
\setbox\mpfootsave=\vbox{\unvbox\@mpfootins}%
\todo[caption={}]{#1}%
\setbox\@mpfootins=\vbox{\unvbox\mpfootsave}%
}
\makeatother
\begin{document}
\begin{figure}[htbp]\centering
\begin{minipage}{.7\linewidth}
This is a sentence with a footnote.\footnote{It only serves as an example.}
Now a sentence with \mytodo{The footnote ends up in the margin.}a \texttt{todo}-note follows.
However, the last footnote is printed at the end of the minipage\footnote{Because it is inserted after the \texttt{todo}-note.}.
\end{minipage}
\end{figure}
\begin{figure}[htbp]\centering
\begin{minipage}{.7\linewidth}
The solution works only partially, if there is no footnote after the last \mytodo{Like this}\texttt{todo}-note.
The seperation line is printed even if there is no footnote at all.
\end{minipage}
\end{figure}
\begin{figure}[htbp]\centering
\begin{minipage}{.7\linewidth}
\begin{enumerate}
\item
Even with an enumeration, the \mytodo{Another todo}solution works.
But only if the footnote comes last.\footnote{It only serves as an example.}
\end{enumerate}
\end{minipage}
\end{figure}
\begin{figure}[htbp]\centering
\begin{minipage}{.7\linewidth}
\begin{enumerate}
\item
But the solution\footnote{Actually, the proposed solution.} fails in combination with an enumeration, if a \mytodo{Yet another todo}\texttt{todo}-note appears after the last footnote.
\end{enumerate}
\end{minipage}
\end{figure}
\end{document}
Resultado:
Responder1
Evidentemente \todo
usa uma minipágina em vez de um arquivo \parbox
. A mesma coisa ocorre ao aninhar minipáginas com notas de rodapé.
Esta solução salva a nota de rodapé antes \todo
e a restaura depois.
Observe que ele \@mpfootins
é salvo globalmente, o que permite que as notas de rodapé saiam dos grupos. Mas como \footsave
é salvo localmente, pode-se usar essa abordagem para corrigir minipáginas aninhadas em geral.
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{marginnote} % Enhanced marginpar
\usepackage{todonotes}
%
% We need to redefine \marginpar.
% \marginpar does not work inside floats, but \marginnote does.
% Also \todo uses \marginpar internally and this way it actually uses \marginnote.
% See manual for marginnote and sec. 1.6.8 in the manual for todonotes.
%
\renewcommand{\marginpar}{\marginnote}
\newsavebox{\footsave}
\makeatletter
\newcommand{\mytodo}[2][]{% same arguments as \todo
\setbox\footsave=\box\@mpfootins
\todo[#1]{#2}%
\global\setbox\@mpfootins=\box\footsave}
\makeatother
\begin{document}
\begin{figure}[htbp]\centering
\begin{minipage}{.7\linewidth}
This is a sentence with a footnote.\footnote{It only serves as an example.}
Now a sentence with \mytodo{The footnote ends up in the margin.}a \texttt{todo}-note follows.
However, the last footnote is printed at the end of the minipage\footnote{Because it is inserted after the \texttt{todo}-note.}.
\end{minipage}
\end{figure}
\begin{figure}[htbp]\centering
\begin{minipage}{.7\linewidth}
The solution works only partially, if there is no footnote after the last \mytodo{Like this}\texttt{todo}-note.
The seperation line is printed even if there is no footnote at all.
\end{minipage}
\end{figure}
\begin{figure}[htbp]\centering
\begin{minipage}{.7\linewidth}
\begin{enumerate}
\item
Even with an enumeration, the \mytodo{Another todo}solution works.
But only if the footnote comes last.\footnote{It only serves as an example.}
\end{enumerate}
\end{minipage}
\end{figure}
\begin{figure}[htbp]\centering
\begin{minipage}{.7\linewidth}
\begin{enumerate}
\item
But the solution\footnote{Actually, the proposed solution.} fails in combination with an enumeration, if a \mytodo{Yet another todo}\texttt{todo}-note appears after the last footnote.
\end{enumerate}
\end{minipage}
\end{figure}
\end{document}