Combining this solution to draw braces with tikzmarks, with this to make them go across page boundaries, presents me with an interesting problem: It won't print the vertical part on the first page if tikzmark sits in an environment.
Edit: I'm using code from the latest update to the tikzmark package that includes the \iftikzmarkoncurrentpage macro, which I added below too.
% !TEX TS-program = xelatexmk
\documentclass{article}
\usepackage[paperwidth=3in,paperheight=1in]{geometry}
\usepackage{tikz}
\usepackage{tikzpagenodes}
\usetikzlibrary{tikzmark}
\newcounter{tikzmarklines}\setcounter{tikzmarklines}{0} %
% The following code provides the iftikzmarkoncurrentpage macro
\makeatletter
\newif\iftikzmark@
\renewcommand\iftikzmark[3]{%
\@ifundefined{save@pt@\tikzmark@pp@name{#1}}{%
#3%
}{%
#2%
}%
}%
\newcommand\iftikzmarkexists[1]{%
\@ifundefined{save@pt@\tikzmark@pp@name{#1}}{%
\tikzmark@false%
}{%
\tikzmark@true%
}%
\iftikzmark@
}%
\newcommand\iftikzmarkonpage[2]{%
\@ifundefined{save@pt@\tikzmark@pp@name{#1}}{%
\tikzmark@false
}{%
\@ifundefined{save@pg@\csname save@pt@\tikzmark@pp@name{#1}\endcsname}{%
\tikzmark@false
}{%
\ifnum\csname save@pg@\csname save@pt@\tikzmark@pp@name{#1}\endcsname\endcsname=#2\relax%
\tikzmark@true
\else
\tikzmark@false
\fi
}%
}%
\iftikzmark@
}
\newcommand\iftikzmarkoncurrentpage[1]{%
\@ifundefined{save@pt@\tikzmark@pp@name{#1}}{%
\tikzmark@false
}{%
\@ifundefined{save@pg@\csname save@pt@\tikzmark@pp@name{#1}\endcsname}{%
\tikzmark@false
}{%
\ifnum\csname save@pg@\csname save@pt@\tikzmark@pp@name{#1}\endcsname\endcsname=\the\value{page}\relax%
\tikzmark@true
\else
\tikzmark@false
\fi
}%
}%
\iftikzmark@
}
\makeatother
\tikzset{
next page=below,
brace/.style n args={2}{insert path={%
([xshift=0.15em,yshift=0.1pt+.5ex]#1) --
([xshift=-0.3pt,yshift=0.1pt+.5ex]#1) --
([xshift=-0.3pt,yshift=-0.1pt+.5ex]#2) --
([xshift=0.15em,yshift=-0.1pt+.5ex]#2) --
([xshift=0.15em,yshift=0.1pt+.5ex]#2) --
([xshift=0.3pt,yshift=0.1pt+.5ex]#2) --
([xshift=0.3pt,yshift=-0.1pt+.5ex]#1) --
([xshift=0.15em,yshift=-0.1pt+.5ex]#1) --
cycle}}}
\newif\iffirstmark
\newcommand{\linestart}{%
\stepcounter{tikzmarklines}%
\tikzmark{a\thetikzmarklines}%
\firstmarktrue
\iftikzmarkoncurrentpage{b\thetikzmarklines}%
\else
\begin{tikzpicture}[remember picture,overlay,next page=below]%
\clip (current page text area.south west) rectangle (current page text area.north east);
\fill[overlay,brace={pic cs:a\thetikzmarklines}{pic cs:b\thetikzmarklines}];
\end{tikzpicture}%
\fi
}
\newcommand{\linefinish}{%
\iffirstmark
\tikzmark{b\thetikzmarklines}%
\firstmarkfalse
\fi
\begin{tikzpicture}[remember picture,overlay]%
\clip (current page text area.south west) rectangle (current page text area.north east);
\fill[overlay,brace={pic cs:a\thetikzmarklines}{0,0}];
\end{tikzpicture}%
}
\begin{document}
% This works fine:
Text \linestart text text
\newpage
Text text \linefinish text
% But not this
\begin{center} Text \linestart text text \end {center}
\newpage
\begin{center} Text text \linefinish text \end {center}
\end{document}
Only the little hook is printed on the second page, but not the vertical line to page 3.
Any ideas?


tikzmark? I get an error! Undefined control sequence. \linestart ...stmarktrue \iftikzmarkoncurrentpage {b\thetikzmarklines }\else..– Apr 11 '19 at 09:28\iftikzmarkoncurrentpagecommand which is used here. – jan Apr 11 '19 at 09:29