问题截图

问题截图

我定义了一个额外的节点,将其锚定到 tcolorbox 标题的西北点。它工作得很好,直到框被破坏(我的意思是框被自动和有意破坏,因为 tcolorbox 跨越了分页符)。

然后,所述节点被复制,这是不期望的。我配置错误或忽略了某些东西,还是这是某种错误?

问题截图

在此处输入图片描述

平均能量损失

\documentclass[
a4paper,
DIV=15,
english,
fontsize=10pt,
]
{scrartcl}

\usepackage{
textcomp, 
multicol,
setspace,
}


\usepackage{lmodern}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{blindtext}


\usepackage{tcolorbox}
\tcbuselibrary{skins}
\tcbuselibrary{breakable}

\newtcolorbox{myblock}[3]{
enhanced,
breakable=true,
geometry nodes=true,
title={\bfseries\color{black}\hspace{0pt}{#2}\\%
\color{black!80!white}\hspace{0pt}{\mdseries #3}\color{black}},
extras={
    title code={\path[draw,thick](title.north west) -- (title.south west) -- (title.south east);},
},
overlay={
\node[
anchor=north east,
inner ysep=1.5pt,
] at (title.north west){#1};
},
left skip=3cm,
top=0pt,
}


%\listfiles

\begin{document}
\singlespacing
\blindtext[2]

\blindtext[2]

\begin{myblock}
{11/2222--33/4444}
{Stuff stuff stuff}
{Some words and more stuff}
A sentence without much sense. A sentence without much sense.
\begin{itemize}
    \item A word without much sense.
    \item A word without much sense.
    \begin{itemize}
        \item A word without much sense. And some more words. Just a longer word so it all looks ``fuller''. And some more words.
        \item A word without much sense.
        \item A word without much sense. And some more words.
    \end{itemize}
    \item A word without much sense.
    \item A word without much sense.
    \item A word without much sense.
        \begin{itemize}
            \item A word without much sense. And some more words.
            \item A word without much sense.
            \item A word without much sense. And some more words. Just a longer word so it all looks ``fuller''. And some more words.
        \end{itemize}
\end{itemize}
\end{myblock}
\begin{myblock}
{88/8888--99/9999}
{Stuff stuff stuff}
{Some words and more stuff}
A sentence without much sense. A sentence without much sense.
\begin{itemize}
    \item A sentence without much sense.
    \item A sentence without much sense.
    \begin{itemize}
        \item A sentence without much sense. And some more words. Just a longer sentence so it all looks ``fuller''. And some more words.
        \item A sentence without much sense.
        \item A sentence without much sense. And some more words.
    \end{itemize}
    \item A sentence without much sense.
    \item A sentence without much sense.
    \item A sentence without much sense.
        \begin{itemize}
            \item A sentence without much sense. And some more words.
            \item A sentence without much sense.
            \item A sentence without much sense. And some more words. Just a longer sentence so it all looks ``fuller''. And some more words.
        \end{itemize}
\end{itemize}
\end{myblock}
\end{document}

.log 文件中的文件列表

 *File List*
scrartcl.cls    2021/11/13 v3.35 KOMA-Script document class (article)
scrkbase.sty    2021/11/13 v3.35 KOMA-Script package (KOMA-Script-dependent bas
ics and keyval usage)
 scrbase.sty    2021/11/13 v3.35 KOMA-Script package (KOMA-Script-independent b
asics and keyval usage)
scrlfile.sty    2021/11/13 v3.35 KOMA-Script package (file load hooks)
scrlfile-hook.sty    2021/11/13 v3.35 KOMA-Script package (using LaTeX hooks)
 scrlogo.sty    2021/11/13 v3.35 KOMA-Script package (logo)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
tocbasic.sty    2021/11/13 v3.35 KOMA-Script package (handling toc-files)
scrsize10pt.clo    2021/11/13 v3.35 KOMA-Script font size class option (10pt)
typearea.sty    2021/11/13 v3.35 KOMA-Script package (type area)
textcomp.sty    2020/02/02 v2.0n Standard LaTeX package
multicol.sty    2021/10/28 v1.9b multicolumn formatting (FMi)
setspace.sty    2011/12/19 v6.7a set line spacing
 lmodern.sty    2015/05/01 v1.6.1 Latin Modern Fonts
blindtext.sty    2012/01/06 V2.0 blindtext-Package
  xspace.sty    2014/10/28 v1.13 Space after command names (DPC,MH)
tcolorbox.sty    2022/01/07 version 5.0.2 text color boxes
     pgf.sty    2021/05/15 v3.1.9a (3.1.9a)
  pgfrcs.sty    2021/05/15 v3.1.9a (3.1.9a)
pgfrcs.code.tex
 pgfcore.sty    2021/05/15 v3.1.9a (3.1.9a)
graphicx.sty    2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2021/03/04 v1.4d Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    2021/08/11 v1.11 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
  pdftex.def    2020/10/05 v1.2a Graphics/color driver for pdftex
  pgfsys.sty    2021/05/15 v3.1.9a (3.1.9a)
pgfsys.code.tex
pgfsyssoftpath.code.tex    2021/05/15 v3.1.9a (3.1.9a)
pgfsysprotocol.code.tex    2021/05/15 v3.1.9a (3.1.9a)
  xcolor.sty    2021/10/31 v2.13 LaTeX color extensions (UK)
   color.cfg    2016/01/02 v1.6 sample color configuration
pgfcore.code.tex
pgfcomp-version-0-65.sty    2021/05/15 v3.1.9a (3.1.9a)
pgfcomp-version-1-18.sty    2021/05/15 v3.1.9a (3.1.9a)
verbatim.sty    2020-07-07 v1.5u LaTeX2e package for verbatim enhancements
 environ.sty    2014/05/04 v0.3 A new way to define environments
trimspaces.sty    2009/09/17 v1.1 Trim spaces around a token list
etoolbox.sty    2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
    tikz.sty    2021/05/15 v3.1.9a (3.1.9a)
  pgffor.sty    2021/05/15 v3.1.9a (3.1.9a)
 pgfkeys.sty    
pgfkeys.code.tex
 pgfmath.sty    
pgfmath.code.tex
pgffor.code.tex
tikz.code.tex
  pdfcol.sty    2019/12/29 v1.6 Handle new color stacks for pdfTeX (HO)
 ltxcmds.sty    2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
infwarerr.sty    2019/12/03 v1.5 Providing info/warning/error messages (HO)
   iftex.sty    2022/02/03 v1.0f TeX engine tests
 ot1lmss.fd    2015/05/01 v1.6.1 Font defs for Latin Modern
l3backend-pdftex.def    2022-04-14 L3 backend support: PDF output (pdfTeX)
supp-pdf.mkii
epstopdf-base.sty    2020-01-24 v2.11 Base part for package epstopdf
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
 ts1lmss.fd    2015/05/01 v1.6.1 Font defs for Latin Modern
 ***********

答案1

除了overlay应用于所有盒子之外,您还可以使用overlay unbroken and first仅应用于未破损盒子和一系列破损盒子中的第一个盒子的函数:

\documentclass[
a4paper,
DIV=15,
english,
fontsize=10pt,
]
{scrartcl}

\usepackage{
textcomp, 
multicol,
setspace,
}


\usepackage{lmodern}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{blindtext}


\usepackage{tcolorbox}
\tcbuselibrary{skins}
\tcbuselibrary{breakable}

\newtcolorbox{myblock}[3]{
enhanced,
breakable=true,
geometry nodes=true,
title={\bfseries\color{black}\hspace{0pt}{#2}\\%
\color{black!80!white}\hspace{0pt}{\mdseries #3}\color{black}},
extras={
    title code={\path[draw,thick](title.north west) -- (title.south west) -- (title.south east);},
},
overlay unbroken and first={
\node[
anchor=north east,
inner ysep=1.5pt,
] at (title.north west){#1};
},
left skip=3cm,
top=0pt,
}


%\listfiles

\begin{document}
\singlespacing
\blindtext[2]

\blindtext[2]

\begin{myblock}
{11/2222--33/4444}
{Stuff stuff stuff}
{Some words and more stuff}
A sentence without much sense. A sentence without much sense.
\begin{itemize}
    \item A word without much sense.
    \item A word without much sense.
    \begin{itemize}
        \item A word without much sense. And some more words. Just a longer word so it all looks ``fuller''. And some more words.
        \item A word without much sense.
        \item A word without much sense. And some more words.
    \end{itemize}
    \item A word without much sense.
    \item A word without much sense.
    \item A word without much sense.
        \begin{itemize}
            \item A word without much sense. And some more words.
            \item A word without much sense.
            \item A word without much sense. And some more words. Just a longer word so it all looks ``fuller''. And some more words.
        \end{itemize}
\end{itemize}
\end{myblock}
\begin{myblock}
{88/8888--99/9999}
{Stuff stuff stuff}
{Some words and more stuff}
A sentence without much sense. A sentence without much sense.
\begin{itemize}
    \item A sentence without much sense.
    \item A sentence without much sense.
    \begin{itemize}
        \item A sentence without much sense. And some more words. Just a longer sentence so it all looks ``fuller''. And some more words.
        \item A sentence without much sense.
        \item A sentence without much sense. And some more words.
    \end{itemize}
    \item A sentence without much sense.
    \item A sentence without much sense.
    \item A sentence without much sense.
        \begin{itemize}
            \item A sentence without much sense. And some more words.
            \item A sentence without much sense.
            \item A sentence without much sense. And some more words. Just a longer sentence so it all looks ``fuller''. And some more words.
        \end{itemize}
\end{itemize}
\end{myblock}
\end{document}

在此处输入图片描述

相关内容