Warum fügt tcolorbox so seltsame Seitenumbrüche ein?

Warum fügt tcolorbox so seltsame Seitenumbrüche ein?

Im unteren MWE möchte ich einen formatierten Abschnitt für Beispiele erstellen. Das tcolorbox-Paket fügt jedoch seltsame Seitenumbrüche ein. Ich hätte gerne welche, verstehe aber nicht, warum es diese nicht so einstellt, dass alles fortlaufend ist. Kann mir jemand helfen?

Auch über Verbesserungsvorschläge zur Umsetzung der Pfeile und der Gegenüberstellung der Zielpositionen würde ich mich freuen, falls da jemand - anders als ich - mehr Ahnung hat.

\documentclass{article}

\usepackage{graphicx, color, colortbl}
\usepackage{xltabular}
\usepackage{scrextend}
\usepackage[breakable, most]{tcolorbox}
\usepackage{lipsum}

\newtcolorbox{exampleFieldFrame}[1]{
    breakable,
    enhanced,
    boxrule=.25pt,
    colframe=blue,
    colback=white,
    attach boxed title to top left,
    boxed title style={
        colback=blue,
        arc=0pt,
        top=3pt,
        bottom=3pt,
    },
    outer arc = 8mm, 
    arc = 8mm, 
    sharp corners = northwest, 
    sharp corners = southeast, 
    title={#1},
}

\newenvironment{exampleField}[2][false]{
    \vspace{2\baselineskip}
    \bgroup\setlength{\parindent}{0cm}
    \begin{exampleFieldFrame}{Beispiel xxx:}
}{
    \end{exampleFieldFrame}
    \vspace{\baselineskip}
    \egroup
}

\newenvironment{exampleBody}[1][Aufgabenstellung]{
    \xltabular{\textwidth}{@{}l p{3cm} X@{}}
    \hspace{5pt}\begin{tikzpicture}
        \fill[fill=blue] (0, 2pt) node[anchor=south]{}
        -- (0, 10pt) node[anchor=north]{}
        -- (20pt,6pt) node[anchor=south]{}
        -- cycle;
    \end{tikzpicture} & \textit{#1:} & }{
    \endxltabular
    \vspace{-15pt}
}

\newenvironment{exampleBody*}[1][Lösung]{
    \begin{xltabular}{\textwidth}{@{}l p{\dimexpr\textwidth-3cm} X@{}}
        \hspace{5pt}\begin{tikzpicture}         
            \fill[fill=blue] (0,2pt) node[anchor=south]{}
            -- (0, 10pt) node[anchor=north]{}
            -- (20pt,6pt) node[anchor=south]{}
            -- cycle;
        \end{tikzpicture} & \textit{#1:} & 
    \end{xltabular}
    \vspace{\baselineskip}
    \begin{addmargin}[44pt]{0pt}
    }{
    \end{addmargin}
}

\begin{document}

\begin{exampleField}{\textwidth}
    \begin{exampleBody}[Zielstellung]
        Es soll der Ersatzwiderstand (= Eingangswiderstand) des toten Netzwerkes aus Abbildung bezüglich der herausgeführten Klemmen berechnet werden.
    \end{exampleBody}
    \begin{exampleBody}[Zielstellung]
        Es soll der Ersatzwiderstand (= Eingangswiderstand) des toten Netzwerkes aus Abbildung bezüglich der herausgeführten Klemmen berechnet werden.
    \end{exampleBody}
    \begin{exampleBody*}
        \lipsum[1-5]
    \end{exampleBody*}
    \begin{exampleBody}[Zielstellung]
        Es soll der Ersatzwiderstand (= Eingangswiderstand) des toten Netzwerkes aus Abbildung bezüglich der herausgeführten Klemmen berechnet werden.
    \end{exampleBody}
\end{exampleField}

\end{document}

Antwort1

Ich glaube, xltabulardas funktioniert nicht innerhalb von „breakable“ tcolorbox. Ich weiß nicht, warum Sie exampleField„env“ definieren. Es hat zwei Argumente, aber Sie haben sie in der Definition nicht verwendet. Meiner Meinung nach müssen Sie xltabulardas Ziel nicht erreichen. Das Format kann von jemandem einfach in einer Umgebung festgelegt werden \leftskip, indem er die erste Zeile entfernt \leftskipund dann den Marker und die Überschrift vor den eigentlichen Inhalt setzt.

\documentclass{article}
\usepackage[breakable, most]{tcolorbox}
\usepackage{lipsum}

\newtcolorbox{exampleFieldFrame}[1]{
    breakable,
    enhanced,
    boxrule=.25pt,
    colframe=blue,
    colback=white,
    attach boxed title to top left,
    boxed title style={
        colback=blue,
        arc=0pt,
        top=3pt,
        bottom=3pt,
    },
    outer arc = 8mm, 
    arc = 8mm, 
    sharp corners = northwest, 
    sharp corners = southeast, 
    title={#1},
}

\newenvironment{exampleBody}[1][Aufgabenstellung]{%
\par\bgroup\leftskip4cm\hskip-\leftskip\hbox to 4cm{\begin{tikzpicture}         
\fill[fill=blue] (0,2pt) -- (0, 10pt) -- (20pt,6pt) -- cycle;
\end{tikzpicture}\quad\textit{#1:}\hss}\ignorespaces}{%
\par\egroup%
}

\begin{document}
\begin{exampleFieldFrame}{Beispiel xxx:}
\begin{exampleBody}[Zielstellung]
    \lipsum[2]
\end{exampleBody}
\begin{exampleBody}[Zielstellung]
    \lipsum[2]
\end{exampleBody}
\begin{exampleBody}[Lösung]
    \lipsum[1-5]
\end{exampleBody}
\begin{exampleBody}
    \lipsum[2]
\end{exampleBody}
\end{exampleFieldFrame}
\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen