summaryrefslogtreecommitdiff
path: root/obsolete/macros/latex/contrib/ps4pdf/ps4pdf-test.tex
blob: e4e1e2bf3f85b90ec1ee5c883eff6d22b072678b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141

% Rolf Niepraschk, niepraschk@ptb.de, 2003-06-19
%
% Test for the LaTeX package `ps4pdf'
%
% Process this file with:
%
% latex ps4pdf-test.tex 
% dvips -Ppdf -o ps4pdf-test-pics.ps ps4pdf-test.dvi
% ps2pdf ps4pdf-test-pics.ps ps4pdf-test-pics.pdf # The "graphics container"
% pdflatex ps4pdf-test.tex # The resulting pdf document.
%
% or use the classical way:
%
% latex '\PassOptionsToPackage{inactive}{ps4pdf} \input{ps4pdf-test.tex}'
% dvips ps4pdf-test
%
% (The VTeX compiler does not need the explicitly inactive option.) 	

\listfiles\errorcontextlines=100
\documentclass[draft]{article}
\usepackage{calc}
\usepackage[final]{graphicx}
\usepackage[final]{ps4pdf}

%\containerName{pictures.pdf}% Default is `\jobname-pics.pdf'

\renewcommand{\textfraction}{0}   \setcounter{totalnumber}{8}
\renewcommand{\topfraction}{1}    \setcounter{topnumber}{8}     
\renewcommand{\bottomfraction}{1} \setcounter{bottomnumber}{8} 

\PSforPDF{%  Postscript related commands.
  \usepackage{pstricks,pst-node,pst-tree,multido}
  \definecolor{lightblue}{cmyk}{0.65,0.13,0,0}  

  \newcommand\wrongDimGraphic{%
    \begingroup
      \psset{unit=1pt}%
      \begin{pspicture}(-80,-80)(80,80)%
	\pscircle*[linecolor=red](-28,28){57}% 
	\pscircle*[linecolor=green](28,28){57}% 
	\pscircle*[linecolor=blue](0,-28){57}% 
      \end{pspicture}% 
    \endgroup
  }

  \newcommand\wrongDimGraphicX{%
    \begingroup
      \psset{unit=.75pt}%
      \begin{pspicture}(-80,-40)(80,40)%
	\psline[linecolor=blue,linewidth=28]{<->}(-114,0)(142,0)% 
      \end{pspicture}% 
    \endgroup
  }

  \newcommand\wrongDimGraphicY{%
    \begingroup
      \psset{unit=.75pt}%
      \begin{pspicture}(-40,-80)(40,80)%
	\psline[linecolor=blue,linewidth=28]{<->}(0,114)(0,-142)% 
      \end{pspicture}% 
    \endgroup
  }
}

\begin{document}

\section*{\centering Some tests for the `ps4pdf' package}

\begin{figure}[hb]
  \begin{minipage}[b]{.5\textwidth-.5\columnsep}%                
    \PSforPDF{\resizebox{\linewidth}{!}{\input{4-10-8.inl}}}
    \caption{A nice PSTricks graphic}
  \end{minipage}\hfill
  \begin{minipage}[b]{.5\textwidth-.5\columnsep}%
    \centering
    \PSforPDF{\includegraphics[width=.66\linewidth]{penguin}}
    \caption{An EPS file}
  \end{minipage}      
\end{figure}

\begin{figure}[hb]
  \setlength\fboxsep{0pt}
  \begin{minipage}{\textwidth}
    \begin{minipage}[b]{.5\textwidth-.5\columnsep}%
      \centering                     
      \fbox{\PSforPDF{\wrongDimGraphicX}}     
    \end{minipage}\hfill
    \begin{minipage}[b]{.5\textwidth-.5\columnsep}%
      \centering
      \fbox{\PSforPDF[trim=-26pt 0mm 47pt 0mm]{\wrongDimGraphicX}}
      % trim= DeltaX_left DeltaY_bottom DeltaX_right DeltaY_top
    \end{minipage}
  \end{minipage}   
  \caption{Trimming in horizontal direction}
\end{figure}

\begin{figure}[hb]
  \setlength\fboxsep{0pt}
  \begin{minipage}{\textwidth}
    \begin{minipage}[b]{.4\textwidth-.4\columnsep}%
      \centering                     
      \fbox{\PSforPDF{\wrongDimGraphicY}}     
    \end{minipage}\hfill
    \begin{minipage}[b]{.4\textwidth-.4\columnsep}%
      \centering
      \fbox{\PSforPDF[trim=0mm -47pt 0mm 26pt]{\wrongDimGraphicY}}
      % trim= DeltaX_left DeltaY_bottom DeltaX_right DeltaY_top
    \end{minipage}
  \end{minipage}   
  \caption{Trimming in vertical direction}   
\end{figure}

\clearpage

\begin{figure}[hb]
  \setlength\fboxsep{0pt}
  \begin{minipage}{\textwidth}
    \begin{minipage}[c]{.5\textwidth-.5\columnsep}%
      \centering                     
      \fbox{\PSforPDF{\wrongDimGraphic}}     
    \end{minipage}\hfill
    \begin{minipage}[c]{.5\textwidth-.5\columnsep}%
      \centering
      \fbox{\PSforPDF[trim=-2mm -2mm 2mm 2mm]{\wrongDimGraphic}}
      % trim= DeltaX_left DeltaY_bottom DeltaX_right DeltaY_top
    \end{minipage}
  \end{minipage}   
  \caption{Trimming in both directions}   
\end{figure}

\begin{figure}[hb]
  \setlength\fboxsep{0pt}
  \begin{minipage}{\textwidth}    
    \centering                     
    \PSforPDF[draft]{\includegraphics[width=.66\linewidth]{penguin}}
  \end{minipage}
  \caption{The draft parameter (see also package options draft/final)}   
\end{figure}

\end{document}