summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/rputover/rputover.tex
blob: 13d153e4e4fb99ff5dc30f452a58adde6864e398 (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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
%
%
%
\documentclass[12pt]{article}
\usepackage{utopia,pstricks,pst-plot,rputover}
\usepackage{url,color,secdot}
\definecolor{LinkColor}{rgb}{0, 0, 0.4}%
\usepackage[pagebackref,colorlinks,urlcolor=blue,citecolor=LinkColor,%
  linkcolor=LinkColor,plainpages=false,breaklinks,%
  bookmarksnumbered,bookmarksopen=true,bookmarksopenlevel=0,%
  hyperfootnotes=true]{hyperref}

\def\sectionautorefname{Section}

\usepackage{amsmath}

\oddsidemargin0.5in
\evensidemargin0.5in
\topmargin0in

\sectiondot{section} % put period after section number but not in cross-
                     % references to number (e.g. \autoref)

\begin{document}

\thispagestyle{empty}

\vspace*{\fill}

\psset{unit=1mm}

\hspace*{\fill}%
\begin{pspicture}(120,120)
\fboxrule=0pt%
\fboxsep=5pt%
%
\pscircle[fillstyle=solid,fillcolor=blue!20,linestyle=none](60,60){60}%
%
\psset{origin={60,60}}%
%
\psclip{\pscircle[linestyle=none](0,0){60}}%
\pscustom[fillstyle=solid,fillcolor=red!30,linestyle=none]{%
  \psplot{-60}{60}{x 10 mul cos 12 mul}%
  \psline[liftpen=1](60,-5)(60,-60)(-60,-60)(-60,-5)%
}%
\endpsclip%
%
\rputover(60,57){\shortstack{\large Manual for\\[1mm]\large\texttt{rputover}\\version 1.0}}%
\rputover(60,38){\shortstack{Martin J. Osborne\\[1mm]\scriptsize\url{https://www.economics.utoronto.ca/osborne/}\\[1mm]2017.3.26}}%
%
\coverable{%
  \psclip{\pscircle[linestyle=none](0,0){60}}%
  \psline[linewidth=2,linecolor=orange!30](-65,-3.5)(65,-3.5)%
  \rput{33}(40,-23){\psplot[linecolor=green!30,linewidth=2]{-65}{65}{x 10 mul cos 12 mul}}%
%  \rput{-30}(-24,37){\psplot[linecolor=green!30,linewidth=1]{-65}{65}{x 10 mul cos 12 mul}}
  \endpsclip%
}%
%
\end{pspicture}%
\hspace*{\fill}%

\vspace*{\fill}

\newpage

\sloppy

\section{Introduction}

You create a PSTricks figure with regions filled with various colors.

\bigskip

\hspace*{\fill}%
\begin{pspicture}(100,30)
\fboxsep=5pt

\psframe[fillstyle=solid,fillcolor=blue!20,linestyle=none](0,0)(100,30)

\psset{origin={50,15}}

\pscustom[fillstyle=solid,fillcolor=red!30,linestyle=none]{%
  \psplot{-50}{50}{x 15 mul cos 12 mul}
  \psline[liftpen=1](50,0)(50,-15)(-50,-15)(-50,0)
}

\end{pspicture}%
\hspace*{\fill}

\bigskip

\noindent
You add some lines over the colors.

\bigskip

\hspace*{\fill}%
\begin{pspicture}(100,30)
\fboxsep=5pt

\psframe[fillstyle=solid,fillcolor=blue!20,linestyle=none](0,0)(100,30)

\psset{origin={50,15}}

\pscustom[fillstyle=solid,fillcolor=red!30,linestyle=none]{%
  \psplot{-50}{50}{x 15 mul cos 12 mul}
  \psline[liftpen=1](50,0)(50,-15)(-50,-15)(-50,0)
}

\psset{origin={0,0}}

\psline[linestyle=dotted,linewidth=0.5](53,0)(53,23)(0,23)

\end{pspicture}%
\hspace*{\fill}

\bigskip

\noindent
Now you want to add some labels.  You'd like these
labels to block out the lines.

\bigskip

\hspace*{\fill}%
\begin{pspicture}(100,30)
\fboxsep=3pt

\psframe[fillstyle=solid,fillcolor=blue!20,linestyle=none](0,0)(100,30)

\psset{origin={50,15}}

\pscustom[fillstyle=solid,fillcolor=red!30,linestyle=none]{%
  \psplot{-50}{50}{x 15 mul cos 12 mul}
  \psline[liftpen=1](50,0)(50,-15)(-50,-15)(-50,0)
}

\psset{origin={0,0}}

\rputover(53,17){label}%

\coverable{%
  \psline[linestyle=dotted,linewidth=0.5](53,0)(53,23)(0,23)
}

\end{pspicture}%
\hspace*{\fill}

\bigskip

\noindent
This style allows you to do that.

Why do you need a style?  Why not use \verb+\rput*+?  That 
blocks out the lines, but it does so by creating a white rectangle that blocks
the colors too.   

\bigskip

\hspace*{\fill}%
\begin{pspicture}(100,30)
\fboxrule=0pt
\fboxsep=3pt

\psframe[fillstyle=solid,fillcolor=blue!20,linestyle=none](0,0)(100,30)

\psset{origin={50,15}}

\pscustom[fillstyle=solid,fillcolor=red!30,linestyle=none]{%
  \psplot{-50}{50}{x 15 mul cos 12 mul}
  \psline[liftpen=1](50,0)(50,-15)(-50,-15)(-50,0)
}

\psset{origin={0,0}}

\psline[linestyle=dotted,linewidth=0.5](53,0)(53,23)(0,23)

\rput*(53,17){label}%

\end{pspicture}%
\hspace*{\fill}

\bigskip

\noindent
You could change the background color of that rectangle, but  if the rectangle
includes regions with two or more colors, this approach can get pretty complicated.

This style offers a simple solution.  You use \verb+\rputover+ instead of
\verb+\rput+ and include all the objects you want to be covered by the text in
the argument of \verb+\coverable+, like so:

\small
\begin{verbatim}
\usepackage{pstricks,rputover}
...
\begin{pspicture}(100,30)
...
\fboxsep=3pt
\rputover(53,17){label}%
\coverable{%
  \psline[linestyle=dotted,linewidth=0.5](50,0)(50,23)(0,23)
}
...
\end{pspicture}
\end{verbatim}

Note that

\begin{itemize}
\item \verb+%+ must follow every \verb+\rputover+ statement
\item the separation around the label is determined by \verb+\fboxsep+.
\end{itemize} 

The style combines two ideas.  The first idea, suggested by the StackExchange user Werner on \href{http://tex.stackexchange.com/questions/353748/is-there-a-variant-of-rput-in-pstricks-that-preserves-background-fill-colors}{this page}, is to use \verb+\psDefBoxNodes+ in \verb+pst-node.sty+ to get the coordinates of the corners of the box occupied by each label.  The second idea is to use these coordinates and  \verb+\psclip+ to remove the parts of the objects in the argument of \verb+\coverable+ that overlap with the labels. The only subtlety in implementing this second idea is that we want to do a `reverse clip': we want to keep the areas \textit{outside} the labels, not the ones inside.

\section{Commands}
\verb+\rputover+ has  the same syntax as \verb+\rput+.
It should be immediately followed by \verb+%+.
 
Example: \verb+\rputover{30}[br](0,10){label}%+.

\bigskip

\noindent
\verb+\coverable+ has a single argument, which consists of all the objects that are to be covered by the objects that are arguments of \verb+\putover+ commands.

Example: \verb+\coverable{\psline(25,0)(25,23)(0,23)\pscircle(0,0){5}}+

\section{History}
\begin{description}
\item[Version 1.0, 2017.3.25] First version
\end{description}


\end{document}
%