여백을 사용하는 할일 노트가 할일 노트 하단에 표시되기 전 미니페이지 내부의 각주

여백을 사용하는 할일 노트가 할일 노트 하단에 표시되기 전 미니페이지 내부의 각주

미니페이지 내에서는 미니페이지 끝에 인쇄되어야 하는 각주를 사용합니다. 나는 또한 다른 부동 소수점(주로 그림 부동 소수점) 내에서 사용하기 때문에 be를 사용 marginnote하고 다시 정의합니다 . 게다가 나는 여백에 할 일을 인쇄하는 데 사용합니다.\marginpar\marginnotetodonotes

모든 항목을 함께 사용하면 미니페이지의 todonote는 이미 입력했지만 아직 인쇄되지 않은 모든 각주를 "삼키고" 자체 하단, 즉 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}

출력:

위치가 잘못된 각주

이 동작을 어떻게 수정합니까? 참고로, 할 일 노트나 기타 여백 노트 안에 각주가 필요하거나 사용합니다. 따라서 실행 가능한 해결책은 가능하다면 여백 메모에 대한 각주를 비활성화하는 것입니다.

아래 답변을 버그 수정하기 위해 MWE를 확장했습니다.

그만큼원래 제안된 답변(아래 참조)에는 다음 확장 MWE에서 지적한 대로 몇 가지 버그가 있습니다. a) 미니페이지에 각주가 없으면 구분선도 그립니다. b) 미니페이지 내에서 목록 환경을 사용하면 각주가 완전히 사라집니다.

\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}

결과:

확장된 MWE

답변1

분명히 .\todo\parbox각주와 함께 미니페이지를 중첩할 때도 동일한 현상이 발생합니다.

이 솔루션은 각주를 이전에 저장 \todo하고 이후에 복원합니다.

\@mpfootins각주가 그룹 밖으로 나갈 수 있도록 전역적으로 저장되는 메모 입니다. 그러나 snce는 \footsave로컬에 저장되므로 이 접근 방식을 사용하여 일반적으로 중첩된 미니페이지를 수정할 수 있습니다.

\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}

관련 정보