diff options
author | Karl Berry <karl@freefriends.org> | 2013-07-30 22:41:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-07-30 22:41:10 +0000 |
commit | d7fd9f2468acabe43939c50b2f94605d2612364d (patch) | |
tree | 29b62ed181427e8565d6969265b05c33450ec100 /Master/texmf-dist/tex/latex/tcolorbox/tcblistingscore.code.tex | |
parent | 6c0928331909ce5c71fe9538707fc786ef7ff6c4 (diff) |
tcolorbox (30jul13)
git-svn-id: svn://tug.org/texlive/trunk@31316 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tcolorbox/tcblistingscore.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/tcolorbox/tcblistingscore.code.tex | 211 |
1 files changed, 211 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/tcolorbox/tcblistingscore.code.tex b/Master/texmf-dist/tex/latex/tcolorbox/tcblistingscore.code.tex new file mode 100644 index 00000000000..2f1abb21116 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tcolorbox/tcblistingscore.code.tex @@ -0,0 +1,211 @@ +%% The LaTeX package tcolorbox - version 2.50 (2013/07/29) +%% tcblistingscode.code.tex: Auxiliary code for colorboxes with listings +%% +%% ------------------------------------------------------------------------------------------- +%% Copyright (c) 2006-2013 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de> +%% ------------------------------------------------------------------------------------------- +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `author-maintained'. +%% +%% This work consists of all files listed in README +%% +%\makeatletter +\tcb@set@library@version{2.50} + +\def\tcbuselistingtext{\input{\kvtcb@listingfile}}% + +\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@listing@listing{% + \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}% +} + +\let\tcb@inputlisting\tcb@inputlisting@inside + +\def\tcb@set@listing@process#1{% + \let\tcb@inputlisting\tcb@inputlisting@inside% + \let\tcb@listing@process=#1% +} + +\tcbset{% + listing file/.store in=\kvtcb@listingfile,% + 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{\tcb@listing@listing}},% + text only/.code={\tcb@set@listing@process{\tcbuselistingtext}},% + 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 engine/.is choice, +} + +\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} + + +\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@listingscore/.style={% + listing file=\jobname.listing, + comment=, + listing and text, + }, + initialize@reset=reset@listingscore, +} + |