texlive[43624] Master: rputover (27mar17)
commits+karl at tug.org
commits+karl at tug.org
Mon Mar 27 23:43:48 CEST 2017
Revision: 43624
http://tug.org/svn/texlive?view=revision&revision=43624
Author: karl
Date: 2017-03-27 23:43:48 +0200 (Mon, 27 Mar 2017)
Log Message:
-----------
rputover (27mar17)
Modified Paths:
--------------
trunk/Master/tlpkg/bin/tlpkg-ctan-check
trunk/Master/tlpkg/tlpsrc/collection-pstricks.tlpsrc
Added Paths:
-----------
trunk/Master/texmf-dist/doc/latex/rputover/
trunk/Master/texmf-dist/doc/latex/rputover/README.txt
trunk/Master/texmf-dist/doc/latex/rputover/rputover.pdf
trunk/Master/texmf-dist/doc/latex/rputover/rputover.tex
trunk/Master/texmf-dist/tex/latex/rputover/
trunk/Master/texmf-dist/tex/latex/rputover/rputover.sty
trunk/Master/tlpkg/tlpsrc/rputover.tlpsrc
Added: trunk/Master/texmf-dist/doc/latex/rputover/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/rputover/README.txt (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/rputover/README.txt 2017-03-27 21:43:48 UTC (rev 43624)
@@ -0,0 +1,7 @@
+Package purpose: To allow a PSTricks user to easily place text over objects without obscuring background colors.
+
+Author: Martin J. Osborne (https://www.economics.utoronto.ca/osborne/; email address = <firstName>.<lastName> @ utoronto.ca)
+
+License: LPPL1.3
+
+Documentation: rputover.pdf.
\ No newline at end of file
Property changes on: trunk/Master/texmf-dist/doc/latex/rputover/README.txt
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/rputover/rputover.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/rputover/rputover.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/rputover/rputover.pdf 2017-03-27 21:42:47 UTC (rev 43623)
+++ trunk/Master/texmf-dist/doc/latex/rputover/rputover.pdf 2017-03-27 21:43:48 UTC (rev 43624)
Property changes on: trunk/Master/texmf-dist/doc/latex/rputover/rputover.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/rputover/rputover.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/rputover/rputover.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/rputover/rputover.tex 2017-03-27 21:43:48 UTC (rev 43624)
@@ -0,0 +1,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}
+%
Property changes on: trunk/Master/texmf-dist/doc/latex/rputover/rputover.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/rputover/rputover.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/rputover/rputover.sty (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/rputover/rputover.sty 2017-03-27 21:43:48 UTC (rev 43624)
@@ -0,0 +1,70 @@
+% rputover.sty
+% Version 1.0
+% Martin J. Osborne, 2017.3.25
+% Based partially on the answer of Werner at
+% http://tex.stackexchange.com/questions/353748/is-there-a-variant-of-rput-in-pstricks-that-preserves-background-fill-colors
+% Released under the LaTeX project public license 1.3
+
+\RequirePackage{pst-node}
+
+\newcounter{rpo at pstfiglabel}
+\newcounter{rpo at coverable}
+\newlength{\rpo at fboxrule}
+\setlength{\rpo at fboxrule}{\fboxrule}
+
+\def\rputover{%
+ \fboxrule=0pt
+ \@ifnextchar[%
+ {\@ifnextchar({\@putoveron}{\@putoveror}}%
+ {\@ifnextchar({\@putovernn}{\@putovernr}}%
+}%
+
+\def\@putoveror[#1]#2(#3,#4)#5{%
+ \rput[#1]{#2}(#3,#4){\psDefBoxNodes{label\therpo at pstfiglabel}{\fbox{#5}}}%
+ \stepcounter{rpo at pstfiglabel}%
+ \setlength{\fboxrule}{\rpo at fboxrule}%
+}%
+
+\def\@putoveron[#1](#2,#3)#4{%
+ \rput[#1](#2,#3){\psDefBoxNodes{label\therpo at pstfiglabel}{\fbox{#4}}}%
+ \stepcounter{rpo at pstfiglabel}%
+ \setlength{\fboxrule}{\rpo at fboxrule}%
+}%
+
+\def\@putovernr#1(#2,#3)#4{%
+ \rput{#1}(#2,#3){\psDefBoxNodes{label\therpo at pstfiglabel}{\fbox{#4}}}%
+ \stepcounter{rpo at pstfiglabel}%
+ \setlength{\fboxrule}{\rpo at fboxrule}%
+}%
+
+\def\@putovernn(#1,#2)#3{%
+ \rput(#1,#2){\psDefBoxNodes{label\therpo at pstfiglabel}{\fbox{#3}}}%
+ \stepcounter{rpo at pstfiglabel}%
+ \setlength{\fboxrule}{\rpo at fboxrule}%
+}%
+
+% Optional argument of \coverable is intended to be the region (x0,y0)(x1,y1) with
+% respect to which the reverse clip is done. The default, (-\maxdimen,-\maxdimen)(\maxdimen,\maxdimen),
+% seems to work fine, so the possibility of specifying the region manually doesn't seem to be necessary (or useful).
+\def\coverable{%
+ \@ifnextchar[{\@coverableo}{\@coverablen}%
+}%
+
+\def\@coverableo[(#1,#2)(#3,#4)]#5{\@coverableg{#1}{#2}{#3}{#4}{#5}}
+\def\@coverablen#1{\@coverableg{-\maxdimen}{-\maxdimen}{\maxdimen}{\maxdimen}{#1}}
+
+\def\@coverableg#1#2#3#4#5{%
+ \psclip{%
+ \pscustom[linestyle=none]{%
+ \loop%
+ \psline[liftpen=2](label\therpo at coverable:bl)(label\therpo at coverable:br)(label\therpo at coverable:tr)(label\therpo at coverable:tl)(label\therpo at coverable:bl)%
+ \stepcounter{rpo at coverable}%
+ \ifnum\value{rpo at coverable}<\value{rpo at pstfiglabel}%
+ \repeat%
+ \psline[liftpen=2](#1,#2)(#1,#4)(#3,#4)(#3,#2)%
+ }%
+ }%
+ #5
+ \endpsclip%
+}
+
Property changes on: trunk/Master/texmf-dist/tex/latex/rputover/rputover.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check 2017-03-27 21:42:47 UTC (rev 43623)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check 2017-03-27 21:43:48 UTC (rev 43624)
@@ -528,7 +528,7 @@
roboto robustcommand robustindex
romanbar romanbarpagenumber romande romanneg romannum
rosario rotfloat rotpages roundbox roundrect
- rrgtrees rsc rsfs rsfso
+ rputover rrgtrees rsc rsfs rsfso
rterface rtkinenc rtklage rubik ruhyphen rulercompass russ
rviewport rvwrite ryethesis
sa-tikz sageep sanitize-umlaut
Modified: trunk/Master/tlpkg/tlpsrc/collection-pstricks.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-pstricks.tlpsrc 2017-03-27 21:42:47 UTC (rev 43623)
+++ trunk/Master/tlpkg/tlpsrc/collection-pstricks.tlpsrc 2017-03-27 21:43:48 UTC (rev 43624)
@@ -98,6 +98,7 @@
depend pstricks
depend pstricks-add
depend pstricks_calcnotes
+depend rputover
depend uml
depend vaucanson-g
depend vocaltract
Added: trunk/Master/tlpkg/tlpsrc/rputover.tlpsrc
===================================================================
More information about the tex-live-commits
mailing list