summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/tcolorbox/tcolorbox.doc.listings.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-04-23 22:09:19 +0000
committerKarl Berry <karl@freefriends.org>2013-04-23 22:09:19 +0000
commit0d7fc835562c9bb65c3ae6f64e46499031721fd2 (patch)
tree6274363ab768f87ac05850e5ebff084f66e7e507 /Master/texmf-dist/doc/latex/tcolorbox/tcolorbox.doc.listings.tex
parent31a5d4cf45c66bd5927d6f405c2e2f7b8ec8dc5c (diff)
tcolorbox (23apr13)
git-svn-id: svn://tug.org/texlive/trunk@30073 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/tcolorbox/tcolorbox.doc.listings.tex')
-rw-r--r--Master/texmf-dist/doc/latex/tcolorbox/tcolorbox.doc.listings.tex89
1 files changed, 70 insertions, 19 deletions
diff --git a/Master/texmf-dist/doc/latex/tcolorbox/tcolorbox.doc.listings.tex b/Master/texmf-dist/doc/latex/tcolorbox/tcolorbox.doc.listings.tex
index 2edcab150f2..16cbbb6ccf0 100644
--- a/Master/texmf-dist/doc/latex/tcolorbox/tcolorbox.doc.listings.tex
+++ b/Master/texmf-dist/doc/latex/tcolorbox/tcolorbox.doc.listings.tex
@@ -35,7 +35,8 @@ This is a \LaTeX\ example which displays the text as source code
and in compiled form.
\end{tcblisting}
\end{dispExample}
-{\tcbset{breakable}\begin{dispExample}
+\clearpage
+\begin{dispExample}
\begin{tcblisting}{colback=yellow!5,colframe=yellow!50!black,listing only,
title=This is source code in another language (XML), fonttitle=\bfseries,
listing options={language=XML,columns=fullflexible,keywordstyle=\color{red}}}
@@ -47,7 +48,6 @@ and in compiled form.
</project>
\end{tcblisting}
\end{dispExample}
-}
\end{docEnvironment}
@@ -90,7 +90,7 @@ This \textbf{text} is written to a standardized file for later usage.
\end{dispExample}
\end{docCommand}
-\enlargethispage*{5mm}
+%\enlargethispage*{5mm}
\begin{docCommand}{tcbusetemplisting}{}
Typesets text as listing from a temporary file which was written by
\refEnv{tcbwritetemp}.
@@ -98,6 +98,61 @@ This \textbf{text} is written to a standardized file for later usage.
\clearpage
+\begin{docCommand}{newtcblisting}{\marg{name}\oarg{number}\oarg{default}\marg{options}}
+ Creates a new environment \meta{name} based on \refEnv{tcblisting}.
+ Basically, |\newtcblisting| operates like |\newenvironment|. This means,
+ the new environment \meta{name} optionally takes \meta{number} arguments, where
+ \meta{default} is the default value for the optional first argument.
+ The \meta{options} are given to the underlying |tcblisting|.
+ Note that \refKey{/tcb/savedelimiter} is set to the given \meta{name}
+ automatically.
+\begin{dispExample*}{sbs,lefthand ratio=0.5}
+\newtcblisting{mybox}{%
+ colback=red!5!white,
+ colframe=red!75!black}
+
+\begin{mybox}
+This is my \LaTeX\ box.
+\end{mybox}
+\end{dispExample*}
+
+\begin{dispExample*}{sbs,lefthand ratio=0.5}
+\newtcblisting{mybox}[1]{%
+ colback=red!5!white,
+ colframe=red!75!black,
+ fonttitle=\bfseries,
+ title=#1}
+
+\begin{mybox}{Listing Box}
+This is my \LaTeX\ box.
+\end{mybox}
+\end{dispExample*}
+
+\begin{dispExample*}{sbs,lefthand ratio=0.5}
+\newtcblisting{mybox}[2][]{%
+ colback=red!5!white,
+ colframe=red!75!black,
+ fonttitle=\bfseries,
+ title=#2,#1}
+
+\begin{mybox}[listing only]
+ {Listing Box}
+This is my \LaTeX\ box.
+\end{mybox}
+\bigskip
+
+\begin{mybox}[listing side text]
+ {Listing Box}
+This is my
+\LaTeX\ box.
+\end{mybox}
+
+\end{dispExample*}
+\end{docCommand}
+
+
+
+\clearpage
\subsection{Option Keys of the Library}
For the \meta{options} in \refEnv{tcblisting} respectively \refCom{tcbinputlisting}
the following |pgf| keys can be applied. The key tree path |/tcb/| is not to
@@ -327,9 +382,9 @@ For the next examples, two environments
are defined for abbreviation.
\begin{dispListing}
-\newenvironment{texexp}[1]{\tcblisting{texexp,#1}}{\endtcblisting}
+\newtcblisting{texexp}[1]{texexp,#1}
-\newenvironment{texexptitled}[3][]{\tcblisting{example={#2}{#3},#1}}{\endtcblisting}
+\newtcblisting{texexptitled}[3][]{example={#2}{#3},#1}
\end{dispListing}
\tcbusetemp
@@ -536,22 +591,16 @@ Inside the exercise text, there may be text parts which are needed as
saved by \refEnv{tcbwritetemp} and used in compiled form by \refCom{tcbusetemp}
or as source code by \refCom{tcbusetemplisting}.
-At first, we generate some new keys. Since exercises and solutions should
-be numbered, we force to use a label \meta{marker} while using the style |texercise|.
+At first, we generate some a common style for the exercises and the
+solutions. Further, since exercises and solutions should
+be numbered, we force to use a label \meta{marker}.
Automatically, the label |exe:|\meta{marker} is used to mark the exercise
and the label |sol:|\meta{marker} is used to mark the solution.
\begin{dispListing}
-\tcbset{
-texercisestyle/.style={arc=0.5mm, colframe=blue!25!yellow!90!white,
+\tcbset{texercisestyle/.style={arc=0.5mm, colframe=blue!25!yellow!90!white,
colback=blue!25!yellow!5!white, coltitle=blue!25!yellow!40!black,
- fonttitle=\small\sffamily\bfseries, fontupper=\small, fontlower=\small},
-texercise/.code={\refstepcounter{texercise}\label{exe:#1}\writesol{#1}%
- \pgfkeysalso{texercisestyle,
- listing file={\solfile\thetexercise},
- title={Exercise \arabic{texercise}\hfill\mdseries Solution on page \pageref{sol:#1}}
- }}
-}
+ fonttitle=\small\sffamily\bfseries, fontupper=\small, fontlower=\small}}
\end{dispListing}
\tcbusetemp
@@ -559,9 +608,11 @@ With these preparations, the kernel environment |texercise| for our
exercises is created quickly:
\begin{dispListing}
-\newenvironment{texercise}[2][]{%
- \tcolorbox[texercise=#2,savedelimiter=texercise,#1]}%
- {\endtcolorbox}
+\newtcolorbox{texercise}[2][]{texercisestyle,
+ code={\refstepcounter{texercise}\label{exe:#2}\writesol{#2}},
+ listing file={\solfile\thetexercise},
+ title={Exercise \arabic{texercise}\hfill\mdseries Solution on page \pageref{sol:#2}},
+ #1}
\end{dispListing}
\tcbusetemp