I am using the answer to this question: Drawing tikz line in the margin for multiple pages to draw a colored line on the margin of my document.
I would like to have a possibility to comment out the environment definition and acquire the same document without the colored line. But when I replace the outline environment definition with an empty one, the document has a different alignment.
MWE:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\newenvironment{outline}{\ignorespaces}{\ignorespaces}
\newcounter{markid}
% Comment this out to disable the marking of text:
\renewenvironment{outline}{\tikzmark{begin\themarkid}}{\ignorespaces\tikzmark{begin\themarkid}}
\begin{document}
\section{Section}
\begin{outline}
\begin{figure}[h!]
\caption{caption}
\end{figure}
Paragraph1
\end{outline}
\end{document}
The example above has additional empty space when the \renewenvironment is uncommented.
The only solution I have come up with so far is to take care that the environments' begin/end tags are in one block with paragraphs. (Therefore it seems to me that the \tikzmark command makes LaTeX create an additional, empty paragraph.)
Is there any other solution which would ensure that the \tikzmark commands don't change the outline of the document?
\pgfmark{...}is between an\end{itemize}and\section{}-- there is still extra free space. Any suggestions? – Adam Sep 03 '18 at 22:31