summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pst-exa
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-01-06 01:39:32 +0000
committerKarl Berry <karl@freefriends.org>2010-01-06 01:39:32 +0000
commit9c285fb487bdb507e481b5c0592be3348a2c44e7 (patch)
tree70c82a411e21b398a665bb4333a118f7e5194dd9 /Master/texmf-dist/tex/latex/pst-exa
parentabddc71d3ed99edcf746bfa4dc16856f9158751b (diff)
new pstricks/latex package pst-exa (5jan10)
git-svn-id: svn://tug.org/texlive/trunk@16615 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pst-exa')
-rw-r--r--Master/texmf-dist/tex/latex/pst-exa/pst-exa.sty97
1 files changed, 97 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/pst-exa/pst-exa.sty b/Master/texmf-dist/tex/latex/pst-exa/pst-exa.sty
new file mode 100644
index 00000000000..1fec2902c89
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/pst-exa/pst-exa.sty
@@ -0,0 +1,97 @@
+% $Id: pst-exa.sty 239 2010-01-01 17:23:13Z herbert $
+%% BEGIN pst-exa.tex
+%%
+%% Code and image side by side or on top of
+%% each other with PSTricks.
+%%
+%% COPYRIGHT 2010 by Herbert Voss, hvoss tug.org.
+%%
+%% 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}
+\RequirePackage{graphicx}
+\RequirePackage{listings}
+\RequirePackage{pst-xkey}
+\def\fileversion{0.01}
+\def\filedate{2010/01/01}
+%
+\ProvidesPackage{pst-exa}[\filedate\ v\fileversion\ PSTricks example code (hv)]
+
+\lstset{basicstyle=\ttfamily\footnotesize,numbers=left,numbersep=0.5pt,
+ xleftmargin=1em,
+ numberstyle=\tiny,breaklines,
+ language=PSTricks}
+\pst@addfams{pst-exa}
+\define@key[psset]{pst-exa}{pos}[l]{%
+ \ifx#1l\def\psk@exa@pos{0}
+ \else
+ \ifx#1r\def\psk@exa@pos{1}
+ \else
+ \ifx#1b\def\psk@exa@pos{2}
+ \else \def\psk@exa@pos{3}
+ \fi\fi\fi}
+\psset[pst-exa]{pos=l}
+\define@key[psset]{pst-exa}{halign}[c]{\def\psk@exa@halign{#1}}
+\psset[pst-exa]{halign=c}
+\define@key[psset]{pst-exa}{valign}[c]{\def\psk@exa@valign{#1}}
+\psset[pst-exa]{valign=c}
+\define@key[psset]{pst-exa}{frame}[{}]{\def\psk@exa@frame{#1}}
+\psset[pst-exa]{frame=}
+\newlength\pst@exa@width
+\define@key[psset]{pst-exa}{width}[0.5\linewidth]{\pssetlength\pst@exa@width{#1}}
+\psset[pst-exa]{width=0.5\linewidth}
+\newlength\pst@exa@sep
+\define@key[psset]{pst-exa}{sep}[1em]{\pssetlength\pst@exa@sep{#1}}
+\psset[pst-exa]{sep=1em}
+%
+\def\PSTfilename@i#1.#2.#3\@nil{\xdef\PSTfilename{#1.#2.tex}}%
+%
+\providecommand\IncludeGraphics[2][]{}
+\renewcommand\IncludeGraphics[2][]{%
+ \expandafter\PSTfilename@i#2\@nil%
+ \includegraphics[#1]{#2}}
+%
+\newenvironment{PSTexample}[1][]
+ {\par\noindent\psset{#1}%
+ \begin{lrbox}{\pst@hbox}}
+ {\end{lrbox}%
+ \ifcase\psk@exa@pos
+ \minipage{\pst@exa@width}%
+ \ifdim\wd\pst@hbox<\linewidth\usebox\pst@hbox%
+ \else\resizebox{\linewidth}{!}{\usebox\pst@hbox}\fi
+ \endminipage\kern\pst@exa@sep%
+ \pst@dimm=\linewidth%
+ \advance\pst@dimm by -\pst@exa@width%
+ \advance\pst@dimm by -\pst@exa@sep%
+ \minipage{\pst@dimm}%
+ \lstinputlisting[includerangemarker=false,firstnumber=1,
+ linerange=\\begin\{document\}-\\end\{document\}]{\PSTfilename}
+ \endminipage%
+ \or
+ \pst@dimm=\linewidth%
+ \advance\pst@dimm by -\pst@exa@width
+ \advance\pst@dimm by -\pst@exa@sep
+ \minipage{\pst@dimm}%
+ \lstinputlisting[includerangemarker=false,firstnumber=1,
+ linerange=\\begin\{document\}-\\end\{document\}]{\PSTfilename}
+ \endminipage\kern\pst@exa@sep%
+ \minipage{\pst@exa@width}%
+ \ifdim\wd\pst@hbox<\linewidth\usebox\pst@hbox%
+ \else\resizebox{\linewidth}{!}{\usebox\pst@hbox}\fi
+ \endminipage
+ \or
+ \lstinputlisting[includerangemarker=false,firstnumber=1,
+ linerange=\\begin\{document\}-\\end\{document\}]{\PSTfilename}
+ \par\vskip\pst@exa@sep%
+ \usebox\pst@hbox\par
+ \or
+ \usebox\pst@hbox\par
+ \vskip\pst@exa@sep%
+ \lstinputlisting[includerangemarker=false,firstnumber=1,
+ linerange=\\begin\{document\}-\\end\{document\}]{\PSTfilename}\par
+ \fi}
+%
+\endinput \ No newline at end of file