Page LayoutProblem with newtcbtheorem

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
PooggaTo
Posts: 2
Joined: Sat Jun 22, 2019 1:26 pm

Problem with newtcbtheorem

Post by PooggaTo »

Hello everybody,

im working on my bachelor's degree and have a problem with my theorems.

A friend of mine told me i should use "\newtcbtheorem".

So i made some for every case i need.

Code: Select all

\newtcbtheorem[number within = chapter, Crefname={Definition}{Definition} ]{MyDef}{Definition}%
{fonttitle=\bfseries, enhanced, theorem number and name,
	frame code={
		\path[thick, draw] (frame.north west)  +(.5\baselineskip,0) -| +(0,-.5\baselineskip);
		\path[thick, draw] (frame.north east) +(-.5\baselineskip,0) -| +(0,-.5\baselineskip);
		\path[thick, draw] (frame.south west) +(.5\baselineskip,0) -| +(0,.5\baselineskip);
		\path[thick, draw] (frame.south east) +(-.5\baselineskip,0) -| +(0,.5\baselineskip);
	},
	left=1mm, right=1mm, top=1mm, bottom=1mm,
	colback=black!0,
	coltitle=black
}{def}
Now my problem is, when i write text, which is longer than one page, in this theorem, LaTeX doesn't make a regular page break and continue text on page margin or even page below. I can't find any solution rn, let me know if u can help me! I appreciate your help a lot :)

greetings, PooggaTo

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Problem with newtcbtheorem

Post by Stefan Kottwitz »

Hi PooggaTo,

welcome to the forum!

Just add the breakable option, such as

Code: Select all

\newtcbtheorem[number within = chapter, Crefname={Definition}{Definition} ]{MyDef}{Definition}%
{fonttitle=\bfseries, enhanced, theorem number and name,
	breakable,
	frame code={
		\path[thick, draw] (frame.north west)  +(.5\baselineskip,0) -| +(0,-.5\baselineskip);
		\path[thick, draw] (frame.north east) +(-.5\baselineskip,0) -| +(0,-.5\baselineskip);
		\path[thick, draw] (frame.south west) +(.5\baselineskip,0) -| +(0,.5\baselineskip);
		\path[thick, draw] (frame.south east) +(-.5\baselineskip,0) -| +(0,.5\baselineskip);
	},
	left=1mm, right=1mm, top=1mm, bottom=1mm,
	colback=black!0,
	coltitle=black
}{def}
Stefan
LaTeX.org admin
PooggaTo
Posts: 2
Joined: Sat Jun 22, 2019 1:26 pm

Problem with newtcbtheorem

Post by PooggaTo »

Thank you, Stefan. :D

I have tried this before, but I forget to add it in \tcbuserlibrary, sorry my fault. :)

Code: Select all

\tcbuselibrary{theorems, skins, breakable}
So now it works, but I get a new problem.

Code: Select all

\newtcbtheorem[use counter from = MyDef, number within = chapter, Crefname={Satz}{Satz}]{MySatz}{Satz}%
{fonttitle=\bfseries, enhanced, theorem number and name, breakable,
	frame code={
		\path[thick, draw] (frame.north west)  +(.5\baselineskip,0) -| +(0,-.5\baselineskip);
		\path[thick, draw] (frame.north east) +(-.5\baselineskip,0) -| +(0,-.5\baselineskip);
		\path[thick, draw] (frame.south west) +(.5\baselineskip,0) -| +(0,.5\baselineskip);
		\path[thick, draw] (frame.south east) +(-.5\baselineskip,0) -| +(0,.5\baselineskip);
	},
	left=1mm, right=1mm, top=1mm, bottom=1mm,
	colback=black!0,
	coltitle=black,
}{sat}
Now, if LaTeX made a break, the break is perfekt, but, the design change back to this:
Image

But it should look like this:
Image

Any ideas why does it change back and how i could fix it?

kind regards
Post Reply