tcolorbox样式一例
tcolorbox样式一例
tcolorbox样式一例
作品简介

前段时间在https://www.latexstudio.net/index/details/index/mid/2785.html 中看到这个样式,在此基础上做了此样式,供大家参考,以下是TeX原码,复制保存为tex文件,直接运行即可。

\documentclass[UTF8]{ctexart} %%--------------------------------------------------------------------------------------------------- \usepackage{tikz} \usetikzlibrary{shadows} \usepackage[most]{tcolorbox} \usepackage{varwidth} %%--------------------------------------------------------------------------------------------------- \newcommand{\mytcolorbox}[4] {\newtcolorbox[#2]{#1}[2][] { enhanced,breakable, before skip=2mm,after skip=2mm, colback=#3!2,colframe=#3!50!black,colbacktitle=#3,boxrule=0.4mm, attach boxed title to top left={xshift=5mm,yshift=1mm-\tcboxedtitleheight}, varwidth boxed title=-3cm, boxed title style= { frame code= { \fill[fill=tcbcolback!50!black]([xshift=-5mm,yshift=-1mm]frame.north west)rectangle(frame.south east); }, interior engine=empty, }, fonttitle=\bfseries,%fontupper=\CTEXindent, title={\strut #4}, overlay unbroken = { \fill[color=#3!50!black,drop shadow={opacity=0.3,shadow xshift=0.5mm,shadow yshift=-0.5mm}] ([xshift=-1mm,yshift=1mm]frame.north west)--+(1,0)--+(0,-1)--cycle; \fill[color=black!60] ([xshift=-1mm,yshift=-9mm]frame.north west)--+(0.1,0.1)--+(0.1,-0.1)--cycle; \fill[black!60] ([xshift=9mm,yshift=1mm]frame.north west)--+(-0.1,-0.1)--+(0.1,-0.1)--cycle; \fill[color=#3!50!black,drop shadow={opacity=0.3,shadow xshift=-0.5mm,shadow yshift=0.5mm}] ([xshift=1mm,yshift=-1mm]frame.south east)--+(-0.5,0)--+(0,0.5)--cycle; \fill[black!60] ([xshift=-4mm,yshift=-1mm]frame.south east)--+(-0.1,0.1)--+(0.1,0.1)--cycle; \fill[black!60] ([xshift=1mm,yshift=4mm]frame.south east)--+(-0.1,0.1)--+(-0.1,-0.1)--cycle; }, overlay first = {%跨页时生效 \fill[color=#3!50!black,drop shadow={opacity=0.3,shadow xshift=0.5mm,shadow yshift=-0.5mm}] ([xshift=-1mm,yshift=1mm]frame.north west)--+(1,0)--+(0,-1)--cycle; \fill[color=black!60] ([xshift=-1mm,yshift=-9mm]frame.north west)--+(0.1,0.1)--+(0.1,-0.1)--cycle; \fill[black!60] ([xshift=9mm,yshift=1mm]frame.north west)--+(-0.1,-0.1)--+(0.1,-0.1)--cycle; },%保持边缘的变化 overlay last = {%跨页时生效 \fill[color=#3!50!black,drop shadow={opacity=0.3,shadow xshift=-0.5mm,shadow yshift=0.5mm}] ([xshift=1mm,yshift=-1mm]frame.south east)--+(-0.5,0)--+(0,0.5)--cycle; \fill[black!60] ([xshift=-4mm,yshift=-1mm]frame.south east)--+(-0.1,0.1)--+(0.1,0.1)--cycle; \fill[black!60] ([xshift=1mm,yshift=4mm]frame.south east)--+(-0.1,0.1)--+(-0.1,-0.1)--cycle; } } } %%--------------------------------------------------------------------------------------------------- \mytcolorbox{mytcboxa}{auto counter}{red}{练习\thetcbcounter} \newcommand{\timu}[1]{\begin{mytcboxa}{}#1\end{mytcboxa}} %%--------------------------------------------------------------------------------------------------- \begin{document} \timu { 1 } \end{document}

暂无评论