套一个 \tikz\node[]{\parbox{}{...}};
。或者用 tcolorbox,可以设置 frame code 和 interior code。
\documentclass{ctexart}
\usepackage{zhlipsum}
\usepackage{niceframe}
\usepackage{dingbat}
\usepackage{bbding}
\usepackage{tikz}
\makeatletter
\newlength\this@pgf@bop@width
\newlength\this@pgf@bop@height
\def\this@pgf@bop@opacity{1}
\def\setboxaspattern#1#2{\expandafter\newbox\csname this@pgf@box@pattern#1\endcsname
\expandafter\setbox\csname this@pgf@box@pattern#1\endcsname\hbox{#2}%
\expandafter\edef\csname this@pgf@bop@#1@width\endcsname{\the\wd\csname this@pgf@box@pattern#1\endcsname}%
\expandafter\edef\csname this@pgf@bop@#1@height\endcsname{\the\ht\csname this@pgf@box@pattern#1\endcsname}%
}
\tikzset{
box pattern opacity/.code={\def\this@pgf@bop@opacity{#1}},
box as pattern/.code 2 args={%
\expandafter\this@pgf@bop@width\csname this@pgf@bop@#2@width\endcsname
\expandafter\this@pgf@bop@height\csname this@pgf@bop@#2@height\endcsname
\pgfkeysalso{/tikz/path picture={%
\pgfsetfillopacity{\this@pgf@bop@opacity}%
\pgf@process{\pgfpointanchor{path picture bounding box}{north east}}%
\pgf@xa\pgf@x \pgf@ya\pgf@y
\pgf@process{\pgfpointanchor{path picture bounding box}{south west}}%
\pgf@xb\pgf@x \pgf@yb\pgf@y \pgf@yc\pgf@yb
\pgfutil@loop
{%
\pgfutil@loop
\expandafter\pgftext\expandafter[#1,at=\pgfqpoint{\pgf@xb}{\pgf@yb}]{\copy\csname this@pgf@box@pattern#2\endcsname}%
\ifdim\pgf@yb<\pgf@ya
\advance\pgf@yb\this@pgf@bop@height
\pgfutil@repeat
}%
\ifdim\pgf@xb<\pgf@xa
\advance\pgf@xb\this@pgf@bop@width
\pgf@yb\pgf@yc
\pgfutil@repeat
}}%
}
}
\makeatother
\setboxaspattern{hua}{\FourClowerOpen}
\usepackage[many]{tcolorbox}
\begin{document}
\font\border=karta15
\generalframe
{\border\char'307}{\border\char'324}{\border\char'322}
{\border\char'310} {\border\char'323}
{\border\char'174}{\border\char'325}{\border\char'175}
{\noindent\tikz\node[box pattern opacity=0.4, box as pattern={}{hua}]
{\parbox{\dimexpr\textwidth-40pt-4\fboxsep}{\parindent=2\ccwd \zhlipsum[1]}};}
{\setlength\fboxsep{0pt}
\generalframe
{\border\char'307}{\border\char'324}{\border\char'322}
{\border\char'310} {\border\char'323}
{\border\char'174}{\border\char'325}{\border\char'175}
{\parindent=0pt
\begin{tcolorbox}[width=\textwidth-3.28em-4\fboxsep,left=2mm,right=2mm,enhanced,
frame empty,nobeforeafter,
interior code={\path[draw=white,fill=white,box pattern opacity=0.3, box as pattern={}{hua}]
(interior.south west) rectangle (interior.north east);},
]
\parindent=2\ccwd
\zhlipsum[1]
\end{tcolorbox}}}
\end{document}
问 如何给niceframe花边盒子加段落底纹