答案1
您可以从手册的源文件中复制粘贴tcolorbox
。
\documentclass{ltxdoc}
\usepackage{tcolorbox}
\tcbuselibrary{documentation}
%
% from tcolorbox.doc.s_main.sty
%
\usepackage[a4paper,left=2.5cm,right=2.5cm,top=1.5cm,bottom=1.5cm,
marginparsep=3mm,marginparwidth=18mm,
headheight=0mm,headsep=0cm,
footskip=1.5cm,includeheadfoot%,showframe
]{geometry}
\lstdefinestyle{mydocumentation}{style=tcbdocumentation,
classoffset=0,
texcsstyle=*\color{blue},
% LaTeX and other packages
moretexcs={arrayrulecolor,draw,includegraphics,ifthenelse,isodd,lipsum,path,pgfkeysalso},
classoffset=1,
% tcolorbox macros
moretexcs={% core
endtcolorbox,endtcbverbatimwrite,newtcolorbox,newtcbox,newtcboxfit,tcbusetemp,tcbtitle,tcbtitletext,
tcblower,tcbox,tcboxfit,tcbset,tcbuselibrary,tcolorbox,tcbverbatimwrite,tcbsetforeverylayer,tcbsubtitle,
tcolorboxenvironment,tcblistof,tcbstartrecording,tcbrecord,tcbstoprecording,tcbinputrecords,
tcbpatcharcangular,tcbpatcharcround,tcbifoddpage,thetcolorboxnumber,thetcolorboxpage,
tcbheightfromgroup,tcbheightspace,tcbtextwidth,tcbtextheight,
% listings
endtcblisting,newtcblisting,newtcbinputlisting,
tcblisting,tcbinputlisting,tcbuselistingtext,tcbuselistinglisting,tcbusetemplisting,
tcbfitdim,tcbfitsteps,
% raster
thetcbrasternum,tcbitem,
% theorems
tcbmaketheorem,tcboxmath,tcbhighmath,thetcbcounter,newtcbtheorem,
% documentation
brackets,
colDef,colOpt,cs,
docAuxCommand,docColor,docAuxEnvironment,docAuxKey,
docCounter,docLength,
meta,marg,
oarg,
refCom,refEnv,refKey,
tcbmakedocSubKey,tcbdocmarginnote,tcbdocnew,tcbdocupdated,
% skins
tcbincludegraphics,tcbincludepdf,pdfpages,imagepage,imagepath,imagename,
tcbline,tcboxedtitleheight,tcboxedtitlewidth,
tcbsettowidthofnode,tcbsetmacrotowidthofnode,tcbsettoheightofnode,tcbsetmacrotoheightofnode,
% vignette
tcbvignette,
% xparse
DeclareTColorBox,NewTColorBox,RenewTColorBox,ProvideTColorBox,
DeclareTotalTColorBox,NewTotalTColorBox,RenewTotalTColorBox,ProvideTotalTColorBox,
DeclareTCBox,NewTCBox,RenewTCBox,ProvideTCBox,
DeclareTotalTCBox,NewTotalTCBox,RenewTotalTCBox,ProvideTotalTCBox,
DeclareTCBListing,NewTCBListing,RenewTCBListing,ProvideTCBListing,
DeclareTCBInputListing,NewTCBInputListing,RenewTCBInputListing,ProvideTCBInputListing,
DeclareTCBoxFit,NewTCBoxFit,RenewTCBoxFit,ProvideTCBoxFit,
DeclareTotalTCBoxFit,NewTotalTCBoxFit,RenewTotalTCBoxFit,ProvideTotalTCBoxFit,
tcbsidebyside,tcboxverb,
% externalization
tcbEXTERNALIZE,tcbifexternal,newtcbexternalizeenvironment,
renewtcbexternalizeenvironment,extcolorbox,extikzpicture,
newtcbexternalizetcolorbox,renewtcbexternalizetcolorbox,
tcbiffileprocess,
% box array
newboxarray,boxarraygetsize,boxarrayreset,boxarrayclear,
boxarraygetbox,boxarraygetwidth,boxarraygetheight,boxarraygetdepth,
boxarraygettotalheight,useboxarray,usetcboxarray,
consumeboxarray,consumetcboxarray,
},
texcsstyle=*\color{Definition}\bfseries,
classoffset=0% restore default
}
\definecolor{Green_Dark}{rgb}{0.078431,0.407843,0.176471}
\definecolor{Blue_Dark}{rgb}{0.090196,0.211765,0.364706}
\definecolor{Blue_Bright}{rgb}{0.858824,0.898039,0.945098}
\tcbset{
documentation listing style=mydocumentation,%
sbs/.style={sidebyside,before lower app={\tcbset{sidebyside=false}}},%
innerbox/.style={reset,documentation listing style=mydocumentation,
docexample/.style={docexample original},%
},
beforeafter example/.style={
before skip=4pt plus 2pt minus 1pt,
after skip=8pt plus 4pt minus 2pt
},
base example/.style={bicolor,
beforeafter example,arc is angular,fonttitle=\bfseries,
fontlower=\footnotesize,
colframe=Blue_Dark,
colback=Blue_Bright,
colbacklower=white,
drop fuzzy shadow,
},
docexample/.style={base example,%
every box on layer 2/.style={every box},
before upper={\tcbset{innerbox}},before lower={\tcbset{innerbox}}
},
docexample original/.style={colframe=ExampleFrame,colback=ExampleBack,fontlower=\footnotesize,
before skip=\medskipamount,after skip=\medskipamount,frame style={}},
}
\begin{document}
%
% from tcolorbox.doc.documentation.tex
%
\begin{dispExample*}{sidebyside}
\tcbdocnew{1981-10-29}.
% Next one is displayed in the margin:
\tcbdocmarginnote{\tcbdocnew{1978-02-09}}
\end{dispExample*}
\end{document}