1

I defined a cases environment to be used within proofs. Usually, I see that for nested cases the indentation is increased. I had the impression that this leaves too little room for text. Somewhere I saw the nesting visualized with vertical lines, which I try to implement.

The code at the end mostly achieves the desired result (I use tcolorbox version 3.21):

  • Why is the first page of the document created almost empty?
  • Are there disadvantages to defining a cases environment like this, instead of, e.g. \newtheorem or description?
\documentclass{article}
\usepackage{amsthm,thmtools,amsmath}
\usepackage{lipsum}
\usepackage[many]{tcolorbox}
\tcbuselibrary{breakable}   
\newtcolorbox{tcbcase}[1][]{%
        empty,
        title={#1},fonttitle=\bfseries,attach title to upper,after title={.\quad},
        coltitle=black,
        before=\par\medskip\noindent,parbox=false,boxsep=0pt,left=3pt,right=0mm,top=4pt,
        breakable,pad at break=0mm,
        overlay ={\draw[gray,line width=1pt]
            ([yshift=-1pt]frame.north west) -- (frame.south west);
        },%
}
\newtcolorbox{tcbsubcase}[1][]{%
        empty,
        title={#1},fonttitle=\bfseries,attach title to upper,after title={.\quad},
        coltitle=black,
        before=\par\medskip\noindent,parbox=false,boxsep=0pt,left=3pt,right=0mm,top=4pt,
        breakable,pad at break=0mm,
        overlay ={\draw[gray,line width=1pt]
            ([yshift=-1pt]frame.north west) -- (frame.south west);
        },%
}
\newtcolorbox{tcbsubsubcase}[1][]{%
        empty,
        title={#1},fonttitle=\bfseries,attach title to upper,after title={.\quad},
        coltitle=black,
        before=\par\medskip\noindent,parbox=false,boxsep=0pt,left=3pt,right=0mm,top=4pt,
        breakable,pad at break=0mm,
        overlay ={\draw[gray,line width=1pt]
            ([yshift=-1pt]frame.north west) -- (frame.south west);
        },%
}
\begin{document}
\begin{proof}
\begin{tcbcase}[Case $\phi = \mathit{true}$]
        \lipsum[1]
        \begin{tcbsubcase}[Case $\phi = P$]
            \lipsum[1]
            \begin{tcbsubsubcase}[Case $\phi = \lnot P$]
            \lipsum[3]
            \end{tcbsubsubcase}
            \lipsum[1]
        \end{tcbsubcase}
\end{tcbcase}
\end{proof}
\end{document}
3
  • Will you really need to nest cases?
    – Bernard
    Commented Aug 24, 2017 at 19:33
  • Actually yes. Currently, I have three nested cases. I mean nesting depth 3. Commented Aug 25, 2017 at 8:01
  • One serious limitation seems to be that inside a tcolorbox I can not use floats. Commented Aug 25, 2017 at 15:22

1 Answer 1

3

You can find the reason in section 17.2 Limitations and Known Bugs from tcolorbox documentation. The second paragraph says:

enter image description here

Then as your nested box is too large to fit in one page with the first paragraph from first level box, it breaks the box and places it on the second page.

1
  • 1
    Thank you. I believe I will stick to the classic indentation based visualization. I tried changebar, mdframed and tcolorbox, but with all approaches I had problems or serious limitations. Commented Aug 28, 2017 at 12:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .