diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/tcolorbox/tcblistings.code.tex |
Initial commit
Diffstat (limited to 'macros/latex/contrib/tcolorbox/tcblistings.code.tex')
-rw-r--r-- | macros/latex/contrib/tcolorbox/tcblistings.code.tex | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/macros/latex/contrib/tcolorbox/tcblistings.code.tex b/macros/latex/contrib/tcolorbox/tcblistings.code.tex new file mode 100644 index 0000000000..418618ad6b --- /dev/null +++ b/macros/latex/contrib/tcolorbox/tcblistings.code.tex @@ -0,0 +1,97 @@ +%% The LaTeX package tcolorbox - version 4.20 (2019/03/02) +%% tcblistings.code.tex: Code for colorboxes with listings +%% +%% ------------------------------------------------------------------------------------------- +%% Copyright (c) 2006-2019 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{4.20} + +\RequirePackage{listings}[2007/02/22] + +\tcbuselibrary{listings@core} + +\let\tcb@listing@MakeCaption@org=\lst@MakeCaption + +\def\tcb@listing@set@MakeCaption@org{% + \let\lst@MakeCaption\tcb@listing@MakeCaption@org} +\def\tcb@listing@set@MakeCaption@empty{% + \lst@HRefStepCounter{lstlisting}% + \let\lst@MakeCaption\@gobble} + +\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, nolol, + inputencoding=\kvtcb@listingencoding} + +\def\tcb@listing@input@listing#1#2{% + \begingroup% + \toks@=\expandafter{#1}% + \edef\tcb@temp{\noexpand\lstinputlisting[nolol,\the\toks@]}% + \tcb@listing@set@MakeCaption% + \tcb@temp{#2}% + \endgroup% +}% + + +\def\tcb@listing@uselistinglisting{% + \tcb@listing@input@listing{\kvtcb@listingoptions}{\kvtcb@listingfile}% +}% + +\def\tcb@listing@usetemplisting{% + \tcb@listing@input@listing{\kvtcb@listingoptions}{\kvtcb@tempfile}% +}% + +\def\tcb@listing@doc@usetemplisting{% + \tcb@listing@input@listing{\kvtcb@doclistingoptions}{\kvtcb@tempfile}% +} + +\tcbset{% + listing options/.store in=\kvtcb@listingoptions,% + listing style/.style={listing options={style=#1}},% + no listing options/.style={listing options=},% + listing inputencoding/.store in=\kvtcb@listingencoding,% + 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}, + every listing line/.code={% + \def\lst@NewLine{% + \ifx\lst@OutputBox\@gobble\else + \par\noindent \hbox{}#1% + \fi + \global\advance\lst@newlines\m@ne + \lst@newlinetrue}},% + every listing line*/.style={every listing line={#1},% + code={\setbox\z@=\hbox{#1}\tcbdimto\kvtcb@rightupper{\kvtcb@rightupper+\wd\z@}}},% +} + + +\tcbset{% + reset@listings/.style={% + listing style=tcblatex, + listing inputencoding=\inputencodingname, + listing remove caption, + listing engine=listings, + }, + initialize@reset=reset@listings, +} + |