summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/showexpl
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-07-14 22:24:45 +0000
committerKarl Berry <karl@freefriends.org>2006-07-14 22:24:45 +0000
commit5239fed29c5364a0c12526a31065483d95bcf73d (patch)
treea9ea18db755ba5facc75625494b522ce17e73916 /Master/texmf-dist/source/latex/showexpl
parent9cee07ca576206ca837b5c779e49bff2f7967bba (diff)
new package showexpl (27mar06)
git-svn-id: svn://tug.org/texlive/trunk@1837 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/showexpl')
-rw-r--r--Master/texmf-dist/source/latex/showexpl/showexpl.dtx607
-rw-r--r--Master/texmf-dist/source/latex/showexpl/showexpl.ins57
2 files changed, 664 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/showexpl/showexpl.dtx b/Master/texmf-dist/source/latex/showexpl/showexpl.dtx
new file mode 100644
index 00000000000..de5e77937b7
--- /dev/null
+++ b/Master/texmf-dist/source/latex/showexpl/showexpl.dtx
@@ -0,0 +1,607 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2004, 2005 by Rolf Niepraschk <Rolf.Niepraschk@ptb.de>
+% --------------------------------------------------------------------
+%
+% This file may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.2
+% 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.2 or later is part of all distributions of LaTeX
+% version 1999/12/01 or later.
+%
+% \fi
+%
+% \iffalse
+%<*driver>
+\ProvidesFile{showexpl.dtx}
+%</driver>
+%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+%<package>\ProvidesPackage{showexpl}
+%<*package>
+ [2005/12/06 v0.3d Typesetting example code (RN)]
+%</package>
+%
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{showexpl}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+ \DocInput{showexpl.dtx}
+ \PrintChanges
+ \PrintIndex
+\end{document}
+%</driver>
+% \fi
+%
+% \CheckSum{797}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+%
+% \changes{v0.1a}{2004/11/14}{Initial version}
+%
+% \GetFileInfo{showexpl.dtx}
+%
+% \DoNotIndex{\newcommand,\renewcommand,\newenvironment,\renewenvironment}
+% \DoNotIndex{\usepackage,\documentclass,\nofiles,\bibliogaphy}
+% \DoNotIndex{\tiny,\tableofcontens}
+% \DoNotIndex{\newif,\newcounter,\linewidth,\listfiles}
+% \DoNotIndex{\providecommand,\def,\edef,\let,\gdef,\xdef,\global,\newtoks}
+% \DoNotIndex{\RequirePackage,\DeclareOption,\ProcessOptions,\ExecuteOptions}
+% \DoNotIndex{\@nameuse,\value,\input,\InputIfFileExists}
+% \DoNotIndex{\@ifdefinable,\@ifundefined,\@percentchar}
+% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\PassOptionsToPackage}
+% \DoNotIndex{\CurrentOption,\jobname}
+% \DoNotIndex{\PackageError,\PackageWarning,\PackageWarningNoLine,\PackageInfo}
+% \DoNotIndex{\MessageBreak,\typeout}
+% \DoNotIndex{\z@,\z@skip,\p@,\@ne,\tw@,\thr@@,\@iv,\two@fourteen,\strip@pt}
+% \DoNotIndex{\the,\if,\else,\or,\fi,\ifnum,\ifdim,\ifcase,\ifodd}
+% \DoNotIndex{\advance,\multiply,\divide,\ht,\dp,\wd,\catcode}
+% \DoNotIndex{\@tfor,\do,\bgroup,\egroup,\ifx,\iftrue,\iffalse}
+% \DoNotIndex{\csname,\endcsname,\begingroup,\endgroup}
+% \DoNotIndex{\expandafter,\afterassignment,\noexpand}
+% \DoNotIndex{\@tempdima,\@tempdimb,\@tempdimc,\@tempcnta,\@tempcntb}
+% \DoNotIndex{\@halfwidth,\@wholewidth,\unitlength}
+% \DoNotIndex{\@clnwd,\@clnht,\@ovdx,\@ovdy,\@ovro,\@ovri,\@ovxx,\@ovyy}
+% \DoNotIndex{\@xarg,\@xdim,\@yarg,\@ydim,\@linelen,\@dashdim,\dimen@}
+% \DoNotIndex{\reserved@a,\relax,\protect,\long,\space}
+% \DoNotIndex{\if@tempswa,\@tempswatrue,\@tempswafalse,\@tempa}
+% \DoNotIndex{\@tempboxa,\@tempboxb,\show}
+% \DoNotIndex{\@empty,\%,\typeout,\vspace,\vskip,\the,\hbox,\par}
+% \DoNotIndex{\minipage,\endminipage,\trivlist,\endtrivlist}
+% \DoNotIndex{\parbox,\setbox,\setlength,\hfill,\item,\number}
+% \DoNotIndex{\x}
+% \DoNotIndex{\SX@put@a,\SX@put@b,\SX@put@l,\SX@put@r,\SX@put@o,\SX@put@i}
+%
+% ^^A\DoNotIndex{\usepackage,\documentclass,\tableofcontens,\printindex}
+%
+% \title{The \textsf{showexpl} package\thanks{This document
+% corresponds to \textsf{showexpl}~\fileversion, dated \filedate.}}
+% \author{Rolf Niepraschk\thanks{\texttt{Rolf.Niepraschk@ptb.de}}}
+% \date{\filedate}
+%
+% \maketitle
+%
+% \section{Introduction}
+%
+% Put text here.
+%
+% \section{Usage}
+%
+% Put text here.
+%
+%
+% \StopEventually{}
+%
+% \section{Implementation}
+% \changes{v0.1e}{2004/11/24}{Loading of |showexpl.cfg| added (RN).}
+% \begin{macrocode}
+\DeclareOption{final}{%
+ \PassOptionsToPackage{\CurrentOption}{graphicx}%
+ \PassOptionsToPackage{\CurrentOption}{listings}%
+}%
+\DeclareOption{draft}{%
+ \PassOptionsToPackage{\CurrentOption}{graphicx}%
+ \PassOptionsToPackage{\CurrentOption}{listings}%
+}%
+\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{listings}}
+\ProcessOptions\relax
+\RequirePackage{listings,calc,ifthen,graphicx,varwidth}
+\AtEndOfPackage{\IfFileExists{attachfile.sty}%
+ {\RequirePackage{attachfile}}{\def\SX@attachfile{}}}
+% \end{macrocode}
+% We must aktivate code from package \textsf{listings} for writing files.
+% \begin{macrocode}
+\lst@RequireAspects{writefile}
+% \end{macrocode}
+% \begin{macro}{\SX@defaultWD}
+% Parameter |#2| is a length or a number. Parameter |#1| is a
+% macro. After a call of \cmd{\SX@defaultWD} this macro contains the value
+% of the length or the value of the number multiplied by \cmd{\linewidth}.
+% \begin{macrocode}
+\newcommand*\SX@defaultWD[2]{%
+ \afterassignment\SX@def@WD\dimen@#2\linewidth\relax{#1}}
+\newcommand*\SX@def@WD{}
+\def\SX@def@WD#1\relax#2{\edef#2{\the\dimen@}}
+% \end{macrocode}
+% \end{macro}
+% Additional keys.
+% \changes{v0.1a}{2004/11/14}{``hpos'' and ``vpos'' added,
+% ``pos'' removed (RN).}
+% \changes{v0.1f}{2004/12/06}{``lstpreset'' added. (RN).}
+% \changes{v0.1h}{2005/06/03}{``codefile'' added. (RN).}
+% \begin{macrocode}
+\lst@Key{pos}\relax{\def\SX@pos{#1}}
+\lst@Key{width}\relax{\def\SX@width{#1}}
+\lst@Key{hsep}\relax{\@tempdima=#1\relax\edef\SX@hsep{\the\@tempdima}}
+\lst@Key{vsep}\relax{\@tempdima=#1\relax\edef\SX@vsep{\the\@tempdima}}
+\lst@Key{overhang}\relax{\def\SX@overhang{#1}}
+\lst@Key{wide}f[t]{\lstKV@SetIf{#1}\if@SX@wide}
+\lst@Key{rframe}\relax{\def\SX@rframe{#1}}
+\lst@Key{preset}\relax{\def\SX@preset{#1}}
+% \end{macrocode}
+% \changes{v0.1h}{2005/06/03}{``lstpreset'' renamed to ``explpreset'' (RN).}
+% \begin{macrocode}
+\lst@Key{explpreset}\relax{\def\SX@explpreset{#1}}
+\lst@Key{codefile}\relax{\def\SX@codefile{#1}}
+\newif\if@SX@rangeaccept \@SX@rangeacceptfalse
+\newif\if@SX@varwidth \@SX@varwidthfalse
+\newif\if@SX@wide \@SX@widefalse
+\newif\if@SX@attachfile \@SX@attachfilefalse
+% \end{macrocode}
+% \changes{v0.1j}{2005/06/12}{``rangeaccept'' added (RN).}
+% \changes{v0.1k}{2005/06/13}{Some bug corrections (RN).}
+% \begin{macrocode}
+\lst@Key{rangeaccept}f[t]{\lstKV@SetIf{#1}\if@SX@rangeaccept}
+% \end{macrocode}
+% \changes{v0.2a}{2005/07/16}{``varwidth'' and ``justification'' added (RN).}
+% \changes{v0.1l}{2005/06/19}{``graphic'' added (RN).}
+% \changes{v0.3a}{2005/08/20}{``attachfile'' added (RN).}
+% \begin{macrocode}
+\lst@Key{varwidth}f[t]{\lstKV@SetIf{#1}\if@SX@varwidth}
+\lst@Key{justification}\relax{\def\SX@justification{#1}}
+\lst@Key{attachfile}f[t]{\lstKV@SetIf{#1}\if@SX@attachfile}
+\newcommand*\SX@graphicname{}%
+\newcommand*\SX@graphicparam{}%
+\lst@Key{graphic}{}[]{%
+ \lstKV@OptArg[width=\linewidth]{#1}{%
+ \edef\SX@graphicparam{##1}\edef\SX@graphicname{##2}%
+ }%
+}%
+\newbox\SX@ResBox
+\newcommand*\SX@pos{}
+\newcommand*\SX@width{}
+\newcommand*\SX@hsep{}
+\newcommand*\SX@vsep{}
+\newcommand*\SX@overhang{}
+\newcommand*\SX@rframe{}
+\newcommand\SX@preset{}
+\newcommand*\SX@explpreset{}
+\newcommand*\SX@codefile{}\edef\SX@codefile{\jobname.tmp}
+\newcommand*\SX@justification{\raggedright}
+% \end{macrocode}
+% \begin{macro}{\SX@@preset}
+% Contains some redefinitions of \LaTeX\ macros and environments to do
+% nothing. \cmd{\SX@@preset} will be called just before
+% typesetting the result of the example code. More can be added with
+% the user key ``|preset=...|''.
+% \begin{macrocode}
+\newcommand*\SX@@preset{%
+ \renewcommand\documentclass[2][]{\SX@eat@version}%
+ \renewcommand\usepackage[2][]{\SX@eat@version}%
+ \renewenvironment{document}{}{}%
+ \renewenvironment{figure}[1][]{\def\@captype{figure}}{}%
+ \renewenvironment{table}[1][]{\def\@captype{table}}{}%
+ \renewcommand\cite[1][]{}%
+ \let\tableofcontens\relax
+ \let\listoffigures\relax
+ \let\listoftables\relax
+ \let\printindex\relax
+ \let\listfiles\relax
+ \let\nofiles\relax
+ \let\index\@gobble
+ \let\label\@gobble
+ \let\bibliography\@gobble
+}
+\newcommand*\SX@eat@version[1][]{}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\isSX@odd}
+% Parameter |#1| is executed on odd pages, parameter |#2| on
+% even pages.
+% \begin{macrocode}
+\newif\ifSX@wasodd
+\if@twoside
+ \newcommand*{\isSX@odd}[2]{%
+ \ifthenelse{\isodd{\pageref{\SX@IDENT}}}%
+ {\SX@wasoddtrue #1}{\SX@wasoddfalse #2}}
+\else
+ \newcommand*{\isSX@odd}[2]{#1}\SX@wasoddtrue
+\fi
+% \end{macrocode}
+% The call of \cmd{\isSX@odd} sets also \cmd{\ifSX@wasodd} to true or
+% false. If it's clear that no page break occurs, \cmd{\ifSX@wasodd}
+% can be used.
+% \begin{macrocode}
+\newcounter{ltxexample}
+\newcommand*{\SX@IDENT}{SX@\number\value{ltxexample}}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\SX@attachfile}
+% \changes{v0.3a}{2005/08/20}{Attach file functionality (with pdf\TeX)
+% added (RN).}
+% \begin{macrocode}
+\newcommand*\SX@attachfile{%
+ \if@SX@attachfile
+ \attachfile[mimetype=text/plain,subject={example \theltxexample}]%
+ {\SX@codefile}{}%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\SX@put@t/b/l/r/o/i}
+% Six macros for positioning |#2| (result) and |#3| (code). The result
+% can be
+% \underline{a}bove, \underline{b}elow, \underline{l}eft or
+% \underline{r}ight of the code area or on the \underline{o}uter or
+% \underline{i}nner side. Parameter |#1| is the width of the result.
+% \changes{v0.1b}{2004/11/18}{Positioning the captions more independend
+% of the result and code area (RN).}
+% \changes{v0.1c}{2004/11/19}{Commands \cmd{\SX@KillAboveCaptionskip} and
+% \cmd{\SX@KillBelowCaptionskip} added (RN).}
+% \changes{v0.1k}{2005/06/13}{Change [a]bove to [t]op (RN).}
+% \begin{macrocode}
+\newcommand*\SX@put@t[3]{%
+ \SX@ResultArea{\linewidth}{#2}\endgraf\pagebreak[2]%
+ \setlength\@tempdima{\SX@vsep}\vskip\@tempdima
+ \SX@CodeArea{\linewidth}{#3}%
+}
+\newcommand*\SX@put@b[3]{%
+ \SX@CodeArea{\linewidth}{#3}\endgraf\pagebreak[2]%
+ \setlength\@tempdima{\SX@vsep}\vskip\@tempdima
+ \SX@ResultArea{\linewidth}{#2}%
+}
+\newcommand*\SX@put@l[3]{%
+ \setlength\@tempdimc{\linewidth-#1-\SX@hsep}%
+ \SX@ResultArea{#1}{#2}\hfill\SX@CodeArea{\@tempdimc}{#3}%
+}
+\newcommand*\SX@put@r[3]{%
+ \setlength\@tempdimc{\linewidth-#1-\SX@hsep}%
+ \SX@CodeArea{\@tempdimc}{#3}\hfill\SX@ResultArea{#1}{#2}%
+}
+\newcommand*\SX@put@o[3]{%
+ \@nameuse{SX@put@\ifSX@wasodd r\else l\fi}{#1}{#2}{#3}%
+}
+\newcommand*\SX@put@i[3]{%
+ \@nameuse{SX@put@\ifSX@wasodd l\else r\fi}{#1}{#2}{#3}%
+}
+\newcommand\SX@ResultArea[2]{%
+ \SX@justification\setlength\@tempdima{#1}%
+ %\minipage\@tempdima#2\endminipage
+ \parbox\@tempdima{#2}%
+}
+\newcommand\SX@CodeArea[2]{%
+ \setlength\@tempdima{#1}%
+ \sbox\@tempboxa{\parbox\@tempdima{#2}}%
+ \@tempdima=\dp\@tempboxa\usebox\@tempboxa
+ \rlap{\raisebox{-\@tempdima}[0pt][0pt]{\SX@attachfile}}%
+}
+\newcommand*\SX@KillAboveCaptionskip{%
+ \ifx\lst@caption\@empty\else
+ \lst@IfSubstring t\lst@captionpos
+ {\vskip-\abovecaptionskip}{}%
+ \fi
+}
+\newcommand*\SX@KillBelowCaptionskip{%
+ \ifx\lst@caption\@empty\else
+ \lst@IfSubstring b\lst@captionpos
+ {\vskip-\belowcaptionskip}{}%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{environment}{LTXexample}
+% \changes{v0.1h}{2005/06/03}{Renamed from ``example'' to ``LTXexample' (RN).}
+% \begin{macrocode}
+\lstnewenvironment{LTXexample}[1][]
+{%
+ \@temptokena{#1}%
+ \begingroup
+% \end{macrocode}
+% For "codefile=..."/"graphic=..." if \cmd{\theltxexample} or
+% \cmd{\thelstlisting} is part of the filename.
+% \begin{macrocode}
+ \advance\c@ltxexample\@ne \advance\c@lstlisting\@ne
+ \expandafter\lstset\expandafter{\SX@explpreset,#1}%
+ \edef\x{\endgroup
+ \def\noexpand\SX@codefile{\SX@codefile}%
+ \def\noexpand\SX@graphicname{\SX@graphicname}%
+ \def\noexpand\SX@graphicparam{\SX@graphicparam}}%
+ \x
+ \xdef\SX@@explpreset{\the\@temptokena,codefile=\SX@codefile,
+ graphic={[\SX@graphicparam]{\SX@graphicname}}}%
+ \setbox\@tempboxa=\hbox\bgroup% Warum noetig?
+ \lst@BeginWriteFile{\SX@codefile}%
+}
+{%
+ \lst@EndWriteFile\egroup
+ \SX@put@code@result
+}
+% \end{macrocode}
+% \end{environment}
+% \changes{v0.1i}{2005/06/07}{Better caption positioning and
+% correct distance between the parts (RN).}
+% \changes{v0.1m}{2005/06/25}{Problem related to \cmd{\label}/\cmd{\ref}
+% solved (RN).}
+% \changes{v0.2a}{2005/07/16}{``varwidth'' package used (RN).}
+% \changes{v0.2b}{2005/07/30}{Check if \cmd{\SX@put@}\texttt{?}
+% is defined (RN).}
+% \begin{macrocode}
+\newcommand*\SX@put@code@result{%
+ \begingroup
+ \expandafter\lstset\expandafter{\SX@explpreset}%
+ \let\lst@float=\relax\let\SX@float=\relax
+% \end{macrocode}
+% Without the following call \cmd{\lst@beginfloat} is undefined.
+% \begin{macrocode}
+ \expandafter\lstset\expandafter{\SX@@explpreset}%
+ \ifx\lst@float\relax\else
+% \end{macrocode}
+% \cmd{\lst@float} must be \cmd{\relax} because the whole ``example''
+% should float but not the listings part in addition.
+% \begin{macrocode}
+ \let\SX@float=\lst@float\let\lst@float=\relax
+ \g@addto@macro\SX@@explpreset{,float=false}%
+ \edef\@tempa{\noexpand\lst@beginfloat{lstlisting}[\SX@float]}%
+ \expandafter\@tempa
+ \fi
+ \ifx\lst@caption\@empty
+ \lstset{nolol=true}%
+ \fi
+ \if@SX@wide\def\SX@overhang{\marginparwidth+\marginparsep}\fi
+ \trivlist\item\relax
+ \stepcounter{ltxexample}\label{\SX@IDENT}%
+% \end{macrocode}
+% Make \cmd{\SX@width} a real dimension if the unit is missing.
+% \begin{macrocode}
+ \SX@defaultWD\SX@width{\SX@width}%
+% \end{macrocode}
+% Set the default width if necessary.
+% \begin{macrocode}
+ \ifdim\SX@width<\z@
+ \@tempswatrue
+ \def\@tempa{t}%
+ \ifx\@tempa\SX@pos\@tempswafalse\fi
+ \def\@tempa{b}%
+ \ifx\@tempa\SX@pos\@tempswafalse\fi
+ \setlength\@tempdima{\linewidth+\SX@overhang}%
+ \if@tempswa\@tempdima=.5\@tempdima\fi%
+ \edef\SX@width{\the\@tempdima}%
+ \fi
+% \end{macrocode}
+% Correct \cmd{\SX@width} if a frame is requested.
+% \begin{macrocode}
+ \ifx\SX@rframe\@empty
+ \long\def\SX@frame##1{##1}%
+ \else
+ \let\SX@frame\fbox
+ \setlength\@tempdima{\SX@width-2\fboxsep-2\fboxrule}%
+ \edef\SX@width{\the\@tempdima}%
+ \fi
+ \isSX@odd{\def\@tempa{l}}{\def\@tempa{r}}%
+ \makebox[\linewidth][\@tempa]{%
+ \parbox{\linewidth+\SX@overhang}{%
+% \end{macrocode}
+% \cmd{\SX@codefile} (|\jobname.tmp|) is not nessesary for the filelist.
+% \begin{macrocode}
+ \let\@addtofilelist\@gobble
+ \let\lst@ifdisplaystyle=\iftrue
+ \SX@KillAboveCaptionskip\lst@MakeCaption{t}%
+ \lst@belowskip=\z@
+ \let\SX@MakeCaption\lst@MakeCaption
+ \let\lst@MakeCaption\@gobble
+% \end{macrocode}
+% Use the ``natural'' width of the result code if ``varwidth'' is
+% true.
+% \begin{macrocode}
+ \setbox\SX@ResBox\hbox{%
+ \SX@frame{%
+ \@nameuse{\if@SX@varwidth varwidth\else minipage\fi}%
+ \SX@width\relax\SX@resultInput%
+ \@nameuse{end\if@SX@varwidth varwidth\else minipage\fi}}}%
+ \edef\SX@width{\the\wd\SX@ResBox}%
+ \@ifundefined{SX@put@\SX@pos}%
+ {\@latex@error{Parameter `\SX@pos' undefined}\@ehd}%
+ {\@nameuse{SX@put@\SX@pos}%
+ {\SX@width}{\box\SX@ResBox}{\SX@codeInput}}%
+ \let\lst@MakeCaption\SX@MakeCaption
+ \lst@MakeCaption{b}\SX@KillBelowCaptionskip
+ }%
+ }%
+ \endtrivlist
+ \ifx\SX@float\relax\else\expandafter\lst@endfloat\fi
+ \gdef\SX@@explpreset{}%
+ \endgroup
+}
+\newcommand\SX@SkipToFirst{%
+ \ifeof\@inputcheck\else
+ \ifnum \lst@lineno=\lst@firstline\else
+ \read\@inputcheck to\SX@tempa
+ \typeout{IGNORE (\the\lst@lineno)}%
+ \global\advance\lst@lineno\@ne
+ \SX@SkipToFirst
+ \fi
+ \fi
+}
+\newcommand\SX@ProcessResult{%
+ \ifeof\@inputcheck\else
+ \let\SX@tempb\SX@ProcessResult
+ \ifnum \lst@lineno>\lst@lastline
+ \ifx\lst@linerange\@empty
+ \let\SX@tempb\relax
+ \else
+ \lst@GetLineInterval
+ \SX@SkipToFirst
+ \fi
+ \else
+ \read\@inputcheck to\SX@tempa
+ \typeout{READ (\the\lst@lineno)}%
+ \expandafter\g@addto@macro\expandafter\SX@lines\expandafter{\SX@tempa}%
+ \global\advance\lst@lineno\@ne
+ \fi
+ \expandafter\SX@tempb
+ \fi
+}
+% \end{macrocode}
+% \begin{macro}{\SX@input}
+% \changes{v0.1j}{2005/06/12}{For ranges of lines (RN).}
+% \begin{macrocode}
+\newcommand\SX@input[1]{%
+ \begingroup
+ \IfFileExists{#1}{}%
+ {%
+ \filename@parse{#1}%
+ \ifx\filename@ext\relax \def\filename@ext{tex}\fi
+ \@latexerr{File
+ `\filename@area\filename@base.\filename@ext' not found.^^J^^J}\@ehd%
+ }%
+ \openin\@inputcheck#1
+ \lsthk@PreSet\let\lst@linerange\@empty\global\lst@lineno\@ne
+ \expandafter\lstset\expandafter{\SX@@explpreset}%
+ \ifx\lst@linerange\@empty
+ \edef\lst@linerange{{\lst@firstline}-{\lst@lastline},}%
+ \fi
+ \lst@GetLineInterval
+ \SX@Info
+ \SX@SkipToFirst\let\SX@lines\@empty
+ \SX@ProcessResult
+ \closein\@inputcheck
+ \SX@lines
+ \endgroup
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\newcommand*\SX@Info{%
+ \typeout{--------------------------------}%
+ \typeout{pos=\SX@pos}%
+ \typeout{width=\SX@width}%
+ \typeout{hsep=\SX@hsep}%
+ \typeout{vsep=\SX@vsep}%
+ \typeout{overhang=\SX@overhang}%
+ \typeout{rframe=\SX@rframe}%
+ \typeout{codefile=\SX@codefile}%
+ \@ifundefined{lst@firstline}{}%
+ {\typeout{\string\lst@firstline=\lst@firstline}}%
+ \@ifundefined{lst@lastline}{}%
+ {\typeout{\string\lst@lastline=\lst@lastline}}%
+ \@ifundefined{lst@linerange}{}%
+ {\typeout{\string\lst@linerange=\lst@linerange}}%
+ \typeout{\string\if@SX@wide=\if@SX@wide TRUE\else FALSE\fi}%
+ \typeout{\string\if@SX@rangeaccept=\if@SX@rangeaccept TRUE\else FALSE\fi}%
+ \typeout{\string\if@SX@varwidth=\if@SX@varwidth TRUE\else FALSE\fi}%
+ \typeout{graphicfile=\SX@graphicname, graphicparameter=[\SX@graphicparam]}%
+ \typeout{--------------------------------}%
+}
+\providecommand*\MakePercentIgnore{\catcode`\%9\relax}
+\providecommand*\MakePercentComment{\catcode`\%14\relax}
+% \end{macrocode}
+% \begin{macro}{\SX@resultInput}
+% \changes{v0.3b}{2005/10/15}{Input of result code now inside a group;
+% \cmd{\makeatother} added (RN).}
+% \changes{v0.3c}{2005/10/15}{Wrong catcode for newline char corrected (RN).}
+% \changes{v0.3d}{2005/12/06}{Missing \cs{par} added (RN).}
+% \begin{macrocode}
+\newcommand*\SX@resultInput{%
+ \ifx\SX@graphicname\@empty
+ \begingroup
+ \MakePercentComment\makeatother\catcode`\^^M=5\relax
+ \SX@@preset\SX@preset
+ \if@SX@rangeaccept
+ \let\SX@tempa=\SX@input
+ \else
+ \let\SX@tempa=\input
+ \fi
+ \SX@tempa{\SX@codefile}\par%
+ \endgroup
+ \else
+ \expandafter\includegraphics\expandafter[\SX@graphicparam]%
+ {\SX@graphicname}%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\SX@codeInput}
+% \begin{macrocode}
+\newcommand*\SX@codeInput{%
+% \end{macrocode}
+% Without a caption entry the command \cmd{\lstinputlisting} adds the
+% filename to the ``list of listings'' (lol). This should be avoided.
+% \changes{v0.1d}{2004/11/20}{\cmd{\lstset}|{nolol}| and
+% \cmd{\lstset}|{float=false}| added (RN).}
+% \changes{v0.1h}{2005/06/03}{\cmd{\lstset}|{float=false}| removed (RN).}
+% \begin{macrocode}
+ \begingroup
+% \end{macrocode}
+% The default parameters for all examples.
+% \begin{macrocode}
+ \expandafter\lstset\expandafter{\SX@explpreset}%
+% \end{macrocode}
+% If "numbers=none" then margin dimensions should be zero.
+% \begin{macrocode}
+ \expandafter\lstset\expandafter{\SX@@explpreset}%
+ \ifx\lst@PlaceNumber\@empty
+ \g@addto@macro\SX@@explpreset{,xleftmargin=0pt,xrightmargin=0pt}%
+ \fi
+ \SX@Info
+ \expandafter\lstinputlisting\expandafter%
+ [\SX@@explpreset,nolol=true,caption={}]{\SX@codefile}%
+ \endgroup
+}%
+% \end{macrocode}
+% \end{macro}
+% \changes{v0.1h}{2005/06/03}{New macro \cmd{\LTXinputExample} (RN).}
+% \begin{macrocode}
+\newcommand*\LTXinputExample[2][]{%
+ \g@addto@macro\SX@@explpreset{#1,codefile=#2}%
+ \SX@put@code@result}%
+% \end{macrocode}
+% All the default values.
+% \begin{macrocode}
+\lstset{explpreset={numbers=left,numberstyle=\tiny,numbersep=.3em,
+% \end{macrocode}
+% Negative width means defaults.
+% \begin{macrocode}
+ xleftmargin=1em,columns=flexible,language=[LaTeX]TEX},pos=l,width=-99pt,
+ overhang=0pt,hsep=\columnsep,vsep=\bigskipamount,rframe=single}
+% \end{macrocode}
+% \changes{v0.1g}{2004/12/10}{Loading of |showexpl.cfg| now at end of
+% package (RN).}
+% Changing the defaults possible in |showexpl.cfg|.
+% \begin{macrocode}
+\InputIfFileExists{showexpl.cfg}{}{}
+% \end{macrocode}
+%
+% \Finale
+\endinput
diff --git a/Master/texmf-dist/source/latex/showexpl/showexpl.ins b/Master/texmf-dist/source/latex/showexpl/showexpl.ins
new file mode 100644
index 00000000000..37e454e7d8c
--- /dev/null
+++ b/Master/texmf-dist/source/latex/showexpl/showexpl.ins
@@ -0,0 +1,57 @@
+%%
+%% Copyright (C) 2004 by Rolf Niepraschk <Rolf.Niepraschk@ptb.de>
+%%
+%% This file may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License, either version 1.2 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.2 or later is part of all distributions of LaTeX version
+%% 1999/12/01 or later.
+%%
+
+\input docstrip.tex
+\keepsilent
+
+\usedir{tex/latex/showexpl}
+
+\preamble
+
+This is a generated file.
+
+Copyright (C) 2004 by Rolf Niepraschk <Rolf.Niepraschk@ptb.de>
+
+This file may be distributed and/or modified under the conditions of
+the LaTeX Project Public License, either version 1.2 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.2 or later is part of all distributions of LaTeX version
+1999/12/01 or later.
+
+\endpreamble
+
+\askforoverwritefalse
+
+\generate{\file{showexpl.sty}{\from{showexpl.dtx}{package}}}
+
+\obeyspaces
+\Msg{*************************************************************}
+\Msg{* *}
+\Msg{* To finish the installation you have to move the following *}
+\Msg{* file into a directory searched by TeX: *}
+\Msg{* *}
+\Msg{* showexpl.sty *}
+\Msg{* *}
+\Msg{* To produce the documentation run the file showexpl.dtx *}
+\Msg{* through LaTeX. *}
+\Msg{* *}
+\Msg{* Happy TeXing! *}
+\Msg{* *}
+\Msg{*************************************************************}
+
+\endbatchfile