¿Por qué tcolorbox inserta saltos de página tan extraños?

¿Por qué tcolorbox inserta saltos de página tan extraños?

En el MWE inferior me gustaría crear una sección formateada para ejemplos. Sin embargo, el paquete tcolorbox inserta saltos de página extraños. Me gustaría tener algunos, pero no entiendo por qué no los pone para que todo sea consecutivo. ¿Alguien puede ayudarme?

También me interesarían sugerencias para mejorar la realización de las flechas y la yuxtaposición de la posición del objetivo, si alguien tiene más conocimientos, a diferencia de mí.

\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}

Respuesta1

Creo que xltabularno funciona en interiores frágiles tcolorbox. No sé por qué defines exampleFieldenv. Tiene dos argumentos pero no los usaste en la definición. En mi humilde opinión, no es necesario xltabularlograr el objetivo. Algunos pueden configurar fácilmente el formato en un entorno \leftskipy eliminar el \leftskipde la primera línea y luego colocar el marcador y el encabezado antes del contenido real.

\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}

ingrese la descripción de la imagen aquí

información relacionada