summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pdftricks/test.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-11-25 01:30:33 +0000
committerKarl Berry <karl@freefriends.org>2008-11-25 01:30:33 +0000
commit956d952d37799fbddfb2cd354c60dfeabbef3d7d (patch)
tree893ef12674f774e0969e62243a40b096cc8b23e8 /Master/texmf-dist/doc/latex/pdftricks/test.tex
parentbe16e2585eec91d59215676a837121b9bea84f14 (diff)
pdftricks 1.16 (24nov08)
git-svn-id: svn://tug.org/texlive/trunk@11415 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/pdftricks/test.tex')
-rw-r--r--Master/texmf-dist/doc/latex/pdftricks/test.tex254
1 files changed, 160 insertions, 94 deletions
diff --git a/Master/texmf-dist/doc/latex/pdftricks/test.tex b/Master/texmf-dist/doc/latex/pdftricks/test.tex
index 9ac4ef0b08b..06083b49313 100644
--- a/Master/texmf-dist/doc/latex/pdftricks/test.tex
+++ b/Master/texmf-dist/doc/latex/pdftricks/test.tex
@@ -1,8 +1,10 @@
\documentclass{ltxguide}
-\usepackage{times,url}
-\usepackage[shell]{pdftricks}
+\usepackage{txfonts,url}
+\usepackage[shell,debug]%
+ {pdftricks}
\begin{psinputs}
+\usepackage{txfonts}
\usepackage{pstricks}
\usepackage{color}
\usepackage{pstcol}
@@ -15,12 +17,12 @@
\end{psinputs}
% 1. run pdfLaTeX
-% 2. run script `psrun' by invoking ./psrun
+% 2. run script `pst2pdf' by invoking ./pst2pdf
% 3. second run of pdfLaTeX
\begin{document}
-\NoProcess[1,3]
+%\NoProcess[1-6]
\title{Trivial Experiments with psTricks manipulation}
@@ -39,19 +41,20 @@
\maketitle
\section{Objectives}
+
|psTricks| macros cannot be used with pdf\TeX, since the high level
-PostScript language commands generated by the |psTricks| are unknown to
-pdf\TeX. As such, a package \emph{viz.}, |pdfTricks.sty| has been
-written to circumvent this limitation, so that the extensive facilities
-offered by the powerful |psTricks| package can be made use of in a
-pdf\TeX{} document. This is brought by making use of the shell escape
-function available in the |web2c| \TeX{} compiler, while this package
-is of no use to other commercial implementations.
-
-Shell escape provides us the facility of stopping a \TeX{} run
-midway, perform the functions that we do with a shell command, complete
-those functions, return to the \TeX{} run and finish the job. Within a
-package, this facility can be invoked by using
+PostScript language commands generated by the |psTricks| are unknown
+to pdf\TeX. As such, a package \emph{viz.}, |pdfTricks.sty| has been
+written to circumvent this limitation, so that the extensive
+facilities offered by the powerful |psTricks| package can be made use
+of in a pdf\TeX{} document. This is brought by making use of the shell
+escape function available in the |web2c| \TeX{} compiler, while this
+package is of no use to other commercial implementations.
+
+Shell escape provides us the facility of stopping a \TeX{} run midway,
+perform the functions that we do with a shell command, complete those
+functions, return to the \TeX{} run and finish the job. Within a
+package, this facility can be invoked by using
|\write18{shell command}|. So if you use a line:
\begin{decl}
|write18 ls -l|
@@ -69,19 +72,20 @@ default. You can either turn it on by changing the line in your
|shell_escape = t|
\end{decl}
which will be `|f|' by default. You have to recreate all the formats
-like |pdflatex.fmt| or whatever you might need. This is not a wise step
-though, since it makes you open to the assault of Trojan macros without
-your knowledge.
+like |pdflatex.fmt| or whatever you might need. This is not a wise
+step though, since it makes you open to the assault of Trojan macros
+without your knowledge.
-The more elegant way will be to invoke shell escape with a switch, each
-time you run the compiler like:
+The more elegant way will be to invoke shell escape with a switch,
+each time you run the compiler like:
\begin{decl}
|pdflatex -shell-escape <file name>|
\end{decl}
This eliminates the vulnerability to macros/packages written by
-intelligent criminal minds.
+intelligent criminal minds.
\section{Usage}
+
The usage is very simple, as usual you have to load the package with a
package loading line in the preamble of your document:
@@ -89,11 +93,10 @@ package loading line in the preamble of your document:
|\usepackage{pdftricks}|
\end{decl}
-All the packages that are needed for the compilation of the
-|pstricks| code shall be enclosed within an environment
-|\begin{psinputs}| \dots |\end{psinputs}| in order to make it
-available to all the figure documents during compilation. An
-example of this will look like
+All the packages that are needed for the compilation of the |pstricks|
+code shall be enclosed within an environment |\begin{psinputs}| \dots
+ |\end{psinputs}| in order to make it available to all the figure
+documents during compilation. An example of this will look like
\begin{decl}
|\begin{psinputs}|\\
| \usepackage{pstricks}|\\
@@ -110,43 +113,39 @@ example of this will look like
\end{decl}
Each |pspicture| environment along with any macro code shall be
-enclosed within an environment \emph{viz.}, |pdfpic|. This will
-enable pdf\LaTeX{} to write external files like |fig1.tex|,
-|fig2.tex|, \dots, depending on the number of |psTricks| figures
-you have included in your document. |pdftricks| will
-intelligently find out whether your pdf\TeX{} implementation has
-shell escape facility enabled or not. Depending on this, there
-are two ways of approaching the problem which are given in the
-succeeding sections.
+enclosed within an environment \emph{viz.}, |pdfpic|. This will enable
+pdf\LaTeX{} to write external files like |fig1.tex|, |fig2.tex|,
+\dots, depending on the number of |psTricks| figures you have included
+in your document. |pdftricks| will intelligently find out whether your
+pdf\TeX{} implementation has shell escape facility enabled or not.
+Depending on this, there are two ways of approaching the problem which
+are given in the succeeding sections.
\subsection{With shell escape}
-With shell escape option invoked, one need not bother anything.
-The usual compilation with pdf\LaTeX{} will result in a |pdf|
-document with all the figures appearing in the correct
-positions. pdf\TeX{} will do the necessary job of writing all
-the |pstricks| code to self standing external |*.tex| documents,
-escapes to shell, compiles the |*.tex| document, converts to
-|*.eps|, translates to |*.pdf| and includes in the location
-where the |pstricks| code appeared.
+With shell escape option invoked, one need not bother anything. The
+usual compilation with pdf\LaTeX{} will result in a |pdf| document
+with all the figures appearing in the correct positions. pdf\TeX{}
+will do the necessary job of writing all the |pstricks| code to self
+standing external |*.tex| documents, escapes to shell, compiles the
+|*.tex| document, converts to |*.eps|, translates to |*.pdf| and
+includes in the location where the |pstricks| code appeared.
\subsection{Without shell escape}
-A special shell script viz., |pst2pdf| is also provided. Now as
-the second step, you have to execute this shell script,
-|pst2pdf| which will compile all the newly written
-|fig1.tex|,\dots, and respective |*.dvi| will be generated,
-which will be translated into respective |*.eps| files and
-finally translated to |*.pdf| by calling |epstopdf|. As a final
-step, you shall run pdf\LaTeX{} again, so that the |*.pdf|
-figures will be included with the usual |\includegraphics|
-command automatically in the locations wherever the |pstricks|
-code appeared.
+A special shell script viz., |pst2pdf| is also provided. Now as the
+second step, you have to execute this shell script, |pst2pdf| which
+will compile all the newly written |fig1.tex|,\dots, and respective
+|*.dvi| will be generated, which will be translated into respective
+|*.eps| files and finally translated to |*.pdf| by calling |epstopdf|.
+As a final step, you shall run pdf\LaTeX{} again, so that the |*.pdf|
+figures will be included with the usual |\includegraphics| command
+automatically in the locations wherever the |pstricks| code appeared.
See an example below:
\begin{verbatim}
-\begin{pdfpic}
+\begin{pdfdisplay}
\definecolor{lightblue}{rgb}{0,0,.5}
\definecolor{Navy}{rgb}{0,0,0.5}
\definecolor{LemonChiffon}{rgb}{1,0.98,0.8}
@@ -169,12 +168,14 @@ See an example below:
\psline(! x ValueTempA sub y ValueTempB sub)
(! x ValueTempA add y ValueTempB add)}}
\end{pspicture}
-\end{pdfpic}
+\end{pdfdisplay}
\end{verbatim}
+
This |psTricks| code will result in the following graphic:
-\configure[pdfgraphic][color=red,
- linecolor=gray30]
-\begin{pdfpic}
+\configure[pdfgraphic][color=red,rulesep=12pt,
+ linecolor=gray30,
+ linewidth=2pt]
+\begin{pdfdisplay}
\definecolor{lightblue}{rgb}{0,0,.5}
\definecolor{Navy}{rgb}{0,0,0.5}
\definecolor{LemonChiffon}{rgb}{1,0.98,0.8}
@@ -197,7 +198,7 @@ This |psTricks| code will result in the following graphic:
atan rotate -9 0 moveto 18 0 rlineto stroke }
\fi}}
\endpspicture
-\end{pdfpic}
+\end{pdfdisplay}
The following are the steps in the sequential order:
\begin{decl}
@@ -209,26 +210,24 @@ The following are the steps in the sequential order:
\section{Options and Hooks}
\begin{description}
+
+\item[|shell|] This option will invoke the shell escape functions.
-\item[|shell|] This option will invoke the shell escape
-functions.
-
-\item[|noshell|] This option will suppress the shell escape
-functions and will assume that there is no shell escape
-facility.
+\item[|noshell|] This option will suppress the shell escape functions
+ and will assume that there is no shell escape facility.
-\item[|NoProcess|] A new command |\NoProcess| has been introduced in this version
-to facilitate the suppressing of pdf generation of those figures
-whose pdf's are already available. This might prove helpful when
-you have more figures to process and many of them are perfected
-and don't need recompilation and translation everytime you run
-pdf\LaTeX. The usage is:
+\item[|NoProcess|] A new command |\NoProcess| has been introduced in
+ this version to facilitate the suppressing of pdf generation of
+ those figures whose pdf's are already available. This might prove
+ helpful when you have more figures to process and many of them are
+ perfected and don't need recompilation and translation everytime you
+ run pdf\LaTeX. The usage is:
\begin{decl}
|\NoProcess{<comma separated and/or hyphen separated ranges>}|
\end{decl}
-If you have ten figures and if you want to suppress the
-processing of the figure numbers 1, 2, 4 to 8 you can issue the
-command at the top of the document as:
+If you have ten figures and if you want to suppress the processing of
+the figure numbers 1, 2, 4 to 8 you can issue the command at the top
+of the document as:
\begin{decl}
|\NoProcess{1,2,4-8}|
\end{decl}
@@ -241,30 +240,32 @@ included.
|\configure[pdfgraphic][height=3in]|\\
|\configure[pdfgraphic][width=2in,height=3in]|
\end{decl}
-the functionality is same as the |width| and |height| options as in the
-|\includegraphics| command. But the graphic will be restricted to
+the functionality is same as the |width| and |height| options as in
+the |\includegraphics| command. But the graphic will be restricted to
aspect ratio.
\section{Limitations/Dependencies}
+
\begin{itemize}
\item Usage is limited to |web2c| \TeX{} implementations.
\item The shell escape commands used in this package are typical
-\textsc{Unix} commands and as such it best works in \textsc{Linux/Unix}
-flavours.
+ \textsc{Unix} commands and as such it best works in
+ \textsc{Linux/Unix} flavours.
\item The package needs, |graphicx| and |keyval| packages; |epstopdf|,
-the Perl script that translates |eps| files into |pdf|.
+ the Perl script that translates |eps| files into |pdf|.
\end{itemize}
\section{Licence}
The package is distributed under \textsc{gnu} General Public Licence.
\section{Examples}
+
Here are some examples of pstricks code and the figures generated by
pdf\LaTeX.
\subsection{Example 1}
\begin{verbatim}
\configure[pdfgraphic][width=2in,linecolor=red,background=gray10]
-\begin{pdfpic}
+\begin{pdfdisplay}
\definecolor{lightblue}{rgb}{0,0,.5}
\definecolor{Navy}{rgb}{0,0,0.5}
\definecolor{LemonChiffon}{rgb}{1,0.98,0.8}
@@ -287,10 +288,12 @@ pdf\LaTeX.
\psline(! x ValueTempA sub y ValueTempB sub)
(! x ValueTempA add y ValueTempB add)}}
\end{pspicture}
-\end{pdfpic}
+\end{pdfdisplay}
\end{verbatim}
-\configure[pdfgraphic][width=\linewidth,linecolor=red,background=gray10]
-\begin{pdfpic}
+\configure[pdfgraphic][width=.9\linewidth,linecolor=red,
+ rulesep=12pt,background=gray10,
+ linewidth=2pt]
+\begin{pdfdisplay}
\definecolor{lightblue}{rgb}{0,0,.5}
\definecolor{Navy}{rgb}{0,0,0.5}
\definecolor{LemonChiffon}{rgb}{1,0.98,0.8}
@@ -313,12 +316,12 @@ pdf\LaTeX.
\psline(! x ValueTempA sub y ValueTempB sub)
(! x ValueTempA add y ValueTempB add)}}
\end{pspicture}
-\end{pdfpic}
+\end{pdfdisplay}
\subsection{Example 2}
\begin{verbatim}
\configure[pdfgraphic][linecolor=blue,background=gray10,width=4in]
-\begin{pdfpic}
+\begin{pdfdisplay}
\definecolor{lightblue}{rgb}{0,0,.5}
\definecolor{Navy}{rgb}{0,0,0.5}
\definecolor{LemonChiffon}{rgb}{1,0.98,0.8}
@@ -360,10 +363,12 @@ pdf\LaTeX.
\textcolor{white}{List}} Motif Class}
\end{pspicture}
\endTeXtoEPS
-\end{pdfpic}
+\end{pdfdisplay}
\end{verbatim}
-\configure[pdfgraphic][linecolor=blue,background=gray10,scale=.8]
-\begin{pdfpic}
+\configure[pdfgraphic][linecolor=blue,
+ linewidth=2pt, rulesep=6pt,
+ background=gray10,scale=.8]
+\begin{pdfdisplay}
\definecolor{lightblue}{rgb}{0,0,.5}
\definecolor{Navy}{rgb}{0,0,0.5}
\definecolor{LemonChiffon}{rgb}{1,0.98,0.8}
@@ -405,12 +410,12 @@ pdf\LaTeX.
\textcolor{white}{List}} Motif Class}
\end{pspicture}
\endTeXtoEPS
-\end{pdfpic}
+\end{pdfdisplay}
\subsection{Example 3}
\begin{verbatim}
\configure[pdfgraphic][linecolor=black,background=gray30]
-\begin{pdfpic}
+\begin{pdfdisplay}
\TeXtoEPS
\definecolor{lightblue}{rgb}{0,0,.5}
\definecolor{Navy}{rgb}{0,0,0.5}
@@ -444,13 +449,15 @@ pdf\LaTeX.
\nbput[nrot=25,npos=.7]{\bunting}
\end{pspicture}
\endTeXtoEPS
-\end{pdfpic}
+\end{pdfdisplay}
\end{verbatim}
\configure[pdfgraphic][width=\linewidth,
+ linewidth=2pt,
linecolor=gray30,
- background=gray10]
-\begin{pdfpic}
+ background=gray10,
+ rulesep=6pt]
+\begin{pdfdisplay}
\TeXtoEPS
\definecolor{lightblue}{rgb}{0,0,.5}
\definecolor{Navy}{rgb}{0,0,0.5}
@@ -484,7 +491,66 @@ pdf\LaTeX.
\nbput[nrot=25,npos=.7]{\bunting}
\end{pspicture}
\endTeXtoEPS
-\end{pdfpic}
+\end{pdfdisplay}
+
+\configure[pdfgraphic][width=\linewidth,
+ linewidth=2pt,
+ linecolor=gray30,
+ background=gray10,
+ rulesep=12pt]
+
+\begin{pdfdisplay}
+
+\definecolor{Pink}{rgb}{1.,0.75,0.8}
+% Flow diagram with the psmatrix environment\\[5mm]
+
+ \psframebox[linearc=5mm,cornersize=absolute]{%
+ \begin{psmatrix}[rowsep=0.5cm,colsep=0.8cm]
+ \psovalbox[fillstyle=solid,fillcolor=yellow]{Begin} \\
+ \psframebox{Initialisations} \\
+ \psdiabox[fillstyle=solid,fillcolor=Pink]{Special} &
+ \psframebox{Call to SP1} & \psframebox{Call to SP2} \\
+ \psframebox{Action 1} \\
+ \psframebox{Action 2} \\
+ \psovalbox[fillstyle=solid,fillcolor=yellow]{End}
+ % Links
+ \ncline{1,1}{2,1}
+ \ncline{2,1}{3,1}
+ \ncline{3,1}{4,1}<{\textcolor{red}{No}}
+ \ncline{4,1}{5,1}
+ \ncline{5,1}{6,1}
+ \ncline{->}{3,1}{3,2}^{\textcolor{red}{Yes}}
+ \ncline{->}{3,2}{3,3}
+ \ncbar[angleA=-90,armB=0,nodesepB=2.5mm]{->}{3,3}{4,1}
+ \end{psmatrix}}
+\end{pdfdisplay}
+\begin{verbatim}
+\begin{pdfdisplay}
+
+\definecolor{Pink}{rgb}{1.,0.75,0.8}
+% Flow diagram with the psmatrix environment\\[5mm]
+
+ \psframebox[linearc=5mm,cornersize=absolute]{%
+ \begin{psmatrix}[rowsep=0.5cm,colsep=0.8cm]
+ \psovalbox[fillstyle=solid,fillcolor=yellow]{Begin} \\
+ \psframebox{Initialisations} \\
+ \psdiabox[fillstyle=solid,fillcolor=Pink]{Special} &
+ \psframebox{Call to SP1} & \psframebox{Call to SP2} \\
+ \psframebox{Action 1} \\
+ \psframebox{Action 2} \\
+ \psovalbox[fillstyle=solid,fillcolor=yellow]{End}
+ % Links
+ \ncline{1,1}{2,1}
+ \ncline{2,1}{3,1}
+ \ncline{3,1}{4,1}<{\textcolor{red}{No}}
+ \ncline{4,1}{5,1}
+ \ncline{5,1}{6,1}
+ \ncline{->}{3,1}{3,2}^{\textcolor{red}{Yes}}
+ \ncline{->}{3,2}{3,3}
+ \ncbar[angleA=-90,armB=0,nodesepB=2.5mm]{->}{3,3}{4,1}
+ \end{psmatrix}}
+\end{pdfdisplay}
+\end{verbatim}
\end{document}