0

I've managed to use eso-pic + calc packages in order to draw a vertical line on the right margin between a "begin" and an "end" statement.

I made this for manuscript review in order to ease reading and commenting tasks for my thesis supervisors : the line is drawn between \NEW and \ENDNEW in order to make the location of new writings obvious to them.

I'm pretty happy with what I've got right now but there is still one thing that bothers me: the line is missing the last page!


In my preambule:

\usepackage{eso-pic,calc}
\newlength{\rightrule}
\setlength{\rightrule}{4\leftmargin+\textwidth+\marginparsep}

\newcommand{\MarginLineNew}{\AddToShipoutPicture{%
   \AtPageLowerLeft{%
     \put(\LenToUnit{\rightrule},0){\rule{1pt}{\paperheight}}  % Rule on the right
   }
}}

%start label for new stuff
\newcommand{\NEW}{\MarginLineNew}

%end label for new stuff
\newcommand{\ENDNEW}{\ClearShipoutPicture{}}

In the document:

[...]
Some text
[...]
\NEW

Some text
[...]

\ENDNEW

Obviously, calling \ENDNEW sets the current page with \ClearShipoutPicture while I'd need it to apply on the next page, but I don't know how if it's possible to refer to page +1 with this function.

Any ideas with that ?

0

A workaround is to add a hook for the current page only after you clear the shipout picture, using the starred version \AddToShipoutPicture*.

MWE:

\documentclass{article}
\usepackage{lipsum}
\usepackage{eso-pic,calc}
\newlength{\rightrule}
\setlength{\rightrule}{6\leftmargin+\textwidth+\marginparsep}

\newcommand{\MarginLineNew}{\AddToShipoutPicture{%
   \AtPageLowerLeft{%
     \put(\LenToUnit{\rightrule},0){\rule{1pt}{\paperheight}}  % Rule on the right
   }
}}
\newcommand{\MarginLineCurrent}{\AddToShipoutPicture*{%
   \AtPageLowerLeft{%
     \put(\LenToUnit{\rightrule},0){\rule{1pt}{\paperheight}}  % Rule on the right
   }
}}

%start label for new stuff
\newcommand{\NEW}{\MarginLineNew}

%end label for new stuff
\newcommand{\ENDNEW}{\ClearShipoutPicture\MarginLineCurrent}

\begin{document}
\NEW
\section{new part}
\lipsum[1-6]
\ENDNEW
\section{old part}
\lipsum[6-20]
\end{document}

Result:

enter image description here

1
  • Works like a charm! Thank you very much ! :-)
    – Etsaf
    Dec 23 '20 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.