summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tcolorbox/tcblistings.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/tcolorbox/tcblistings.code.tex')
-rw-r--r--Master/texmf-dist/tex/latex/tcolorbox/tcblistings.code.tex89
1 files changed, 89 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/tcolorbox/tcblistings.code.tex b/Master/texmf-dist/tex/latex/tcolorbox/tcblistings.code.tex
new file mode 100644
index 00000000000..ab77faf9bd5
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tcolorbox/tcblistings.code.tex
@@ -0,0 +1,89 @@
+%% The LaTeX package tcolorbox - version 1.01 (2012/01/26)
+%% tcblistings.code.tex: Code for colorboxes with listings
+%%
+%% -------------------------------------------------------------------------------------------
+%% Copyright (c) 2006-2012 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
+\def\tcblibrary@listings@loaded{}
+
+\RequirePackage{listings}[2007/02/22]
+
+\lstdefinestyle{tcblatex}{language={[LaTeX]TeX},
+ aboveskip={0\p@ \@plus 6\p@}, belowskip={0\p@ \@plus 6\p@},
+ columns=fullflexible, keepspaces=true,
+ breaklines=true, breakatwhitespace=true,
+ basicstyle=\ttfamily\small, extendedchars=true
+ }
+
+\def\tcbuselistingtext{\input{\kvtcb@listingfile}}%
+
+\def\tcbuselistinglisting{%
+ \toks@=\expandafter{\kvtcb@listingoptions}%
+ \edef\tcb@temp{\noexpand\lstinputlisting[\the\toks@]}%
+ \tcb@temp{\kvtcb@listingfile}%
+}%
+
+\def\tcb@listing@listingAndText{%
+ \tcbuselistinglisting%
+ \tcblower%
+ \tcbuselistingtext%
+}
+
+\def\tcb@listing@textAndListing{%
+ \tcbuselistingtext%
+ \tcblower%
+ \tcbuselistinglisting%
+}
+
+\tcbset{
+ listing file/.store in=\kvtcb@listingfile,
+ listing options/.store in=\kvtcb@listingoptions,
+ listing style/.style={listing options={style=#1}},
+ listing and text/.code={\let\tcp@listing@process\tcb@listing@listingAndText},
+ text and listing/.code={\let\tcp@listing@process\tcb@listing@textAndListing},
+ listing only/.code={\let\tcp@listing@process\tcbuselistinglisting},
+ text only/.code={\let\tcp@listing@process\tcbuselistingtext},
+}
+
+\tcbset{
+ listing file=\jobname.listing,
+ listing style=tcblatex,
+ listing and text,
+}
+
+\newenvironment{tcblisting}[1]{%
+ \def\tcblisting@box{\begin{tcolorbox}[#1]\tcp@listing@process\end{tcolorbox}}%
+ \begingroup\tcbverbatimwrite{\kvtcb@listingfile}%
+}{\endtcbverbatimwrite\endgroup%
+ \tcblisting@box%
+}
+
+\def\tcbinputlisting#1{%
+ \begin{tcolorbox}[#1]\tcp@listing@process\end{tcolorbox}%
+}
+
+\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}%
+}%
+
+