diff options
-rwxr-xr-x | Build/cdbuild/ctan2tds.pl | 2 | ||||
-rwxr-xr-x | Build/tools/tpm-ctan-check | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/showexpl/README | 9 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/showexpl/result-picture.pdf | bin | 0 -> 19256 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/showexpl/showexpl-test.pdf | bin | 0 -> 261407 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/showexpl/showexpl-test.tex | 290 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/showexpl/showexpl.cfg | 50 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/showexpl/showexpl.dtx | 607 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/showexpl/showexpl.ins | 57 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/showexpl/showexpl.sty | 357 | ||||
-rw-r--r-- | Master/texmf-dist/tpm/showexpl.tpm | 32 | ||||
-rw-r--r-- | Master/texmf/lists/showexpl | 11 | ||||
-rw-r--r-- | Master/texmf/tpm/collection-latexextra.tpm | 1 |
13 files changed, 1418 insertions, 2 deletions
diff --git a/Build/cdbuild/ctan2tds.pl b/Build/cdbuild/ctan2tds.pl index 84a92fe6c17..9cc3741cafb 100755 --- a/Build/cdbuild/ctan2tds.pl +++ b/Build/cdbuild/ctan2tds.pl @@ -239,6 +239,7 @@ chdir $startdir || die "chdir($startdir) failed: $!"; 'pxfonts', "&MAKEflatten", 'revtex', "&MAKEflatten", 'seminar', "&MAKEseminar", + 'showexpl', "&MAKEflatten", 'siam', "&MAKEsiam", 'skak', "&MAKEflatten", 'symbolindex', "print \"requires binary, skip\"", @@ -610,6 +611,7 @@ $standardtex='\.cfg|\.sty|\.clo|\.ldf|\.cls|\.def|\.fd$'; 'revtex', '\.sty|\.cls|\.rtx', 'rlepsf', 'rlepsf.tex', 'seminar', '\.bug|\.bg2|\.cls|\.sty|2up.tex', + 'showexpl', '\.sty|\.clo|\.ldf|\.cls|\.def|\.fd$', # not cfg 'spotcolor', 'spotcolor*.tex', 'startex', '\.tex', 'syntax', 'syntax\.tex', diff --git a/Build/tools/tpm-ctan-check b/Build/tools/tpm-ctan-check index 7855bd8d39c..57aa79544d8 100755 --- a/Build/tools/tpm-ctan-check +++ b/Build/tools/tpm-ctan-check @@ -84,8 +84,8 @@ sub main "randbild", "robustcommand", "sciposter", "sectionbox", "sectsty", "semantic", "seminar", "semioneside", - "setspace", "sf298", "sides", "skaknew", "sort-by-letters", - "sparklines", "spotcolor", + "setspace", "sf298", "showexpl", "sides", "skaknew", + "sort-by-letters", "sparklines", "spotcolor", "sttools", "struktex", "subfig", "sudoku", "svn-multi", "svninfo", "t-angles", "tabulary", "talk", "tamethebeast", "tex-refs", "texmate", "texshade", diff --git a/Master/texmf-dist/doc/latex/showexpl/README b/Master/texmf-dist/doc/latex/showexpl/README new file mode 100644 index 00000000000..b32d0704b60 --- /dev/null +++ b/Master/texmf-dist/doc/latex/showexpl/README @@ -0,0 +1,9 @@ + +The LaTeX package `showexpl' provides a way to typeset LaTeX source +code and the related result in the same document. The `listings' +package is required. See `doc/showexpl-test.tex' for the details. + + Rolf Niepraschk + email: Rolf.Niepraschk@ptb.de + 2006-03-26 + diff --git a/Master/texmf-dist/doc/latex/showexpl/result-picture.pdf b/Master/texmf-dist/doc/latex/showexpl/result-picture.pdf Binary files differnew file mode 100644 index 00000000000..6b17a10fd6c --- /dev/null +++ b/Master/texmf-dist/doc/latex/showexpl/result-picture.pdf diff --git a/Master/texmf-dist/doc/latex/showexpl/showexpl-test.pdf b/Master/texmf-dist/doc/latex/showexpl/showexpl-test.pdf Binary files differnew file mode 100644 index 00000000000..c85329a5228 --- /dev/null +++ b/Master/texmf-dist/doc/latex/showexpl/showexpl-test.pdf diff --git a/Master/texmf-dist/doc/latex/showexpl/showexpl-test.tex b/Master/texmf-dist/doc/latex/showexpl/showexpl-test.tex new file mode 100644 index 00000000000..316049f555f --- /dev/null +++ b/Master/texmf-dist/doc/latex/showexpl/showexpl-test.tex @@ -0,0 +1,290 @@ + +% Rolf Niepraschk, 2005-07-16, Rolf.Niepraschk@ptb.de + +\listfiles\errorcontextlines=100 +\documentclass[a4paper,draft,twoside]{article} + +\usepackage[dvipsnames]{xcolor} +\usepackage[textwidth=12cm,marginparwidth=4cm]{geometry} + +\usepackage[final]{showexpl} + +\usepackage[T1]{fontenc} + +\IfFileExists{luximono.sty}% +{% + \usepackage[scaled]{luximono}% +} +{% + \IfFileExists{beramono.sty}% + {% + \usepackage[scaled]{beramono}% + }{} +} + +\lstset{% + basicstyle=\ttfamily\small, + commentstyle=\itshape\ttfamily\small, + showspaces=false, + showstringspaces=false, + breaklines=true, + backgroundcolor=\color{lightgray}, + breakautoindent=true, + captionpos=t +} + +\iftrue +\lstset{explpreset={numbers=left,numberstyle=\tiny,numbersep=.3em, + xleftmargin=1em,columns=flexible,language={}}} +\fi + +\usepackage[font=small,labelfont=bf,justification=raggedright,% + singlelinecheck=false]{caption} +\usepackage{amsmath} + +\AtBeginDocument{% + \renewcommand*\lstlistlistingname{Examples} + \renewcommand*\lstlistingname{Example} +} + +\newcommand*{\MARKER}% + {\noindent\strut\vrule + \hrulefill~half text area~\hrulefill\vrule + \hrulefill~half text area~\hrulefill\vrule + \marginpar{\strut\vrule\hrulefill~margin area~\hrulefill\vrule}} + +\begin{filecontents*}{ex1.tex} +Line 1 \par +Line 2 \par +Line 3 \par +Line 4 \par +Line 5 \par +Line 6 \par +Line 7 \par +Line 8 \par +Line 9 \par +Line 10 \par +Line 11 \par +Line 12 \par +Line 13 +\end{filecontents*} + +\begin{document} + +\section*{The \LaTeX\ package \textsf{showexpl}} + +\bigskip + +\lstlistoflistings + +\subsection*{The \textsf{listings} parameters still works} + +\begin{LTXexample}[pos=t,numbers=none, + codefile=\jobname-\theltxexample.tex] +\Large\LaTeX{} \LaTeX{} +\LaTeX{} \LaTeX{} +\end{LTXexample} + +\MARKER + +\subsection*{The \texttt{pos}, \texttt{overhang}, and + \texttt{caption} parameters} + +\begin{LTXexample}[pos=b,overhang=.5\marginparwidth+.5\marginparsep,% + caption={The \texttt{overhang} parameter}] +\Large\LaTeX{} \LaTeX{} +\LaTeX{} \LaTeX{} +\end{LTXexample} + +\MARKER + +\begin{LTXexample}[pos=l,hsep=50pt,width=55mm] +\Large\LaTeX{} \LaTeX{} +\LaTeX{} \LaTeX{} +\end{LTXexample} + +\MARKER + +\subsection*{The \texttt{wide} parameter with inner and outer position} + +\begin{LTXexample}[pos=o,wide,caption={The \texttt{wide} parameter},% + label=ex:Gustav] +\Large\LaTeX{} \LaTeX{} +\LaTeX{} \LaTeX{} +\end{LTXexample} + +\MARKER + +\begin{LTXexample}[pos=i,wide] +\Large\LaTeX{} \LaTeX{} +\LaTeX{} \LaTeX{} +\end{LTXexample} + + +%-------------- +\newpage + +\subsection*{More examples on an even (left) page} + +\begin{LTXexample}[pos=t] +\Large\LaTeX{} \LaTeX{} +\LaTeX{} \LaTeX{} +\end{LTXexample} + +\MARKER + +\begin{LTXexample}[pos=b,overhang=.5\marginparwidth+.5\marginparsep,% + captionpos=b,caption={The \texttt{overhang} parameter again},% + label=ex:Fridolin] +\Large\LaTeX{} \LaTeX{} +\LaTeX{} \LaTeX{} +\end{LTXexample} + +\MARKER + +\begin{LTXexample}[pos=l,hsep=50pt,width=55mm] +\Large\LaTeX{} \LaTeX{} +\LaTeX{} \LaTeX{} +\end{LTXexample} + +\MARKER + +\begin{LTXexample}[pos=o,wide,captionpos=b,% + caption={The \texttt{wide} parameter again}] +\Large\LaTeX{} \LaTeX{} +\LaTeX{} \LaTeX{} +\end{LTXexample} + +\MARKER + +\begin{LTXexample}[pos=i,wide] +\Large\LaTeX{} \LaTeX{} +\LaTeX{} \LaTeX{} +\end{LTXexample} + + +%-------------- +\newpage + +\subsection*{Whole \LaTeX{} documents as example code and + the para\-meters \texttt{preset}, \texttt{rframe}, and \texttt{rangeaccept}} + +\begin{LTXexample}[pos=r,wide,width=.65,preset=\LARGE,rframe={}] +\documentclass[a4paper,twoside]{article} +\begin{document} + \begin{equation} + \sigma(t)=\frac{1}{\sqrt{2\pi}} + \int^t_0 e^{-x^2/2} dx + \end{equation} +\end{document} +\end{LTXexample} + +\MARKER + +\begin{LTXexample}[wide,width=.75,preset=\footnotesize,rframe=single,% + codefile=\jobname-\theltxexample.tex] +\documentclass[a4paper,twoside]{article} +\usepackage{amsmath} +% enhancements for mathematical formulas +\begin{document} +\begin{equation}\label{eq:barwq} +\begin{split} + H_c&=\frac{1}{2n} + \sum^n_{l=0}(-1)^{l}(n-{l})^{p-2} + \sum_{l _1+\dots+ l _p=l}\prod^p_{i=1} + \binom{n_i}{l _i}\\ + &\quad\cdot[(n-l )-(n_i-l _i)]^{n_i-l _i}\cdot + \Bigl[(n-l )^2-\sum^p_{j=1}(n_i-l _i)^2\Bigr]. +\end{split} +\end{equation} +\end{document} +\end{LTXexample} + +\LTXinputExample[% + pos=r,backgroundcolor=\color{Goldenrod!50},% + %firstline=3,lastline=6,% + linerange={3-6,8-10},% + float=tb,rangeaccept=true,% + caption={[Floating Example]% + This is a floating Example (parameter \texttt{rangeaccept=true})}]{ex1} + +\newpage + +\MARKER + +\subsection*{Using a graphic as the result} + +\begin{LTXexample}[pos=i,wide] +\Large\LaTeX{} \LaTeX{} +\LaTeX{} \LaTeX{} +\end{LTXexample} + +\begin{LTXexample}[pos=i,wide,rframe={},% +graphic=result-picture]% graphic=\jobname-\theltxexample +\Large\LaTeX{} \LaTeX{} +\LaTeX{} \LaTeX{} +\end{LTXexample} + +\begin{LTXexample}[caption={The \texttt{graphic} parameter},captionpos=b,% + pos=i,wide,graphic={[width=.5\linewidth]result-picture}] +\Large\LaTeX{} \LaTeX{} +\LaTeX{} \LaTeX{} +\end{LTXexample} + +\newpage + +\subsection*{The parameter \texttt{varwidth}} + +\bigskip + +\MARKER + +\begin{LTXexample}[caption={Fix width of the result + (side-by-side default: \texttt{0.5\textbackslash linewidth})},% + captionpos=b] +\setlength{\unitlength}{1cm} +\begin{picture}(2,2) \thicklines + \thicklines + \put(0,0){\line(1,1){2}} + \put(0,2){\line(1,-1){2}} +\end{picture} +\end{LTXexample} + +\medskip + +\begin{LTXexample}[caption={[The \texttt{varwidth} parameter]% + Width of the result reduced to the ``natural'' + width (\texttt{varwidth=true})},varwidth,captionpos=b] +\setlength{\unitlength}{1cm} +\begin{picture}(2,2) \thicklines + \put(0,0){\line(1,1){2}} + \put(0,2){\line(1,-1){2}} +\end{picture} +\end{LTXexample} + +\medskip + +\begin{LTXexample}[caption={Fix width of the result + (default: \texttt{\textbackslash linewidth})},% + pos=t,captionpos=b] +\setlength{\unitlength}{1cm} +\begin{picture}(2,2) \thicklines + \put(0,0){\line(1,1){2}} + \put(0,2){\line(1,-1){2}} +\end{picture} +\end{LTXexample} + +\medskip + +\begin{LTXexample}[caption={[The \texttt{justification} parameter]% + Result is centered (\texttt{varwidth=true})},% + varwidth,captionpos=b,pos=t,justification=\centering] +\setlength{\unitlength}{1cm} +\begin{picture}(2,2) + \thicklines + \put(0,0){\line(1,1){2}} + \put(0,2){\line(1,-1){2}} +\end{picture} +\end{LTXexample} + +\end{document} diff --git a/Master/texmf-dist/doc/latex/showexpl/showexpl.cfg b/Master/texmf-dist/doc/latex/showexpl/showexpl.cfg new file mode 100644 index 00000000000..4712d03eec7 --- /dev/null +++ b/Master/texmf-dist/doc/latex/showexpl/showexpl.cfg @@ -0,0 +1,50 @@ +% config file for showexpl.sty +% +% Copyright Herbert Voss, 2005 +% Licence: LPPL. + +\ProvidesFile{showexpl.cfg} + [2005/08/28 v0.03 Definitions for the showexpl package (hv)] +% +\RequirePackage{xcolor} +\definecolor{hellgelb}{rgb}{1,1,0.85} +\definecolor{colKeys}{rgb}{0,0,1} +\definecolor{colIdentifier}{rgb}{0,0,0} +\definecolor{colComments}{rgb}{1,0,0} +\definecolor{colString}{rgb}{0,0.5,0} + +\lstset{% + preset=\centering,% + rframe={},% + language=PSTricks,% +% language=TeX,% + float=hbp,% + basicstyle=\footnotesize\ttfamily,% + identifierstyle=\color{colIdentifier},% + keywordstyle=\color{colKeys},% + stringstyle=\color{colString},% + commentstyle=\itshape\color{colComments},% +% columns=flexible,% +% columns=fullflexible,% + columns=fixed, + tabsize=4,% + frame=single,% + extendedchars=true,% + showspaces=false,% + showstringspaces=false,% + numbers=left,% + numberstyle=\tiny\ttfamily,% + numbersep=1em,% + breaklines=true,% + breakindent=10pt,% + backgroundcolor=\color{hellgelb},% + breakautoindent=true,% + captionpos=t,% + xleftmargin=1em,% + xrightmargin=\fboxsep,% + numbersep=1em,% +% xrightmargin=-1cm,% +% relwidth=0.5,% +% columnsep=10pt% +} +\renewcommand*\SX@Info{}% 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 diff --git a/Master/texmf-dist/tex/latex/showexpl/showexpl.sty b/Master/texmf-dist/tex/latex/showexpl/showexpl.sty new file mode 100644 index 00000000000..084f29dca06 --- /dev/null +++ b/Master/texmf-dist/tex/latex/showexpl/showexpl.sty @@ -0,0 +1,357 @@ +%% +%% This is file `showexpl.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% showexpl.dtx (with options: `package') +%% +%% 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. +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{showexpl} + [2005/12/06 v0.3d Typesetting example code (RN)] +\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{}}} +\lst@RequireAspects{writefile} +\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@}} +\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}} +\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 +\lst@Key{rangeaccept}f[t]{\lstKV@SetIf{#1}\if@SX@rangeaccept} +\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} +\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][]{} +\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 +\newcounter{ltxexample} +\newcommand*{\SX@IDENT}{SX@\number\value{ltxexample}} +\newcommand*\SX@attachfile{% + \if@SX@attachfile + \attachfile[mimetype=text/plain,subject={example \theltxexample}]% + {\SX@codefile}{}% + \fi +} +\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 +} +\lstnewenvironment{LTXexample}[1][] +{% + \@temptokena{#1}% + \begingroup + \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 +} +\newcommand*\SX@put@code@result{% + \begingroup + \expandafter\lstset\expandafter{\SX@explpreset}% + \let\lst@float=\relax\let\SX@float=\relax + \expandafter\lstset\expandafter{\SX@@explpreset}% + \ifx\lst@float\relax\else + \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}% + \SX@defaultWD\SX@width{\SX@width}% + \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 + \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}{% + \let\@addtofilelist\@gobble + \let\lst@ifdisplaystyle=\iftrue + \SX@KillAboveCaptionskip\lst@MakeCaption{t}% + \lst@belowskip=\z@ + \let\SX@MakeCaption\lst@MakeCaption + \let\lst@MakeCaption\@gobble + \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 +} +\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 +} +\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} +\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 +} +\newcommand*\SX@codeInput{% + \begingroup + \expandafter\lstset\expandafter{\SX@explpreset}% + \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 +}% +\newcommand*\LTXinputExample[2][]{% + \g@addto@macro\SX@@explpreset{#1,codefile=#2}% + \SX@put@code@result}% +\lstset{explpreset={numbers=left,numberstyle=\tiny,numbersep=.3em, + xleftmargin=1em,columns=flexible,language=[LaTeX]TEX},pos=l,width=-99pt, + overhang=0pt,hsep=\columnsep,vsep=\bigskipamount,rframe=single} +\InputIfFileExists{showexpl.cfg}{}{} +\endinput +%% +%% End of file `showexpl.sty'. diff --git a/Master/texmf-dist/tpm/showexpl.tpm b/Master/texmf-dist/tpm/showexpl.tpm new file mode 100644 index 00000000000..18429c0e66f --- /dev/null +++ b/Master/texmf-dist/tpm/showexpl.tpm @@ -0,0 +1,32 @@ +<!DOCTYPE rdf:RDF SYSTEM "../../support/tpm.dtd"> +<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:TPM="http://texlive.dante.de/"> + <rdf:Description about="http://texlive.dante.de/texlive/Package/showexpl.zip"> + <TPM:Name>showexpl</TPM:Name> + <TPM:Type>Package</TPM:Type> + <TPM:Date>2006/03/26 19:25:00</TPM:Date> + <TPM:Version></TPM:Version> + <TPM:Creator>karl</TPM:Creator> + <TPM:Title>The showexpl package.</TPM:Title> + <TPM:Description></TPM:Description> + <TPM:Author></TPM:Author> + <TPM:Size>323845</TPM:Size> + <TPM:Build/> + <TPM:RunFiles size="13070"> +texmf-dist/tex/latex/showexpl/showexpl.sty +texmf-dist/tpm/showexpl.tpm + </TPM:RunFiles> + <TPM:DocFiles size="288626"> +texmf-dist/doc/latex/showexpl/README +texmf-dist/doc/latex/showexpl/result-picture.pdf +texmf-dist/doc/latex/showexpl/showexpl-test.pdf +texmf-dist/doc/latex/showexpl/showexpl-test.tex +texmf-dist/doc/latex/showexpl/showexpl.cfg + </TPM:DocFiles> + <TPM:SourceFiles size="23328"> +texmf-dist/source/latex/showexpl/showexpl.dtx +texmf-dist/source/latex/showexpl/showexpl.ins + </TPM:SourceFiles> + <TPM:Provides>Package/showexpl</TPM:Provides> + </rdf:Description> +</rdf:RDF> + diff --git a/Master/texmf/lists/showexpl b/Master/texmf/lists/showexpl new file mode 100644 index 00000000000..fd9fb30b73b --- /dev/null +++ b/Master/texmf/lists/showexpl @@ -0,0 +1,11 @@ +texmf-dist/doc/latex/showexpl/README +texmf-dist/doc/latex/showexpl/result-picture.pdf +texmf-dist/doc/latex/showexpl/showexpl-test.pdf +texmf-dist/doc/latex/showexpl/showexpl-test.tex +texmf-dist/doc/latex/showexpl/showexpl.cfg +texmf-dist/source/latex/showexpl/showexpl.dtx +texmf-dist/source/latex/showexpl/showexpl.ins +texmf-dist/tex/latex/showexpl/showexpl.sty +texmf-dist/tpm/showexpl.tpm + +texmf/lists/showexpl diff --git a/Master/texmf/tpm/collection-latexextra.tpm b/Master/texmf/tpm/collection-latexextra.tpm index a246c665162..c92e4e89a42 100644 --- a/Master/texmf/tpm/collection-latexextra.tpm +++ b/Master/texmf/tpm/collection-latexextra.tpm @@ -413,6 +413,7 @@ A large collection of add-on packages for LaTeX. <TPM:Package name="shortlst"/> <TPM:Package name="shorttoc"/> <TPM:Package name="showdim"/> + <TPM:Package name="showexpl"/> <TPM:Package name="showlabels"/> <TPM:Package name="sidecap"/> <TPM:Package name="sides"/> |