diff options
Diffstat (limited to 'graphics/pstricks/contrib/pst-exa')
-rw-r--r-- | graphics/pstricks/contrib/pst-exa/Changes | 3 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-exa/README | 12 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-exa/doc/pst-exa-doc.bib | 84 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-exa/doc/pst-exa-doc.inc | 165 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-exa/doc/pst-exa-doc.pdf | bin | 0 -> 71512 bytes | |||
-rw-r--r-- | graphics/pstricks/contrib/pst-exa/doc/pst-exa-doc.tex | 343 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-exa/latex/pst-exa.sty | 312 |
7 files changed, 919 insertions, 0 deletions
diff --git a/graphics/pstricks/contrib/pst-exa/Changes b/graphics/pstricks/contrib/pst-exa/Changes new file mode 100644 index 0000000000..122b5144a5 --- /dev/null +++ b/graphics/pstricks/contrib/pst-exa/Changes @@ -0,0 +1,3 @@ +0.06 2017-09-12 code modifications (pablo) +0.05 2014-09-24 added style options (pablo) +0.01 2010-01-01 first CTAN version
\ No newline at end of file diff --git a/graphics/pstricks/contrib/pst-exa/README b/graphics/pstricks/contrib/pst-exa/README new file mode 100644 index 0000000000..111a713cbf --- /dev/null +++ b/graphics/pstricks/contrib/pst-exa/README @@ -0,0 +1,12 @@ +The package \LPack{pst-exa} was created to realize examples with printed code and output +side by side or on top of each other. The package looks in the image directory for the source +code of the examples and inserts only the code between the document environment , +which is the sequence \LBEG{document} \ldots\ \LEND{document}. + +The package provides the environment \Lenv{PSTexample} with the optional +arguments. For more information read the documentation of pst2pdf. + +Using pst-exa makes only sense together with the Perl script pst2pdf, which +allows the use of Postscript code and running the document in pdf mode. + +2010-01-04
\ No newline at end of file diff --git a/graphics/pstricks/contrib/pst-exa/doc/pst-exa-doc.bib b/graphics/pstricks/contrib/pst-exa/doc/pst-exa-doc.bib new file mode 100644 index 0000000000..462241d6df --- /dev/null +++ b/graphics/pstricks/contrib/pst-exa/doc/pst-exa-doc.bib @@ -0,0 +1,84 @@ +@STRING{tugboat = {TUGboat} } +@STRING{beiprogramm = {{\TeX}-Beiprogramm} } +@STRING{bretter = {Bretter, die die Welt bedeuten} } +@STRING{dtk = {{D}ie {\TeX}nische {K}om{\"o}die} } +@STRING{editorial = {Editorial} } +@STRING{fremdebuehne = {Von fremden B{\"u}hnen} } +@STRING{fundus = {Aus dem Fundus} } +@STRING{hinterbuehne = {Hinter der B{\"u}hne} } +@STRING{leserbrief = {Leserbrief(e)} } +@STRING{magazin = {Magazin} } +@STRING{rezension = {Rezensionen} } +@STRING{schonimmer = {Was Sie schon immer {\"u}ber {\TeX} wissen wollten \dots} } +@STRING{theaterkasse = {Von der Theaterkasse} } +@STRING{theatertage = {{\TeX}-Theatertage} } + +@Book{tlgc2, + author = {Michel Goosens and Frank Mittelbach and Sebastian Rahtz and Denis Roegel and Herbert Vo{\ss}}, + title = {The {\LaTeX} {G}raphics {C}ompanion}, + publisher = {{Addison-Wesley Publishing Company}}, + edition = second, + year = {2007}, + address = {Reading, Mass.} +} + + +@Article{girou:01:, + author = {Denis Girou}, + title = {Pr\'esentation de {PST}ricks}, + journal = {Cahier {GUT}enberg}, + year = 1994, + volume = {16}, + month = apr, + pages = {21-70} +} + +@Article{girou:02:, + author = {{Timothy van} Zandt and Denis Girou}, + title = {Inside {PST}ricks}, + journal = TUGboat, + year = 1994, + volume = {15}, + month = sep, + pages = {239-246} +} + +@Manual{pstricks, + Title = {PSTricks - {\PS} macros for generic {\TeX}}, + Author = {{Timothy van} Zandt}, + Address = {\url{http://www.tug.org/application/PSTricks}}, + year = 1993 +} + +@Book{PSTricks2, + author = {Herbert Vo\ss}, + title = {\texttt{PSTricks} -- {G}rafik f\"ur \TeX{} und \LaTeX}, + edition = {7}, + publisher = {DANTE -- Lehmanns}, + year = {2010}, + address = {Heidelberg/Berlin} +} + +@Book{PSTricks2-UIT, + author = {Herbert Vo\ss}, + title = {PSTricks -- Graphics for \TeX\ and \LaTeX}, + publisher = {UIT}, + year = {2011}, + address = {Cambridge} +} + +@Book{LaTeXRef-UIT, + author = {Herbert Vo\ss}, + title = {{\LaTeX} quick reference}, + publisher = {UIT}, + year = {2012}, + address = {Cambridge} +} + +@Manual{pst-tools, + author = {Herbert Voß}, + title = {\texttt{pst-tools} -- Helper functions}, + publisher = {CTAN}, + year = {2012}, + address = {\url{CTAN:/graphics/pstricks/contrib/pst-tools}} +} diff --git a/graphics/pstricks/contrib/pst-exa/doc/pst-exa-doc.inc b/graphics/pstricks/contrib/pst-exa/doc/pst-exa-doc.inc new file mode 100644 index 0000000000..2e09c78722 --- /dev/null +++ b/graphics/pstricks/contrib/pst-exa/doc/pst-exa-doc.inc @@ -0,0 +1,165 @@ +\DeclareRobustCommand\PST{\texttt{PSTricks\xspace}} +\DeclareRobustCommand\PS{\texttt{PostScript\xspace}} +\def\dt{\ensuremath{\,\mathrm{d}t}} +\def\Index#1{\index{#1}#1} +% +\def\LPack#1{\texttt{#1}\index{#1@\texttt{#1}}\index{Package!#1@\texttt{#1}}} +\def\nxLPack#1{\texttt{#1}} +\def\Lprog#1{\texttt{#1}\index{#1@\texttt{#1}}\index{Program!#1@\texttt{#1}}} +\let\nxLprog\nxLPack +\def\LFile#1{\texttt{#1}\index{#1@\texttt{#1}}\index{File!#1@\texttt{#1}}} +\def\nxLFile#1{\texttt{#1}} +\def\Lext#1{\texttt{.#1}\index{#1@\texttt{.#1}}\index{Extension!#1@\texttt{.#1}}} +\def\nxLext#1{\texttt{.#1}} +\def\xLcs#1{\index{#1@\nxLcs{#1}}\index{Macro!#1@\nxLcs{#1}}} +\def\Lcs#1{\nxLcs{#1}\xLcs{#1}} +\def\LcsStar#1{\index{#1*@\nxLcs{#1*}}\index{Macro!#1@\nxLcs{#1*}}\nxLcs{#1}\OptArg*{*}} +\def\nxLcs#1{\texttt{\textbackslash#1}} +\def\xLenv#1{\index{#1@\texttt{#1}}\index{Environment!#1@\texttt{#1}}} +\def\Lenv#1{\texttt{#1}\xLenv{#1}} +\def\Ldim#1{\texttt{\textbackslash#1}\index{#1@\texttt{\textbackslash#1}}\index{Dimension!#1@\texttt{\textbackslash#1}}} +\def\Lskip#1{\texttt{\textbackslash#1}\index{#1@\texttt{\textbackslash#1}}\index{Skip!#1@\texttt{\textbackslash#1}}} +\def\Lkeyword#1{\texttt{#1}\xLkeyword{#1}} +\def\xLkeyword#1{\index{#1@\texttt{#1}}\index{Keyword!#1@\texttt{#1}}} +\def\nxLkeyword#1{\texttt{#1}} + +\def\LKeyword#1{\LKeyword@i#1!!} +\def\LKeyword@i#1=#2!!{\Lkeyword{#1}\nxLkeyword{=#2}} +\let\nxLKeyword\nxLenv % same formatting + +\let\nxLkeyval\nxLkeyword +\let\nxLenv\nxLkeyword +\let\nxLps\nxLkeyword +\def\LColor#1{\texttt{#1}\xLColor{#1}} +\def\xLColor#1{\index{#1@\texttt{#1}}\index{Color!#1@\texttt{#1}}} +\def\Lkeyval#1{\texttt{#1}\xLkeyval{#1}} +\def\xLkeyval#1{\index{#1@\texttt{#1}}\index{Keyvalue!#1@\texttt{#1}}} +\def\xLoption#1{\index{#1@\texttt{#1}}\index{Package option!#1@\texttt{#1}}} +\def\Loption#1{\texttt{#1}\xLoption{#1}} +\def\LPS#1{\texttt{#1}\index{#1@\texttt{#1}}\index{PostScript!#1@\texttt{#1}}} +\def\xLps#1{\index{#1@\texttt{#1}}\index{PostScript!#1@\texttt{#1}}} +\def\nxLps#1{\texttt{#1}} +\def\Lps#1{\nxLps{#1}\xLps{#1}} +\def\LClass#1{\texttt{#1}\index{#1@\texttt{#1}}\index{Class!#1@\texttt{#1}}} +\let\nxLClass\nxLPack +\let\nxLdim\nxLcs +\let\nxLskip\nxLcs +\def\Lctr#1{\texttt{#1}\index{#1@\texttt{#1}}\index{Counter!#1@\texttt{#1}}} +\def\LCtr#1{\texttt{#1}\index{#1@\texttt{#1}}\index{TeX Counter@\TeX\ Counter!#1@\texttt{#1}}} +\def\nxLctr#1{\texttt{#1}} +% +\newcommand\Lnotation [1]{\nxLnotation{#1}\xLnotation{#1}} +\newcommand\Lmnotation[1]{\nxLnotation{#1}\xLmnotation{#1}} +\newcommand\xLnotation[1]{\index{Syntax!#1@\nxLnotation{#1}}\index{#1@\nxLnotation{#1}}} +\def\nxLnotation#1{\texttt{#1}} +\def\xLkeyset#1{\expandafter\xLkeyset@i#1\@nil} +\def\xLkeyset@i#1=#2\@nil{\index{#1@\texttt{#1}}\index{Keyword!#1@\texttt{#1}} + \index{#2@\texttt{#2}}\index{Value!#2@\texttt{#2}}} +\def\Lkeyset#1{\expandafter\Lkeyset@i#1\@nil} +\def\Lkeyset@i#1=#2\@nil{\texttt{#1=#2}% + \index{#1@\texttt{#1}}\index{Keyword!#1@\texttt{#1}} + \index{#2@\texttt{#2}}\index{Value!#2@\texttt{#2}}} +% +\def\xLKeyset#1{\expandafter\xLKeyset@i#1\@nil}% without using the right value of = +\def\xLKeyset@i#1=#2\@nil{\index{#1@\texttt{#1}}\index{Keyword!#1@\texttt{#1}}} +\def\LKeyset#1{\expandafter\LKeyset@i#1\@nil} +\def\LKeyset@i#1=#2\@nil{\texttt{#1=#2}% + \index{#1@\texttt{#1}}\index{Keyword!#1@\texttt{#1}}} +\let\LKeyword\LKeyset +% +\newcommand\Larg [1]{{\normalfont\itshape#1\/}} +\newcommand\Larga[1]{$\langle$\Larg{#1}$\rangle$}% angles +\newcommand\Largb[1]{\lcb\Larg{#1}\rcb} % curly brace +\newcommand\Largs[1]{\lsb\Larg{#1}\rsb} % square brackets +\newcommand\Largr[1]{\lrb\Larg{#1}\rrb} % round brackets +\newcommand\LBEG[1]{{\normalfont\ttfamily\bs{}begin\lcb#1\rcb}\xLenv{#1}} +\newcommand\LmBEG[1]{{\normalfont\ttfamily\bs{}begin\lcb#1\rcb}\xLmenv{#1}} +\newcommand\LEND[1]{{\normalfont\ttfamily\bs{}end\lcb#1\rcb}\xLenv{#1}} +\newcommand\LmEND[1]{{\normalfont\ttfamily\bs{}end\lcb#1\rcb}\xLmenv{#1}} +% +\DeclareRobustCommand\bs{{\normalfont\ttfamily\textbackslash}} % \let\bslash=\bs +\DeclareRobustCommand\lcb{{\normalfont\ttfamily\textbraceleft}} +\DeclareRobustCommand\rcb{{\normalfont\ttfamily\textbraceright}} +\DeclareRobustCommand\lsb{{\normalfont\ttfamily[}} +\DeclareRobustCommand\rsb{{\normalfont\ttfamily]}} +\DeclareRobustCommand\lrb{{\normalfont\ttfamily(}} +\DeclareRobustCommand\rrb{{\normalfont\ttfamily)}} +\DeclareRobustCommand\false{{\ttfamily false}} +\DeclareRobustCommand\true{{\ttfamily true}} + +% +% without brackets +\def\Coordx#1{$x_{#1}$} +\def\Coordy#1{$y_{#1}$} +\def\Coordz#1{$z_{#1}$} +\def\Coord#1{\Coordx{#1},\kern 1pt\Coordy{#1}} +\def\Coordn{\Coordx{n},\kern 1pt\Coordy{n}} +\def\CoordIII#1{\Coordx{#1},\kern 1pt\Coordy{#1},\kern 1pt\Coordz{#1}}% HjG +\def\CAny{\Coordx{},\kern 1pt\Coordy{}} +\def\CIIIAny{\Coordx{},\kern 1pt\Coordy{},\kern 1pt\Coordz{}}% hv +% with brackets +\def\coord#1{(\Coordx{#1},\kern 1pt\Coordy{#1})} +\def\coordn{(\Coordx{n},\kern 1pt\Coordy{n})} +\def\coordiii#1{(\Coordx{#1},\kern 1pt\Coordy{#1},\kern 1pt\Coordz{#1})}% hv +\def\coordx#1{($x_{#1}$)} +\def\coordy#1{($y_{#1}$)} +\def\coordz#1{($z_{#1}$)} +\def\cAny{(\Coordx{},\kern 1pt\Coordy{})} +\def\ciiiAny{(\Coordx{},\kern 1pt\Coordy{},\kern 1pt\Coordz{})}% hv +% +\newskip\BDefaboveskip +\newskip\BDefbelowskip +\newskip\BDefinlineskip +\setlength\BDefaboveskip{0pt plus 2pt}% first-level list topsep +\setlength\BDefbelowskip{10pt} +\setlength\BDefinlineskip{6pt} +% +\makeatletter +\newsavebox{\boxdef} +\newenvironment{BDef} + {\begin{lrbox}\boxdef + \def\arraystretch{1.0} + \begin{tabular}{@{}l@{}l@{}l@{}}} + {\end{tabular}\end{lrbox} +% +% braces around next block are needed to stop the list env checking for blank lines +% and the \aftergroups then for making sure no indentation happens ... as i said +% urg +% + {\BCmd\fbox{\usebox\boxdef}\endBCmd} + \aftergroup\@afterindentfalse\aftergroup\@afterheading + } +\newenvironment{BDef*} + {\begin{lrbox}\boxdef + \def\arraystretch{1.0} + \begin{tabular}{@{}l@{}l@{}l@{}} + } + {\end{tabular}\end{lrbox} + {\begin{BCmd*}\fbox{\usebox\boxdef}\end{BCmd*}} + \aftergroup\@afterindentfalse\aftergroup\@afterheading + } +\newenvironment{BCmd}{ + \@beginparpenalty-\@lowpenalty + \topsep\BDefaboveskip + \fboxsep3pt + \flushleft} + {\@endparpenalty\@M + \@topsepadd\BDefbelowskip + \endflushleft} + +\newenvironment{BCmd*}{ + \@beginparpenalty\@M + \topsep\BDefinlineskip + \fboxsep3pt + \flushleft} + {\@endparpenalty5000 + \endflushleft} + + +\def\OptArgs{\colorbox{black!20}{\texttt{[Options]}}\kern1pt} +\def\OptArg{\@ifnextchar*\OptArg@i{\OptArg@ii*}}% star version without braces +\def\OptArg@i*#1{\colorbox{black!20}{\texttt{#1}}\kern1pt} +\def\OptArg@ii*#1{\colorbox{black!20}{\texttt{[#1]}}\kern1pt} +\def\DBS{{\ttfamily\textbackslash\textbackslash}} + +\makeatother
\ No newline at end of file diff --git a/graphics/pstricks/contrib/pst-exa/doc/pst-exa-doc.pdf b/graphics/pstricks/contrib/pst-exa/doc/pst-exa-doc.pdf Binary files differnew file mode 100644 index 0000000000..3344972804 --- /dev/null +++ b/graphics/pstricks/contrib/pst-exa/doc/pst-exa-doc.pdf diff --git a/graphics/pstricks/contrib/pst-exa/doc/pst-exa-doc.tex b/graphics/pstricks/contrib/pst-exa/doc/pst-exa-doc.tex new file mode 100644 index 0000000000..f7f3bc89ce --- /dev/null +++ b/graphics/pstricks/contrib/pst-exa/doc/pst-exa-doc.tex @@ -0,0 +1,343 @@ +% arara: latex: {draft: yes} +% arara: latex +% arara: biber +% arara: makeindex +% arara: latex: {draft: yes} +% arara: latex +% arara: dvips +% arara: ps2pdf +% arara: clean: { files:[pst-exa-doc.out, pst-exa-doc.ps, pst-exa-doc.toc,pst-exa-doc.log,pst-exa-doc.ind,pst-exa-doc.aux, pst-exa-doc.bbl, pst-exa-doc.bcf, pst-exa-doc.blg,pst-exa-doc.dvi,pst-exa-doc.idx,pst-exa-doc.ilg,pst-exa-doc.run.xml] } +\documentclass[11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false,headings=small, + headinclude=false,footinclude=false,twoside]{scrartcl} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{libertine} +\usepackage[scaled=0.88]{beramono} +\usepackage{babel} +\usepackage{makeidx}\makeindex +\input{\jobname.inc} +\listfiles +\let\Lfile\LFile +\usepackage{pst-node} +\usepackage{biblatex} + +\addbibresource{\jobname.bib} + +\usepackage{xspace,showexpl} +\usepackage{pst-text,pst-grad} +\usepackage[tcb]{pst-exa} +\let\pstFV\fileversion + +%\DeclareFixedFont{\RM}{T1}{ptm}{b}{n}{4cm} +%\renewcommand\bgImage{\pscharpath[fillstyle=gradient, +% gradbegin=red,gradend=blue,gradangle=-90]{\RM pst-exa}} + +\lstset{language=PSTricks,basicstyle=\footnotesize\ttfamily} +\def\DVI{\textsc{DVI}} +\def\PDF{\textsc{PDF}} +\def\gs{\textsc{Ghostscript}} +% +\begin{document} +\title{\texttt{pst-exa}\\ +Generate examples for PSTricks environments (with pdflatex);\\ \small v. 0.06} +\author{Herbert Vo\ss \\ Pablo Gonz\'{a}lez Luengo} +%\docauthor{} +\date{\today} +\maketitle + +\tableofcontents + +\clearpage + +\section{Introduction} + +The package \LPack{pst-exa} was created to realize examples with printed +code and output side by side or on top of each other. The package +looks in the image directory for the source code of the examples +and inserts only the image for code environment + +However, creating a \PDF\ file in a direct way with \Lprog{pst2pdf} or \Lprog{ltximg} is +possible and the compiles whits \Lprog{pdflatex}. + +\PST\ as \PS\ related package uses the programming language \PS\ for internal +calculations. This is an important advantage, because floating point arithmetic is no +problem. Nearly all mathematical calculation can be done when running the \DVI-file +with \gs. + +\section{Loading the package} + +The package \LPack{pst-exa} must be loaded with one of the following options in the preamble of the document: + +\begin{verbatim} +\usepackage[swpl]{pst-exa} +\end{verbatim} + +automatically load \LPack{showexpl} package. + +\begin{verbatim} +\usepackage[tcb]{pst-exa} +\end{verbatim} + +automatically load \LPack{tcolorbox} package. + +\section{Environments} +The package \LPack{pst-exa} provides two environments: + +\Lenv{PSTcode} to write only code that does not generate +an image, this is necessary to not interrupt the order in which the images are copied by the script in the process +of conversion to pdf. + +\Lenv{PSTexample} environment, +to write only code that generates an image, keep in mind that the script that performs the extraction process +does not distinguish the format given to the lines in this environment (only reads plain text) the idea is to +concentrate on the image you want to extrare and then in the format of the text. + +\section{Programs needed} +You need \nxLprog{pst2pdf} (or \Lprog{ltximg}) whit a latest version of \Lprog{Ghostscript} (9.14), +\Lprog{perl} (>=5.18), \Lprog{pdf2svg}, \Lprog{pdftoppm} and \Lprog{pdftops} +(from \Lprog{poppler-utils} or \Lprog{xpdf-utils}) for the process file. + +The general syntax for the \emph{script} is simple: + +\begin{BDef} +\nxLprog{perl} \nxLprog{pst2pdf} \Larg{file.tex} \Largs{--options} +\end{BDef} + +For \TeX Live users: + +\begin{BDef} +\nxLprog{pst2pdf} \Larg{file.tex} \Largs{--options} +\end{BDef} + +this create file-pdf-exa.pdf and file-fig-exa-1.pdf, file-fig-exa-2.pdf, file-fig-exa-\dots.pdf + +\section{Examples with option \texttt{tcb}} + +\verb|\begin{pspicture}| o \tcboxverb{\begin{pspicture}[showgrid](4,4)} + +\begin{pspicture}[showgrid](4,4) + \psRing(2,2){0.3}{0.8} + \psRing*[opacity=0.5](2,2){1}{2} +\psdot(2,2) +\end{pspicture} + +%\mint[hola]{algo}$\begin{pspicture} o \begin{pspicture*}$ no problem whit inline verb :) +\section{Test PSTexample} +% numbers=none +\begin{PSTexample}[pos=t,numbers=fancy,title=First example] +\pstVerb{ 1234321 srand } +\begin{pspicture}[showgrid](-2,-2)(2,2) +\psframe*[linecolor=blue,opacity=!Rand](2,2) +\psframe*[linecolor=red,opacity=!Rand](-1,-1)(1,1) +\psframe*[linecolor=green,opacity=!Rand](-2,-2)(0,0) +\end{pspicture} +\end{PSTexample} +\vspace{20pt} +\begin{PSTexample}[hwidth=5cm] +\begin{pspicture}[showgrid](4,4) + \psRing(2,2){0.3}{0.8} + \psRing*[opacity=0.5](2,2){1}{2} +\psdot(2,2) +\end{pspicture} +\end{PSTexample} +% ned +\section{Test PSTcode} +\begin{PSTcode} +\pstVerb{ 1234321 srand } +\begin{pspicture}[showgrid](-2,-2)(2,2) +\psframe*[linecolor=blue,opacity=!Rand](2,2) +\psframe*[linecolor=red,opacity=!Rand](-1,-1)(1,1) +\psframe*[linecolor=green,opacity=!Rand](-2,-2)(0,0) +\end{pspicture} +\end{PSTcode} + +\begin{PSTcode} +\begin{pspicture}[showgrid](4,4) + \psRing(2,2){0.3}{0.8} + \psRing*[opacity=0.5](2,2){1}{2} +\psdot(2,2) +\end{pspicture} +\end{PSTcode} + + +\section{Examples with option \texttt{swpl}} + +\makeatletter +\pstexa@swpltrue +% Star code for swpl option +% Environment for code +\let\PSTcode\relax +\let\endPSTcode\relax +\lstnewenvironment{PSTcode} + {% +\lstset{ + language=PSTexa,% + frame=single,% + numbers=left,% + numbersep=1em,% + numberstyle=\tiny\color{black!75}\noaccsupp,% + rulecolor=\color{black!67},% + framesep=\fboxsep,% + framerule=\fboxrule,% + xleftmargin=\dimexpr\fboxsep+\fboxrule\relax,% + xrightmargin=\dimexpr\fboxsep+\fboxrule\relax,% + backgroundcolor=\color[rgb]{1,1,0.8},% +% literateee +literate=*{\{}{{\textcolor{blue}{\{}}}{1} + {\}}{{\textcolor{blue}{\}}}}{1} + {[}{{\textcolor{blue}{[}}}{1} + {]}{{\textcolor{blue}{]}}}{1} + {(}{{\textcolor{blue}{(}}}{1} + {)}{{\textcolor{blue}{)}}}{1} + {\$}{{\textcolor{red}{\$}}}{1} + {\#}{{\textcolor{red}{\#}}}{1}%, + }% close lstset + }% +{}% close PSTcode + +% Change position for images +\renewcommand*\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 + \begin{center} + \expandafter\includegraphics\expandafter[\SX@graphicparam]{\SX@graphicname} + \end{center} + \fi +}% end change postition +% PSTexample definition in swpl +\let\PSTexample\relax +\let\endPSTexample\relax + \lstnewenvironment{PSTexample}[1][] + {% + \lstset{% + language=PSTexa,% + frame=single,% + numbers=left,% + numbersep=1em,% + numberstyle=\tiny\color{black!75}\noaccsupp,% + rulecolor=\color{black!67},% + framesep=\fboxsep,% + framerule=\fboxrule,% + xleftmargin=\dimexpr\fboxsep+\fboxrule\relax,% + xrightmargin=\dimexpr\fboxsep+\fboxrule\relax,% + backgroundcolor=\color[rgb]{1,1,0.8},% +% literate for swpl, need inside the explpreset + explpreset={ +% literate +literate=*{\{}{{\textcolor{blue}{\{}}}{1} + {\}}{{\textcolor{blue}{\}}}}{1} + {[}{{\textcolor{blue}{[}}}{1} + {]}{{\textcolor{blue}{]}}}{1} + {(}{{\textcolor{blue}{(}}}{1} + {)}{{\textcolor{blue}{)}}}{1} + {\$}{{\textcolor{red}{\$}}}{1} + {\#}{{\textcolor{red}{\#}}}{1},% + codefile=\jobname.swpl,% + hsep=\columnsep,% + vsep=15pt,% + pos=l,% + wide=false,% + rframe={},% + preset=\centering,% + } % close explpreset + } % close lstset + \@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}% +% Change position for images + } + {% + \lst@EndWriteFile\egroup + \SX@put@code@result + }% close environment +% end swpl code +\makeatother + +% numbers=none +\begin{PSTexample}[pos=t,numbers=none] +\pstVerb{ 1234321 srand } +\begin{pspicture}[showgrid](-2,-2)(2,2) +\psframe*[linecolor=blue,opacity=!Rand](2,2) +\psframe*[linecolor=red,opacity=!Rand](-1,-1)(1,1) +\psframe*[linecolor=green,opacity=!Rand](-2,-2)(0,0) +\end{pspicture} +\end{PSTexample} +% numbers true default +\begin{PSTexample}[width=5cm] +\begin{pspicture}[showgrid](4,4) + \psRing(2,2){0.3}{0.8} + \psRing*[opacity=0.5](2,2){1}{2} +\psdot(2,2) +\end{pspicture} +\end{PSTexample} +% ned + +\begin{PSTcode} +\pstVerb{ 1234321 srand } +\begin{pspicture}[showgrid](-2,-2)(2,2) +\psframe*[linecolor=blue,opacity=!Rand](2,2) +\psframe*[linecolor=red,opacity=!Rand](-1,-1)(1,1) +\psframe*[linecolor=green,opacity=!Rand](-2,-2)(0,0) +\end{pspicture} +\end{PSTcode} + +\begin{PSTcode} +\begin{pspicture}[showgrid](4,4) + \psRing(2,2){0.3}{0.8} + \psRing*[opacity=0.5](2,2){1}{2} +\psdot(2,2) +\end{pspicture} +\end{PSTcode} + +\begin{pspicture}[showgrid](4,4) + \psRing(2,2){0.3}{0.8} + \psRing*[opacity=0.5](2,2){1}{2} +\psdot(2,2) +\end{pspicture} + + + + +\definecolor{mygreen}{rgb}{0,0.6,0} +\definecolor{mygray}{rgb}{0.5,0.5,0.5} + +\lstset{ % + basicstyle=\ttfamily\small, + commentstyle=\color{mygreen}, + extendedchars=true, + frame={}, + keepspaces=true, + keywordstyle=\color{blue}, + numbers=left, + numbersep=5pt, + numberstyle=\tiny\color{mygray} +} +%\lstinputlisting[language=TeX]{pst-exa.sty} +%\newpage +% +\clearpage +\nocite{*} +\printbibliography + +\printindex +\end{document} diff --git a/graphics/pstricks/contrib/pst-exa/latex/pst-exa.sty b/graphics/pstricks/contrib/pst-exa/latex/pst-exa.sty new file mode 100644 index 0000000000..d34e296c94 --- /dev/null +++ b/graphics/pstricks/contrib/pst-exa/latex/pst-exa.sty @@ -0,0 +1,312 @@ +% $Id: pst-exa.sty 113 2014-09-24 11:14:36Z herbert $ +%% BEGIN pst-exa.tex +%% +%% Code and image side by side or on top of +%% each other with PSTricks. +%% +%% COPYRIGHT 2015- by Herbert Voss, <hvoss@tug.org> +%% Pablo Gonz\'{a}lez Luengo <pablogonz@yahoo.com> +%% +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt. +%% +% +\NeedsTeXFormat{LaTeX2e} +\def\filedate{2017/09/11} +\def\fileversion{v0.06} +\ProvidesPackage{pst-exa}[\filedate\space\fileversion\space] +\RequirePackage{etoolbox} +\RequirePackage{xcolor} +\RequirePackage{showexpl}% +\RequirePackage{accsupp} +\RequirePackage{changepage}% +\RequirePackage{tcolorbox}% +\tcbuselibrary{listings,breakable,skins,xparse}% +\newcommand*{\noaccsupp}[1]{\BeginAccSupp{ActualText={}}#1\EndAccSupp{}} +\renewcommand*\SX@Info{}% +% Colors +\definecolor{hellgelb}{rgb}{1,1,0.8} +\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} +% patch listings (etoolbox) +\patchcmd{\lsthk@SelectCharTable}{`)}{``}{}{} +% Define PSTexa languaje and common options +\lstdefinelanguage{PSTexa}{ + language=PSTricks,% + texcsstyle=*\color{blue},% + basicstyle=\ttfamily\small,% + columns=flexible,% + identifierstyle=\color{colIdentifier},% + keywordstyle=\color{colKeys},% + stringstyle=\color{colString},% + showspaces=false,% + showstringspaces=false,% + numberstyle=\tiny,% + breaklines=true,% + tabsize=4,% + breakautoindent=true,% + extendedchars=true, % + keepspaces=true,% + commentstyle=\color{colComments},% + morekeywords={psellipseAB,pnodes,postcript,psRing},% + morecomment=[l]\%,% + morestring=[b]"%, + }[keywords,tex,comments]% +% end PSTexa languaje +% Bolean +\newif\ifpstexa@swpl % swpl: true, tcb: false +\newif\ifmypack@pdf % option pdf +% Options +\DeclareOption{swpl}{\pstexa@swpltrue} +\DeclareOption{tcb}{\pstexa@swplfalse} +\DeclareOption{pdf}{\mypack@pdftrue} +% Proces options +\ProcessOptions* +% Star code for swpl option +\ifpstexa@swpl +% Environment for code +\lstnewenvironment{PSTcode} + {% +\lstset{ + language=PSTexa,% + frame=single,% + numbers=left,% + numbersep=1em,% + numberstyle=\tiny\color{black!75}\noaccsupp,% + rulecolor=\color{black!67},% + framesep=\fboxsep,% + framerule=\fboxrule,% + xleftmargin=\dimexpr\fboxsep+\fboxrule\relax,% + xrightmargin=\dimexpr\fboxsep+\fboxrule\relax,% + backgroundcolor=\color[rgb]{1,1,0.8},% +% literateee +literate=*{\{}{{\textcolor{blue}{\{}}}{1} + {\}}{{\textcolor{blue}{\}}}}{1} + {[}{{\textcolor{blue}{[}}}{1} + {]}{{\textcolor{blue}{]}}}{1} + {(}{{\textcolor{blue}{(}}}{1} + {)}{{\textcolor{blue}{)}}}{1} + {\$}{{\textcolor{red}{\$}}}{1} + {\#}{{\textcolor{red}{\#}}}{1}%, + }% close lstset + }% +{}% close PSTcode + +% Change position for images +\renewcommand*\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 + \begin{center} + \expandafter\includegraphics\expandafter[\SX@graphicparam]{\SX@graphicname} + \end{center} + \fi +}% end change postition +% PSTexample definition in swpl + \lstnewenvironment{PSTexample}[1][] + {% + \lstset{% + language=PSTexa,% + frame=single,% + numbers=left,% + numbersep=1em,% + numberstyle=\tiny\color{black!75}\noaccsupp,% + rulecolor=\color{black!67},% + framesep=\fboxsep,% + framerule=\fboxrule,% + xleftmargin=\dimexpr\fboxsep+\fboxrule\relax,% + xrightmargin=\dimexpr\fboxsep+\fboxrule\relax,% + backgroundcolor=\color[rgb]{1,1,0.8},% +% literate for swpl, need inside the explpreset + explpreset={ +% literate +literate=*{\{}{{\textcolor{blue}{\{}}}{1} + {\}}{{\textcolor{blue}{\}}}}{1} + {[}{{\textcolor{blue}{[}}}{1} + {]}{{\textcolor{blue}{]}}}{1} + {(}{{\textcolor{blue}{(}}}{1} + {)}{{\textcolor{blue}{)}}}{1} + {\$}{{\textcolor{red}{\$}}}{1} + {\#}{{\textcolor{red}{\#}}}{1},% + codefile=\jobname.swpl,% + hsep=\columnsep,% + vsep=15pt,% + pos=l,% + wide=false,% + rframe={},% + preset=\centering,% + } % close explpreset + } % close lstset + \@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}% +% Change position for images + } + {% + \lst@EndWriteFile\egroup + \SX@put@code@result + }% close environment +% end swpl code +\else +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%% Star code for tcb option %%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Define style for tcolorbox +\lstdefinestyle{pstexample}{% + language=PSTexa,% + framesep=\fboxsep,% + framerule=\fboxrule,% + xleftmargin=\dimexpr\fboxsep+\fboxrule\relax,% + xrightmargin=\dimexpr\fboxsep+\fboxrule\relax,% +% literateee +literate=*{\{}{{\textcolor{blue}{\{}}}{1} + {\}}{{\textcolor{blue}{\}}}}{1} + {[}{{\textcolor{blue}{[}}}{1} + {]}{{\textcolor{blue}{]}}}{1} + {(}{{\textcolor{blue}{(}}}{1} + {)}{{\textcolor{blue}{)}}}{1} + {\$}{{\textcolor{red}{\$}}}{1} + {\#}{{\textcolor{red}{\#}}}{1}%, + } +% Set options for tcb using pgfkeys +\tcbset{ + hwidth/.store in=\hwidth,% width left/right + hwidth=0.5\linewidth,% set default + graphic/.style 2 args={comment={\includegraphics[#1]{#2}}},% image coment + pos/.is choice,% Define pos=t,b,l,r + numbers/.is choice,% Define number=true,false,etc + after=\par,% + fcolor/.style={colframe=#1},% Frame color + tcolor/.style={colbacktitle=#1},,% Colback title color + bcolor/.style={colback=#1},% Background color + scolor/.style={drop fuzzy shadow=#1},% Shadow color + hsep/.style={sidebyside gap=#1},% Horizontal sep + vsep/.style={middle=#1}%,% Vertical sep + } +% Config pos=t,b,l,r for pdftex +%\ifpdf +\ifmypack@pdf +\tcbset{ + pos/r/.style={listing outside comment,righthand width=\hwidth},% + pos/l/.style={comment outside listing,lefthand width=\hwidth},% + pos/b/.style={listing above comment},% + pos/t/.style={comment above listing},% + pos/e/.code={\ifoddpage\tcbset{pos=l}\else\tcbset{pos=r}\fi}%, + } +% Config pos=t,b,l,r xetex/latex +\else +\tcbset{ + pos/r/.style={listing outside text,righthand width=\hwidth},% + pos/l/.style={text outside listing,lefthand width=\hwidth},% + pos/b/.style={listing above text},% + pos/t/.style={text above listing},% + pos/e/.code={\ifoddpage\tcbset{pos=l}\else\tcbset{pos=r}\fi}, + } +\fi % close pdf option for tcb +% Star common code for tcb +\tcbset{ +numbers/true/.style={% + listing options={% + style=pstexample,% + numbers=left,% + numbersep=0.5em,% + framesep=\fboxsep,% + framerule=\fboxrule,% + xleftmargin=-\dimexpr\fboxsep-\fboxrule\relax,% + xrightmargin=\dimexpr\fboxsep+\fboxrule\relax,% + numberstyle=\tiny\color{black!75}\noaccsupp,% + }% close listings options + },% close numbers true +numbers/none/.style={% + listing options={% + style=pstexample,% + xleftmargin=-1.5em,% + xrightmargin=-\dimexpr\fboxsep-\fboxrule\relax,% + numbers=none + }% close listings options + },% close numbers none +numbers/out/.style={% + listing options={% + style=pstexample,% + xleftmargin=-1.5em,% + numbers=left,% + numbersep=1em,% + numberstyle=\tiny\color{black!75}\noaccsupp,% + }% close listings options + },% close numbers out +numbers/fancy/.style={ + overlay={\begin{tcbclipinterior}\fill[red!20!blue!20!white] (frame.south west)% + rectangle ([xshift=12pt]frame.north west);\end{tcbclipinterior}},% + listing options={% + style=pstexample,% + numbers=left,% + numbersep=0.85em,% + xleftmargin=0em,% + numberstyle=\tiny\color{black!75}\noaccsupp,% + }% close listings options + }%,% +} % close tcb settings +% Default PSTexample environment style +\tcbset{ +psexample/.style={% + enhanced,% + autoparskip, + center lower,% + drop fuzzy shadow=gray,% + hsep=\columnsep,% + vsep=15pt,% + title style={draw=none,fill=none},% + pos=l,% + numbers=true,% + tcolor=black!67,% + bcolor=hellgelb,% + fcolor=black!67,% + top=-2.5mm,bottom=-2.5mm,boxsep=3pt,% + fonttitle=\bfseries\small,boxrule=0.8pt + }% close psexample settings +} % close tcbset +% Default PSTexample environment style +\tcbset{ +pscode/.style={% + enhanced,% + autoparskip, + arc=0mm,% + drop fuzzy shadow=gray,% + title style={draw=none,fill=none},% + listing only, + numbers=out,% + bcolor=hellgelb,% + fcolor=black!67,% + top=-2.5mm,bottom=-2.5mm,boxsep=3pt,% + fonttitle=\bfseries\small,boxrule=0.8pt + }% close psexample settings +} +% Define PSTexample environment +\NewTCBListing{PSTexample}{O{}}{psexample,#1} +\NewTCBListing{PSTcode}{O{}}{pscode,#1} +%% end PSTexample environment +\fi +\endinput + |