此 MWE 示例:
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{skins,breakable}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tcolorbox}[
sharp corners, breakable, frame hidden, enhanced, boxrule=0pt,
borderline west={3pt}{0pt}{green},
colback=green!10,
segmentation code={\draw[black, dashed, line width=1pt]($(segmentation.west)$)--($(segmentation.west)+(4,0)$);}] % Ende der Einstellungen
test
\tcbline
xx
\tcblower
test
\end{tcolorbox}
\end{document}
产生此结果
我希望两条线,和,\tcbline
都\tcblower
像\tcblower
(较短的那条线)。这怎么可能呢?
答案1
你可以这样做:
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{skins,breakable}
\begin{document}
\begin{tcolorbox}[
sharp corners,
breakable,
enhanced,
toprule=0pt,
bottomrule=0pt,
rightrule=0pt,
leftrule=3pt,
colframe=green,
colback=green!10,
segmentation style={shorten >=8cm,dashed,black,line width=1pt},
]
test
\tcbline
xx
\tcblower
test
\end{tcolorbox}
\end{document}
编辑:在中心画一条线
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{skins,breakable}
%\usepackage{showframe}
\begin{document}
\begin{tcolorbox}[
sharp corners,
breakable,
enhanced,
toprule=0pt,
bottomrule=0pt,
rightrule=0pt,
leftrule=3pt,
colframe=green,
colback=green!10,
segmentation style={shorten >=4cm,shorten <=4cm,dashed,black,line width=1pt},
]
test
\tcbline
xx
\tcblower
test
\end{tcolorbox}
\end{document}