diff options
author | Karl Berry <karl@freefriends.org> | 2017-10-02 21:58:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-10-02 21:58:12 +0000 |
commit | f3d0235a07baa8c6f8430bddcaa95ba3ad6de5ee (patch) | |
tree | b3b2a6d4460d6a5f5c75e4a314db604a8cc705df /Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.tex | |
parent | 08f4fdc740a25d49aa543ac6694453cd84aacfd4 (diff) |
pst-tools (1oct17)
git-svn-id: svn://tug.org/texlive/trunk@45451 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.tex | 61 |
1 files changed, 55 insertions, 6 deletions
diff --git a/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.tex b/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.tex index 7202cec324d..17db1dd5597 100644 --- a/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.tex +++ b/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.tex @@ -1,21 +1,23 @@ -%% $Id: pst-tools-doc.tex 527 2017-08-23 14:14:45Z herbert $ +%% $Id: pst-tools-doc.tex 607 2017-10-02 17:56:55Z herbert $ \documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false, smallheadings, headexclude,footexclude,oneside]{pst-doc} \usepackage[utf8]{inputenc} \usepackage{pst-tools} \let\pstToolsFV\fileversion -\usepackage{ltablex} +\usepackage{xltabular} +\usepackage{pst-plot} \renewcommand\bgImage{} \lstset{language=PSTricks, morekeywords={psPrintValue},basicstyle=\footnotesize\ttfamily} % +\usepackage{biblatex} \addbibresource{pst-tools-doc.bib} \begin{document} \title{\texttt{pst-tools}} \subtitle{Helper functions; v.\pstToolsFV} -\author{Herbert Vo\ss} +\author{Herbert Voß} \docauthor{} \date{\today} \maketitle @@ -56,7 +58,7 @@ space. There are the following valid options for \Lcs{psPrintValue}: \noindent\medskip -\begin{tabularx}{\linewidth}{@{}l|>{\ttfamily}l>{\ttfamily}lX@{}} +\begin{xltabular}{\linewidth}{@{}l|>{\ttfamily}l>{\ttfamily}lX@{}} \textrm{name} & \textrm{value} & \textrm{default}\\\hline \endhead \Lkeyword{PSfont} & PS font name & Times & only valid \PS\ font names are possible, e.g. @@ -74,7 +76,7 @@ may vary on different operating systems.\\ \Lkeyword{algebraic} & <boolean> & false & function in algebraic notation.\\ \Lkeyword{VarName} & <string> & \{\} & saves the value in /<VarName> for further use\\ \Lkeyword{comma} & <boolean> & false & comma instead of the dor for decimals\\ -\end{tabularx} +\end{xltabular} \begin{center} \psset{fontscale=12} @@ -157,6 +159,39 @@ foo \makebox[3.5em][l]{\psPrintValue[PSfont=StandardSymL,decimals=6, +\section{\nxLcs{psGetElement}}\label{sec:getElement} +The macro returns the n-th Element of a comma separated list into the +user definied Macro \Lcs{\Larga{Element}}. + +\begin{BDef} +\Lcs{psGetElement}\Largb{Index}\Largb{value list}\nxLcs{\Larga{Element}}\\ +\end{BDef} + + +\begin{lstlisting} +\def\ColorList{,violet,blue,green,red}% Index starts at 0 +\begin{pspicture}(-7,-4)(7,5) +\psaxes(0,0)(-6.5,-4)(6.5,5) +\psset{plotpoints=400,algebraic} +\psforeach{\iA}{1,2,3,4}{% + \psGetElement{\iA}{\ColorList}\foo + \psplot[linecolor=\foo]{-6.28}{6.28}{\iA*sin(\iA*x)}} +\end{pspicture} +\end{lstlisting} + +\def\ColorList{,violet,blue,green,red}% Index starts at 0 +\begin{pspicture}(-7,-4)(7,5) +\psaxes(0,0)(-6.5,-4)(6.5,5) +\psset{plotpoints=400,algebraic} +\psforeach{\iA}{1,2,3,4}{% + \psGetElement{\iA}{\ColorList}\foo + \psplot[linecolor=\foo]{-6.28}{6.28}{\iA*sin(\iA*x)}} +\end{pspicture} + + + + + @@ -181,4 +216,18 @@ foo \makebox[3.5em][l]{\psPrintValue[PSfont=StandardSymL,decimals=6, \end{document} - +\def\psGetElement#1#2{% #1 natural number; #2 comma separated list + \pst@cnto=0\relax + \pst@cntp=#1\relax + \expandafter\psGetElement@i#2,,\@nil +} +\iftrue +\def\psGetElement@i#1,#2,#3\@nil{% + \ifnum\the\pst@cnto<\pst@cntp\relax + \advance\pst@cnto by \@ne + \def\ps@next{\psGetElement@i#2,#3\@nil}% + \else + \def\ps@next{#1}% + \fi + \ps@next +} |