0

In order to indent my proofs, I developed a package to draw lines next to my proofs (see examples here). It works ok, but when a figure is added on top of the page, the line overlaps the picture (I'm using current page text area.north east to detect where I should stop): Here is a MWE, I want to stop the line before the red line, like tcolorbox (that is the line on the left, and that I can't use because it has other issues with nested boxes):

enter image description here

I asked a similar question for footnotes here, that I managed to solve by hooking into footnoterule to add a tikzmark:

\def\footnoterule{\edef\my@tmp{\noexpand\tikzmark{subproofPageNumberFootnote\the\c@abspage}}\my@tmp\oldfootnoterule}

unfortunately I have no idea how to do something similar for figures. Is there a command that is used to separate the figure from the main text that I could hook into? Note that I'd like my approach to be as generic as possible, to also take into account any sort of float.

MWE:

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

tobiasBora
  • 8,684
  • Do you want those vertical rules left to text, math or both? Why can't you achieve it by redefining appearance of paragraphs? – MS-SPO Feb 17 '23 at 12:55
  • floats are added to the page in the output routine, and imho it would be quite hard to track all the cases. – Ulrike Fischer Feb 17 '23 at 15:15
  • @MS-SPO lines should be on the left of both math and text. If redefining paragraphs allows that, it's great, but I can't find any reliable way to do it, and I'm affraid to get issues to get a continuous line between multiple equations/paragraphs… Do you have an example to achieve that by any chance? – tobiasBora Feb 17 '23 at 17:08
  • @UlrikeFischer but how does tcolorbox manages to handle that? I don't care to recompile multiple times. – tobiasBora Feb 17 '23 at 17:09
  • @tobiasBora, I scanned ctan a little for Proof (https://ctan.org/topic/proof) before I knew your requirements. May be you can adopt one of these approaches: ribbonproofs (tikz?), natded, calculation . ebproof has a different objective. – MS-SPO Feb 17 '23 at 17:27
  • tcolorbox are boxes, and adding a rule at the side of a box is rather trivial. But breaking such boxes over pages is not trivial, and nesting breakable boxes even less. – Ulrike Fischer Feb 17 '23 at 18:30
  • 1
    @MS-SPO thanks, but none of these packages do anything close to my need. I just want to type normal proofs, but indent them when I prove a subgoal. Importantly, large proofs should be displayed nicely on multiple pages. – tobiasBora Feb 18 '23 at 18:05
  • @UlrikeFischer Ok I see, thanks… but don't you have at least a first idea to allow me to go further? I guess after a first compilation, LaTeX mostly knows where floats are placed, so it should somehow be accessible, no? Otherwise, I can think of very dirty code that add a tikzmark for every new line, and then check the higher tikzmark in the current page to detect where it should start… but that sounds horrible and I'm not even sure how to add a stuff at the beginning of every new line (but I think to remember that it's somehow possible) – tobiasBora Feb 18 '23 at 18:08

0 Answers0