如何使用 mdframed 包重现 tcolorbox 文档中漂亮的 LIB 样式框?

如何使用 mdframed 包重现 tcolorbox 文档中漂亮的 LIB 样式框?

我尝试使用 mdframed 包重现 tcolorbox 文档中漂亮的 LIB 类型框。但我失败了,我不知道如何使用 mdframed 包生成剪辑效果。旋转后的矩形比背景框大……

我的代码:

% !Tex program    = xelatex
% !Tex encoding   = UTF-8 Unicode
\documentclass{article}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[absolute,overlay]{textpos}
\usepackage[skins]{tcolorbox}
\usepackage[framemethod=TikZ]{mdframed}
%-------------------------------
%    Lib mdbox
%-------------------------------      
\newmdenv[     skipabove    =7pt,
                skipbelow    =7pt,
                leftmargin   =0cm,
                rightmargin =0cm,
                topline         =true,
                bottomline   =true,
                leftline         =true,
                rightline       =true,
                linewidth     =.4pt,
                innertopmargin=4pt,
                innerbottommargin=4pt,
                innerleftmargin=4mm,
                innerrightmargin=4mm,
                roundcorner=1pt,
                linecolor=green!50!black,
                backgroundcolor=green!10!white,
                fontcolor =green!25!black,
                singleextra={%
                \path let \p1=(P), \p2=(O) in ($(\x2,0)+0.5*(0,\y1)$)
                   node[
                                                         fill=green!75!blue!50!white,
                                                         text=white,
                                                         font=\sffamily\bfseries\tiny,
                                                         rectangle,
                                                         rounded corners=1pt,
                                                         rotate=90
                                                         ] 
                                       {REM};
                         \path let \p1=(P), \p2=(O) in ($(\x1,0)+0.5*(0,\y1)$)
                   node[
                                                         fill=green!75!blue!50!white,
                                                         text=white,
                                                         font=\sffamily\bfseries\tiny,
                                                         rectangle,
                                                         rounded corners=1pt,
                                                         rotate=90,
                                                         ] 
                                       {REM};              
                                   },
                ]{mylibmd}%
%-------------------------------
%    Lib tcbbox
%-------------------------------      
\newtcolorbox{mylibtcb}{
                                    enhanced,
                                    before skip=7pt,
                                    after skip =7pt,
                                    left skip=0pt,
                                    right skip=0pt,
                                    boxrule=0.4pt,
                                    top=0pt,
                                    bottom=0pt,
                                    left=4mm,
                                    right=4mm,
                                   arc=1pt,
                                   boxsep=4pt,
                                  %before upper={\vphantom{dlg}},
                                  colframe=green!50!black,
                                  coltext=green!25!black,
                                  colback=green!10!white,
                                 overlay={\begin{tcbclipinterior}
                                 \fill[green!75!blue!50!white] 
                                 (frame.south west)
                                   rectangle      node[text=white,
                                                         font=\sffamily\bfseries\tiny,
                                                         %rectangle,
                                                         rotate=90
                                                         ] 
                                       {REM}
                            ([xshift=4mm]frame.north west);
                            \fill[green!75!blue!50!white] 
                                ([xshift=-4mm]frame.south east)
                                   rectangle      node[text=white,
                                                         font=\sffamily\bfseries\tiny,
                                                         %rectangle,
                                                         rotate=90
                                                         ] 
                                       {REM}
                            (frame.north east);
                            \end{tcbclipinterior};
                                     }
                              }
%-----------------------------
%  document
%----------------------------
\begin{document}
%\section{library}
  The following is  \textbf{a mdbox}created by using \textbf{the mdframed package}:
   \begin{mylibmd}
    good good study day day up day day up
   \end{mylibmd}

   The following is a \textbf{a tcbbox} created by using \textbf{the tcolorbox package}:

   \begin{mylibtcb}
    good good study day day up day day up
   \end{mylibtcb}
\end{document}
% END

区别如图所示

相关内容