6

this is a follow up to the problem described here.

I have the same problem and the proposed solution does not completely solve the problem. I mean, it does solve the problem but also creates another one. The new problem is that the theorems, lemmas and the rest are placed in such as way that they are not cut (of course), but this leaves then big empty spaces in many pages. So the problem is that, the problem described here does not seem to be fully resolved using the nocut option.

Do you any of you have a good idea on how to solve this? Thanks!

1

2 Answers 2

4

This perhaps is not the kind of answer you were expecting. Instead of using the thmbox=M option (which relies in the thmbox package) from the thmtools package , I would suggest you the tcolorbox package to design a theorem style imitating the one provided by the M option, but behaving nicely with page breaks:

\documentclass{report}
\usepackage[a6paper]{geometry}% just for the example
\usepackage{amsthm,amsmath}
\usepackage{lipsum}
\usepackage[most]{tcolorbox}
\usepackage{ulem}

\makeatletter
\def\tcb@theo@title#1#2#3{%
  \ifdefempty{#2}{\setbox\z@=\hbox{#1}}{\setbox\z@=\hbox{#1~#2}}%
  \def\temp@a{#3}%
  \ifx\temp@a\@empty\relax%
    \unhbox\z@%
  \else%
    \setbox\z@=\hbox{\unhbox\z@\ }%
    \hangindent\wd\z@%
    \hangafter=1%
    \mbox{\unhbox\z@}(#3)%
  \fi%
}
\renewcommand{\newtcbtheorem}[5][]{%
  \newtcolorbox[auto counter,#1]{#2}[3][]{#4,%
    title={\uline{\tcb@theo@title{#3}{\thetcbcounter}{##2}}},
    list entry={\numberline{\thetcbcounter}##2},%
    code={\tcb@theo@label{#5}{##3}},%
    ##1}%
}
\makeatother

\newtcbtheorem{theorem}{Theorem}{
breakable,
enhanced,
arc=0pt,
outer arc=0pt,
coltitle=black,
fonttitle=\bfseries,
fontupper=\itshape,
colback=white,
colframe=white,
left=30pt,
lefttitle=0pt,
boxsep=0pt,
right=0pt,
overlay unbroken={
  \draw ([xshift=15pt,yshift=-11pt]frame.north west) -- ([xshift=15pt]frame.south west) |- +(30pt,0);},
overlay first={
  \draw ([xshift=15pt,yshift=-11pt]frame.north west) -- ([xshift=15pt]frame.south west);},
overlay middle={
  \draw ([xshift=15pt]frame.north west) -- ([xshift=15pt]frame.south west);},
overlay last={
  \draw ([xshift=15pt]frame.north west) -- ([xshift=15pt]frame.south west) |- +(30pt,0);},
before=\vspace{2ex}\noindent,
}{the}

\begin{document}

Some cross referecens to theorems~\ref{the:testa} and~\ref{the:testb}

\lipsum[4]
\begin{theorem}{}{testa}
\lipsum[4]\lipsum[4]\lipsum[4]
\end{theorem}

\begin{theorem}{}{testb}
\lipsum[4]
\end{theorem}

\end{document}

enter image description here

1

if you want to stay with thmbox, you can make use of the internal switch that allows or prevents a page break in the middle of a theorem.

since it's unlikely that all theorems will fall in a place that isn't affected by a page break, it's probably useful to make two user-level switches -- one to turn breaking off, and one to turn it on:

\makeatletter
\newcommand{\cutthmoff}{\thmbox@cutfalse}
\newcommand{\cutthmon}{\thmbox@cuttrue}
\makeatother

then you can use these switches either "locally" -- enclosing the desired switch in a brace-group or \begingroup ... \endgroup that surrounds the theorem, to operate on only that theorem -- or by switching on and off as appropriate.

it is probably a good idea, if your document is in multiple files, to restore the "normal" setting at the end of each file, to avoid surprises later.

You must log in to answer this question.

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