1

In the following MWE (built from https://tex.stackexchange.com/a/170767/69378) I have demonstrated that title text in an overlayed tcolorbox node gets repeated across page breaks.

I have checked the manual against each of the arguments being configured, and tried commenting out ones I thought might be the culprit, but I am always left with this repeated title. Normally this is a fine feature, but I want to be able to selectively turn this off, when the tcolorbox is small and repeating this title just increases clutter.

What is forcing this repeat?

\documentclass{article}
\usepackage[left=60pt,top=60pt,right=60pt,bottom=60pt]{geometry}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{kantlipsum}
\usepackage{enumitem}
\usepackage[many]{tcolorbox}

\setitemize{nolistsep,labelsep=1ex,leftmargin=*}

%% colors---
\definecolor{lightgray}{gray}{0.8}

%%items--
\newlist{items}{description}{1}
\setlist[items]{align=right,font=\normalfont, leftmargin=1.8in,style=nextline,labelsep=1em,}

%% leftrulebox---
\tcbuselibrary{skins,breakable}
\newtcolorbox{leftrulebox}[1][]{
    colback=white,
    boxrule=10pt
    left=0.5ex,
    top=0pt,
    arc=0pt,
    outer arc=0pt,
    enlarge left by=1.8cm,
    enlarge right by=-\dimexpr1.8cm+\parindent\relax,
    right=\dimexpr1.8cm+\parindent\relax,
    leftrule=1pt,
    rightrule=0pt,
    toprule=0pt,
    bottomrule=0pt,
    breakable,
    nobeforeafter,
    enhanced jigsaw,
    overlay={
      \node[anchor=north east,inner ysep=0pt,align=right,text width=1.8cm] 
        at ([yshift=-0.55ex]frame.north west) {\hfill#1};
    },
    before=\vskip2\itemsep\noindent
  }

\begin{document}

\section*{Sample}

\begin{leftrulebox}[Text Title]
\kant[1]
\kant[2]
\kant[3]
\kant[4]
\kant[5]
\end{leftrulebox}

\end{document}

**UPDATE: MWE 2 for intermitent solution **

\documentclass{article}
\usepackage[left=60pt,top=60pt,right=60pt,bottom=60pt]{geometry}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{kantlipsum}
\usepackage{enumitem}
\usepackage[many]{tcolorbox}

\setitemize{nolistsep,labelsep=1ex,leftmargin=*}

%% colors---
\definecolor{lightgray}{gray}{0.8}

%%items--
\newlist{items}{description}{1}
\setlist[items]{align=right,font=\normalfont, leftmargin=1.8in,style=nextline,labelsep=1em,}

%% leftrulebox---
\tcbuselibrary{skins,breakable}
\newtcolorbox{leftrulebox}[1][]{
    colback=white,
    boxrule=10pt
    left=0.5ex,
    top=0pt,
    arc=0pt,
    outer arc=0pt,
    enlarge left by=1.8cm,
    enlarge right by=-\dimexpr1.8cm+\parindent\relax,
    right=\dimexpr1.8cm+\parindent\relax,
    leftrule=1pt,
    rightrule=0pt,
    toprule=0pt,
    bottomrule=0pt,
    breakable,
    nobeforeafter,
    enhanced jigsaw,
    %overlay={
    %   \node[anchor=north east,inner ysep=0pt,align=right,text width=2.6cm] 
    %   at ([yshift=0.5ex]frame.north west) {\hfill#1};%-0.55 hold yshift
    %},
    extras first={
        overlay={%
            \node[anchor=north east,inner ysep=0pt,align=right,text width=2.6cm] 
            at ([yshift=-0.5ex]frame.north west) {\hfill#1};
        },
    },
    extras middle and last={%
        overlay={%
            \node[anchor=north east,inner ysep=0pt,align=right,text width=2.6cm] 
            at ([yshift=-0.5ex]frame.north west) {\hfill};
        },
    },
    %before=\vskip2\itemsep\noindent
    before=\vskip\itemsep\noindent
  }

\begin{document}

\section*{Sample}

\begin{leftrulebox}[Text Title 1]
\kant[1]
\end{leftrulebox}

\begin{leftrulebox}[Text Title 2]
    \kant[2]
\kant[3]
\kant[4]
\kant[5]
\end{leftrulebox}

\begin{leftrulebox}[Text Title 3]
    \kant[3]
    \kant[4]
    \kant[5]
\end{leftrulebox}

\end{document}

2 Answers 2

2

Imho you are looking for the overlay unbroken and first key:

\documentclass{article}
\usepackage[left=60pt,top=60pt,right=60pt,bottom=60pt]{geometry}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{kantlipsum}
\usepackage{enumitem}
\usepackage[many]{tcolorbox}

\setitemize{nolistsep,labelsep=1ex,leftmargin=*}

%% colors---
\definecolor{lightgray}{gray}{0.8}

%%items--
\newlist{items}{description}{1}
\setlist[items]{align=right,font=\normalfont, leftmargin=1.8in,style=nextline,labelsep=1em,}

%% leftrulebox---
\tcbuselibrary{skins,breakable}
\newtcolorbox{leftrulebox}[1][]{
    colback=white,
    boxrule=10pt
    left=0.5ex,
    top=0pt,
    arc=0pt,
    outer arc=0pt,
    enlarge left by=1.8cm,
    enlarge right by=-\dimexpr1.8cm+\parindent\relax,
    right=\dimexpr1.8cm+\parindent\relax,
    leftrule=1pt,
    rightrule=0pt,
    toprule=0pt,
    bottomrule=0pt,
    breakable,
    nobeforeafter,
    enhanced jigsaw,
    overlay unbroken and first={
       \node[anchor=north east,inner ysep=0pt,align=right,text width=2.6cm]
       at ([yshift=0.5ex]frame.north west) {\hfill#1};%-0.55 hold yshift
    },
    %before=\vskip2\itemsep\noindent
    before=\vskip\itemsep\noindent
  }

\begin{document}

\section*{Sample}

\begin{leftrulebox}[Text Title 1]
\kant[1]
\end{leftrulebox}

\begin{leftrulebox}[Text Title 2]
    \kant[2]
\kant[3]
\kant[4]
\kant[5]
\end{leftrulebox}

\begin{leftrulebox}[Text Title 3]
    \kant[3]
    \kant[4]
    \kant[5]
\end{leftrulebox}

\end{document}

enter image description here

1
  • Thanks a tonne! I looked up overlay unbroken and first in the manual, I never would have found that.
    – EngBIRD
    Commented Apr 6, 2016 at 20:33
1

One can try the extras first and extras middle and last options to provide the specific overlay (with the text) for the first box (the first broken one) and leave the overlay without #1 for the middle and last boxes in the break sequence.

\documentclass{article}
\usepackage[left=60pt,top=60pt,right=60pt,bottom=60pt]{geometry}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{kantlipsum}
\usepackage{enumitem}
\usepackage[many]{tcolorbox}

\setitemize{nolistsep,labelsep=1ex,leftmargin=*}

%% colors---
\definecolor{lightgray}{gray}{0.8}

%%items--
\newlist{items}{description}{1}
\setlist[items]{align=right,font=\normalfont, leftmargin=1.8in,style=nextline,labelsep=1em,}

%% leftrulebox---
\tcbuselibrary{skins,breakable}
\newtcolorbox{leftrulebox}[1][]{
    colback=white,
    boxrule=10pt
    left=0.5ex,
    top=0pt,
    arc=0pt,
    outer arc=0pt,
    enlarge left by=1.8cm,
    enlarge right by=-\dimexpr1.8cm+\parindent\relax,
    right=\dimexpr1.8cm+\parindent\relax,
    leftrule=1pt,
    rightrule=0pt,
    toprule=0pt,
    bottomrule=0pt,
    breakable,
    nobeforeafter,
    enhanced jigsaw,
    extras first={
    overlay={%
      \node[anchor=north east,inner ysep=0pt,align=right,text width=1.8cm] 
        at ([yshift=-0.55ex]frame.north west) {\hfill#1};
    },
    },
    extras middle and last={%
      overlay={%
        \node[anchor=north east,inner ysep=0pt,align=right,text width=1.8cm] 
        at ([yshift=-0.55ex]frame.north west) {\hfill};
      },
    },
    before=\vskip2\itemsep\noindent
  }

\begin{document}

\section*{Sample}

\begin{leftrulebox}[Text Title]
\kant[1]
\kant[2]
\kant[3]
\kant[4]
\kant[5]
\end{leftrulebox}

\end{document}

enter image description here

3
  • Pure genius! Thanks! It actually breaks multiple leftrulebox's on the same page, but I haven't a clue why (as it's so far random which one shows up with left text and which ones are blank) so I am investigating further.
    – EngBIRD
    Commented Apr 6, 2016 at 19:57
  • @EngBIRD: You're welcome, as always!
    – user31729
    Commented Apr 6, 2016 at 20:00
  • I provided too simple a MWE, I have added a second one if I could possibly ask for your insights with regards to it as well. Thanks!
    – EngBIRD
    Commented Apr 6, 2016 at 20:09

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.