为了缩进我的证明,我开发了一个包来在我的证明旁边画线(见示例这里)。它可以正常工作,但是当在页面顶部添加图形时,线条会与图片重叠(我用它current page text area.north east
来检测应该在哪里停止):这是一个 MWE,我想在红线之前停止该线,例如 tcolorbox(即左侧的线,我不能使用它,因为它有嵌套框的其他问题):
我问过类似的问题,关于脚注这里footnoterule
,我通过添加 tikzmark成功解决了这个问题:
\def\footnoterule{\edef\my@tmp{\noexpand\tikzmark{subproofPageNumberFootnote\the\c@abspage}}\my@tmp\oldfootnoterule}
不幸的是,我不知道如何对图形做类似的事情。是否有一个命令可用于将图形与正文分开,我可以将其挂接进去?请注意,我希望我的方法尽可能通用,同时考虑任何类型的浮动。
梅威瑟:
\documentclass[]{memoir}
\usepackage{tikz}
\RequirePackage{amsmath}
\RequirePackage{amsthm}
\usepackage{graphicx}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc,tikzmark}
%%% Tcolorbox does a pretty good job to find the position where lines should be stopped...
%%% but they can't be nested.
\RequirePackage[many]{tcolorbox}
\tcolorboxenvironment{proof}{
blanker,
before skip=\topsep,
after skip=\topsep,
borderline west={0.4pt}{0.4pt}{black},
breakable,
left=2.5mm,
grow to left by=2.5mm,
}
\usepackage{lipsum}
\begin{document}
Here is my document. Blabla \footnote{Here is my first foot note.} blabla \footnote{Here is my second foot note.}.
\begin{proof}
\lipsum[1-2]
\begin{adjustwidth}{5mm}{0mm}
\lipsum[1-3]
\tikzmark{hello}
%% Draw the line, which overlaps the picture
\tikz[remember picture,overlay] \draw (pic cs:hello) -- ({pic cs:hello}|-{current page text area.north east});
\end{adjustwidth}
\end{proof}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{example-image-a}
\caption{Test figure}
\label{fig:bla}
\end{figure}
\lipsum[1]
\end{document}