為什麼 tcolorbox 會插入如此奇怪的分頁符號?

為什麼 tcolorbox 會插入如此奇怪的分頁符號?

在較低的 MWE 中,我想建立一個格式化部分作為範例。然而,tcolorbox 套件插入了奇怪的分頁符號。我想要一些,但我不明白為什麼它不設置它們以使一切都是連續的。誰能幫我?

如果有人比我有更多的知識,我也對改進箭頭的實現和目標位置的並置的建議感興趣。

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

答案1

我認為xltabular不要在 Breakable 內部工作tcolorbox。我不知道你為什麼要定義exampleFieldenv.它有兩個參數,但您沒有在定義中使用它們。恕我直言,你不需要xltabular達成目標。某些人可以在環境中輕鬆設定格式\leftskip,並刪除\leftskip第一行的 ,然後將標記和標題放在實際內容之前。

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

在此輸入影像描述

相關內容