diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/tcolorbox/tcblistings.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/tcolorbox/tcblistings.code.tex | 200 |
1 files changed, 21 insertions, 179 deletions
diff --git a/Master/texmf-dist/tex/latex/tcolorbox/tcblistings.code.tex b/Master/texmf-dist/tex/latex/tcolorbox/tcblistings.code.tex index 07d9207c93d..55375f697c5 100644 --- a/Master/texmf-dist/tex/latex/tcolorbox/tcblistings.code.tex +++ b/Master/texmf-dist/tex/latex/tcolorbox/tcblistings.code.tex @@ -1,4 +1,4 @@ -%% The LaTeX package tcolorbox - version 2.41 (2013/07/23) +%% The LaTeX package tcolorbox - version 2.50 (2013/07/29) %% tcblistings.code.tex: Code for colorboxes with listings %% %% ------------------------------------------------------------------------------------------- @@ -18,10 +18,12 @@ %% This work consists of all files listed in README %% %\makeatletter -\tcb@set@library@version{2.41} +\tcb@set@library@version{2.50} \RequirePackage{listings}[2007/02/22] +\tcbuselibrary{listings@core} + \let\tcb@listing@MakeCaption@org=\lst@MakeCaption \def\tcb@listing@set@MakeCaption@org{% @@ -37,210 +39,50 @@ basicstyle=\ttfamily\small, extendedchars=true, nolol, inputencoding=\kvtcb@listingencoding} -\def\tcbuselistingtext{\input{\kvtcb@listingfile}}% - -\def\tcbuselistinglisting{% +\def\tcb@listing@input@listing#1#2{% \begingroup% - \toks@=\expandafter{\kvtcb@listingoptions}% + \toks@=\expandafter{#1}% \edef\tcb@temp{\noexpand\lstinputlisting[nolol,\the\toks@]}% \tcb@listing@set@MakeCaption% - \tcb@temp{\kvtcb@listingfile}% + \tcb@temp{#2}% \endgroup% }% -\def\tcb@listing@listingAndText{% - \tcbuselistinglisting% - \tcblower% - \tcbuselistingtext% -} - -\def\tcb@listing@listingAndComment{% - \tcbuselistinglisting% - \tcblower% - \kvtcb@listingcomment% -} - -\def\tcb@listing@textAndListing{% - \tcbuselistingtext% - \tcblower% - \tcbuselistinglisting% -} - -\def\tcb@listing@commentAndListing{% - \kvtcb@listingcomment% - \tcblower% - \tcbuselistinglisting% -} - -\def\tcb@inputlisting@out@prepare{% - \tcbdimto\tcb@width{\kvtcb@width}% - \tcbdimto\tcb@innerwidth{\tcb@width-\kvtcb@left@rule-\kvtcb@right@rule}% - \tcbdimto\tcb@temp{\tcb@innerwidth-\kvtcb@boxsep*2}% - \tcbdimto\tcb@w@upper{\tcb@temp-\kvtcb@leftupper-\kvtcb@rightupper}% - \tcbset{breakable@false}% - \def\tcb@minipage{\csname tcb@minipage@\kvtcb@sbs@align\endcsname}% - \tcbdimto\tcb@w@upper@real{\tcb@w@upper}% - \tcbdimto\tcb@w@sbs{\tcb@w@upper@real-\kvtcb@sbs@gap}% - \tcb@sbs@quota% - \ifx\kvtcb@float\@empty% - \newenvironment{tcb@sbsfloat}{\kvtcb@beforebox}{\kvtcb@afterbox}% - \else% - \edef\float@start{\noexpand\@float{tcbfloat}[\kvtcb@float]}% - \newenvironment{tcb@sbsfloat}{\float@start}{\end@float}% - \fi% -} - -\def\tcb@inputlisting@out@listingAndText{% - \tcb@inputlisting@out@prepare% - \tcbdimto\tcb@w@outside{\tcb@w@lower}% - \tcbdimto\tcb@w@inside{\tcb@width-\tcb@w@lower-\kvtcb@sbs@gap}% - \begin{tcb@sbsfloat}\begin{minipage}{\tcb@width}% - \tcb@minipage{\tcb@w@inside}% - \begin{tcolorbox}[width=\tcb@w@inside,nobeforeafter,nofloat,sidebyside=false]\tcbuselistinglisting\end{tcolorbox}% - \endminipage\hfill% - \iftcb@lowervisible\tcb@minipage{\tcb@w@outside}\color{\kvtcb@collower}\kvtcb@fontlower\kvtcb@before@lower\ignorespaces% - \tcbuselistingtext\unskip\kvtcb@after@lower\endminipage\fi% - \end{minipage}\end{tcb@sbsfloat}% -} - -\def\tcb@inputlisting@out@textAndListing{% - \tcb@inputlisting@out@prepare% - \tcbdimto\tcb@w@outside{\tcb@w@upper}% - \tcbdimto\tcb@w@inside{\tcb@width-\tcb@w@upper-\kvtcb@sbs@gap}% - \begin{tcb@sbsfloat}\begin{minipage}{\tcb@width}% - \iftcb@lowervisible\tcb@minipage{\tcb@w@outside}\color{\kvtcb@collower}\kvtcb@fontlower\kvtcb@before@lower\ignorespaces% - \tcbuselistingtext\unskip\kvtcb@after@lower\endminipage\fi\hfill% - \tcb@minipage{\tcb@w@inside}% - \begin{tcolorbox}[width=\tcb@w@inside,nobeforeafter,nofloat,sidebyside=false]\tcbuselistinglisting\end{tcolorbox}% - \endminipage% - \end{minipage}\end{tcb@sbsfloat}% -} -\def\tcb@inputlisting@inside{% - \begin{tcolorbox}[capture=\tcb@listing@capture]\tcb@listing@process\end{tcolorbox}% -} +\def\tcb@listing@uselistinglisting{% + \tcb@listing@input@listing{\kvtcb@listingoptions}{\kvtcb@listingfile}% +}% -\let\tcb@inputlisting\tcb@inputlisting@inside +\def\tcb@listing@usetemplisting{% + \tcb@listing@input@listing{\kvtcb@listingoptions}{\kvtcb@tempfile}% +}% -\def\tcb@set@listing@process#1{% - \let\tcb@inputlisting\tcb@inputlisting@inside% - \let\tcb@listing@process=#1% +\def\tcb@listing@doc@usetemplisting{% + \tcb@listing@input@listing{style=\kvtcb@doclststyle}{\kvtcb@tempfile}% } \tcbset{% - listing file/.store in=\kvtcb@listingfile,% listing options/.store in=\kvtcb@listingoptions,% listing style/.style={listing options={style=#1}},% no listing options/.style={listing options=},% - comment/.store in=\kvtcb@listingcomment,% - listing and text/.code={\tcb@set@listing@process{\tcb@listing@listingAndText}},% - text and listing/.code={\tcb@set@listing@process{\tcb@listing@textAndListing}},% - listing and comment/.code={\tcb@set@listing@process{\tcb@listing@listingAndComment}},% - comment and listing/.code={\tcb@set@listing@process{\tcb@listing@commentAndListing}},% - listing only/.code={\tcb@set@listing@process{\tcbuselistinglisting}},% - text only/.code={\tcb@set@listing@process{\tcbuselistingtext}},% listing inputencoding/.store in=\kvtcb@listingencoding,% - text side listing/.style={sidebyside,text and listing},% - listing side text/.style={sidebyside,listing and text},% - text outside listing/.code={\let\tcb@inputlisting\tcb@inputlisting@out@textAndListing},% - listing outside text/.code={\let\tcb@inputlisting\tcb@inputlisting@out@listingAndText},% listing remove caption/.is choice, listing remove caption/true/.code={\let\tcb@listing@set@MakeCaption\tcb@listing@set@MakeCaption@empty}, listing remove caption/false/.code={\let\tcb@listing@set@MakeCaption\tcb@listing@set@MakeCaption@org}, listing remove caption/.default=true, + listing engine/listings/.code={\let\tcbuselistinglisting\tcb@listing@uselistinglisting% + \let\tcbusetemplisting\tcb@listing@usetemplisting% + \let\tcb@doc@usetemplisting\tcb@listing@doc@usetemplisting}, } -\newenvironment{tcblisting}[1]{% - \def\tcblisting@box{\tcbinputlisting{#1}}% - \begingroup\tcbverbatimwrite{\kvtcb@listingfile}% -}{\endtcbverbatimwrite\endgroup% - \tcblisting@box% -} - -\long\def\tcbinputlisting#1{% - \begingroup% - \tcb@layer@pushup%´ - \tcbset{capture=minipage,#1}% - \let\tcb@listing@capture=\kvtcb@capture% - \tcb@inputlisting\endgroup% -} - -\newenvironment{tcboutputlisting}{% - \begingroup\tcbverbatimwrite{\kvtcb@listingfile}% -}{\endtcbverbatimwrite\endgroup} - -\def\tcbusetemplisting{% - \toks@=\expandafter{\kvtcb@listingoptions}% - \edef\tcb@temp{\noexpand\lstinputlisting[\the\toks@]}% - \tcb@temp{\kvtcb@tempfile}% -}% - -\long\def\tcb@newtcblisting#1#2{\newenvironment{#1}{\tcblisting{#2,options@for=#1}}{\endtcblisting}} - -\long\def\tcb@newtcblisting@#1[#2]#3{\newenvironment{#1}[#2]{\tcblisting{#3,options@for=#1}}{\endtcblisting}} - -\long\def\tcb@newtcblisting@@#1[#2][#3]#4{\newenvironment{#1}[#2][#3]{\tcblisting{#4,options@for=#1}}{\endtcblisting}} - -\long\def\tcb@new@tcblisting@#1[#2]{% - \@ifnextchar[{\tcb@newtcblisting@@{#1}[#2]}{\tcb@newtcblisting@{#1}[#2]}} - -\long\def\tcb@new@tcblisting#1{% - \preto\tcb@new@colopt{savedelimiter=#1}% - \cslet{tcb@opt@#1}{\tcb@new@colopt}% - \@ifnextchar[{\tcb@new@tcblisting@{#1}}{\tcb@newtcblisting{#1}}} - -\long\def\tcb@new@tcblisting@opt[#1]#2{% - \tcb@proc@options@init{#1}{#2}% - \tcb@new@tcblisting{#2}% -} - -\long\def\newtcblisting{% - \def\tcb@new@colopt{}% - \@ifnextchar[{\tcb@new@tcblisting@opt}{\tcb@new@tcblisting}} - - -\long\def\tcb@newtcbinputlisting#1#2{\expandafter\newcommand\csname#1\endcsname{\tcbinputlisting{#2,options@for=#1}}} - -\long\def\tcb@newtcbinputlisting@#1[#2]#3{\expandafter\newcommand\csname#1\endcsname[#2]{\tcbinputlisting{#3,options@for=#1}}} - -\long\def\tcb@newtcbinputlisting@@#1[#2][#3]#4{\expandafter\newcommand\csname#1\endcsname[#2][#3]{\tcbinputlisting{#4,options@for=#1}}} - -\long\def\tcb@new@tcbinputlisting@#1[#2]{% - \@ifnextchar[{\tcb@newtcbinputlisting@@{#1}[#2]}{\tcb@newtcbinputlisting@{#1}[#2]}} - -\long\def\tcb@new@tcbinputlisting#1{% - \preto\tcb@new@colopt{savedelimiter=#1}% - \cslet{tcb@opt@#1}{\tcb@new@colopt}% - \@ifnextchar[{\tcb@new@tcbinputlisting@{#1}}{\tcb@newtcbinputlisting{#1}}} - -\long\def\tcb@new@tcbinputlisting@opt[#1]#2{% - \tcb@proc@options@init{#1}{#2}% - \tcb@new@tcbinputlisting{#2}% -} - -\long\def\tcb@new@tcbinputlisting@bs#1{% - \edef\temp{\tcb@remove@bs{#1}}% - \tcb@new@tcbinputlisting{\temp}% -} - -\long\def\tcb@new@tcbinputlisting@opt@bs[#1]#2{% - \edef\temp{\tcb@remove@bs{#2}}% - \tcb@new@tcbinputlisting@opt[#1]{\temp}% -} - -\long\def\newtcbinputlisting{% - \def\tcb@new@colopt{}% - \@ifnextchar[{\tcb@new@tcbinputlisting@opt@bs}{\tcb@new@tcbinputlisting@bs}} - \tcbset{% reset@listings/.style={% - listing file=\jobname.listing, listing style=tcblatex, - comment=, - listing and text, listing inputencoding=\inputencodingname, - listing remove caption, }, + listing remove caption, + listing engine=listings, + }, initialize@reset=reset@listings, } |