答案1
您的问题与这个问题非常相似:如何在乳胶中获取盒子的角落?
\documentclass{book}
\usepackage{setspace}
\usepackage[most]{tcolorbox}
\newtcolorbox{mybox}[1][]{%
enhanced,
opacityback=0,
top=10pt,
bottom=8pt,
code={\doublespacing},% from https://tex.stackexchange.com/a/211919/101651
parbox=false,% from https://tex.stackexchange.com/a/228299/101651
frame hidden,% from https://tex.stackexchange.com/a/247509/101651
% from https://tex.stackexchange.com/a/431760/101651:
overlay unbroken and first ={%
\draw[thick, double] ([xshift=20pt]frame.north west) -| ([yshift=-20pt]frame.north west);
\draw[thick, double] ([xshift=-20pt]frame.south east) -| ([yshift=20pt]frame.south east);
}
}
\begin{document}\pagecolor{yellow!40}% from https://tex.stackexchange.com/a/25141/101651
\begin{mybox}
Next time please add a minimal working example, that is a complete but as short as possible \LaTeX\ document which shows what you tried so far.
Something to show indentation. Something to show indentation. Something to show indentation. Something to show indentation.
\end{mybox}
\end{document}
编辑:
如果只希望框中的背景颜色,请省略\pagecolor{yellow!40}
和opacityback=0
,然后添加 colback=yellow!40
。
我还添加了,sharp corners
因为圆角是 的默认设置tcolorbox
。
\documentclass{book}
\usepackage{setspace}
\usepackage[most]{tcolorbox}
\newtcolorbox{mybox}[1][]{%
enhanced,
top=10pt,
bottom=8pt,
code={\doublespacing},% from https://tex.stackexchange.com/a/211919/101651
parbox=false,% from https://tex.stackexchange.com/a/228299/101651
frame hidden,% from https://tex.stackexchange.com/a/247509/101651
sharp corners,
colback=yellow!40,
% from https://tex.stackexchange.com/a/431760/101651:
overlay unbroken and first ={%
\draw[thick, double] ([xshift=20pt]frame.north west) -| ([yshift=-20pt]frame.north west);
\draw[thick, double] ([xshift=-20pt]frame.south east) -| ([yshift=20pt]frame.south east);
}
}
\begin{document}
\begin{mybox}
Next time please add a minimal working example, that is a complete but as short as possible \LaTeX\ document which shows what you tried so far.
Something to show indentation. Something to show indentation. Something to show indentation. Something to show indentation.
\end{mybox}
\end{document}