summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/rviewport
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/rviewport
Initial commit
Diffstat (limited to 'macros/latex/contrib/rviewport')
-rw-r--r--macros/latex/contrib/rviewport/Makefile47
-rw-r--r--macros/latex/contrib/rviewport/README18
-rw-r--r--macros/latex/contrib/rviewport/rviewport.dtx239
-rw-r--r--macros/latex/contrib/rviewport/rviewport.ins29
-rw-r--r--macros/latex/contrib/rviewport/rviewport.pdfbin0 -> 223554 bytes
-rw-r--r--macros/latex/contrib/rviewport/vitruvian.jpgbin0 -> 63756 bytes
6 files changed, 333 insertions, 0 deletions
diff --git a/macros/latex/contrib/rviewport/Makefile b/macros/latex/contrib/rviewport/Makefile
new file mode 100644
index 0000000000..fa708bee2e
--- /dev/null
+++ b/macros/latex/contrib/rviewport/Makefile
@@ -0,0 +1,47 @@
+#
+# Makefile for rviewport package
+#
+# This file is in public domain
+#
+# $Id: Makefile,v 1.1 2011-08-27 22:46:19 boris Exp $
+#
+
+PACKAGE=rviewport
+
+all: $(PACKAGE).pdf
+
+
+%.pdf: %.dtx $(PACKAGE).sty
+ pdflatex $<
+ - bibtex $*
+ pdflatex $<
+ - makeindex -s gind.ist -o $*.ind $*.idx
+ - makeindex -s gglo.ist -o $*.gls $*.glo
+ pdflatex $<
+ while ( grep -q '^LaTeX Warning: Label(s) may have changed' $*.log) \
+ do pdflatex $<; done
+
+
+%.sty: %.ins %.dtx
+ pdflatex $<
+
+
+
+.PRECIOUS: $(PACKAGE).cfg $(PACKAGE).sty
+
+
+clean:
+ $(RM) $(PACKAGE).sty $(PACKAGE).log $(PACKAGE).aux \
+ $(PACKAGE).cfg $(PACKAGE).glo $(PACKAGE).idx $(PACKAGE).toc \
+ $(PACKAGE).ilg $(PACKAGE).ind $(PACKAGE).out $(PACKAGE).lof \
+ $(PACKAGE).lot $(PACKAGE).bbl $(PACKAGE).blg $(PACKAGE).gls \
+ $(PACKAGE).dvi $(PACKAGE).ps *.hd
+
+distclean veryclean: clean
+ $(RM) $(PACKAGE).pdf
+
+#
+# Archive for the distribution. Includes typeset documentation
+#
+archive: all clean
+ tar -czvf $(PACKAGE).tgz --exclude '*~' --exclude '*.tgz' --exclude CVS .
diff --git a/macros/latex/contrib/rviewport/README b/macros/latex/contrib/rviewport/README
new file mode 100644
index 0000000000..f58d8dbfdb
--- /dev/null
+++ b/macros/latex/contrib/rviewport/README
@@ -0,0 +1,18 @@
+ Relative Viewport for Graphics Inclusion
+ Boris Veytsman
+ v1.0, 2011/08/27
+
+
+Package graphicx provides a useful keyword viewport which allows to
+show just a part of an image. However, one needs to put there the
+actual coordinates of the viewport window. Sometimes it is useful to
+have relative coordinates as fractions of natural size. For example,
+one may want to print a large image on a spread, putting a half on a
+verso page, and another half on the next recto page. For this one
+would need a viewport occupying exactly one half of the file's
+bounding box, whatever the actual width of the image may be.
+
+This package adds a new keyword rviewport to the graphicx package
+specifiying Relative Viewport for graphics inclusion: a window defined
+by the given fractions of the natural width and height of the image.
+
diff --git a/macros/latex/contrib/rviewport/rviewport.dtx b/macros/latex/contrib/rviewport/rviewport.dtx
new file mode 100644
index 0000000000..b8491f2944
--- /dev/null
+++ b/macros/latex/contrib/rviewport/rviewport.dtx
@@ -0,0 +1,239 @@
+% \iffalse
+%<*gobble>
+% $Id: rviewport.dtx,v 1.2 2011-08-27 22:53:32 boris Exp $
+%
+% Copyright 2011, Boris Veytsman <borisv@lk.net>
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either
+% version 1.3 of this license or (at your option) any
+% later version.
+% The latest version of the license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of
+% LaTeX version 2003/06/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Boris Veytsman
+%
+% This work consists of the file rviewport.dtx and the
+% derived files rviewport.sty, rviewport.dtx.
+%
+% \fi
+% \CheckSum{110}
+%
+%
+%% \CharacterTable
+%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%
+%\iffalse
+% \begin{macrocode}
+\documentclass{ltxdoc}
+\usepackage{array,graphicx}
+\usepackage{url,amsmath,hypdoc}
+\usepackage{rviewport}
+\newcommand\progname[1]{\textsl{#1}}
+\DoNotIndex{\NeedsTeXFormat, \ProvidesPackage, \def, \hspace}
+\DoNotIndex{\futurelet, \@gobble, \ifx, \else, \fi, \relax}
+\DoNotIndex{\ifmmode, \fi, \allowbreak}
+\PageIndex
+\CodelineIndex
+\RecordChanges
+\EnableCrossrefs
+\begin{document}
+ \DocInput{rviewport.dtx}
+\end{document}
+% \end{macrocode}
+%</gobble>
+% \fi
+% \MakeShortVerb{|}
+%
+%\GetFileInfo{rviewport.sty}
+% \title{Relative Viewport for Graphics Inclusion\thanks{\copyright
+% Boris Veytsman, 2011. E-mail: \texttt{borisv@lk.net}}}
+% \author{Boris Veytsman\thanks{This work was partially supported by
+% The Food and Agriculture Organization of the United Nations}}
+% \date{\filedate, \fileversion}
+% \maketitle
+%
+% \begin{abstract}
+% The package adds a new keyword |rviewport| to the
+% \progname{graphicx} package specifiying Relative Viewport for
+% graphics inclusion: a window defined by the given fractions of the
+% natural width and height of the image.
+% \end{abstract}
+%
+% \tableofcontents
+%
+% \clearpage
+%
+%\section{User Interface}
+%\label{sec:interface}
+%
+% Package \progname{graphicx} provides a useful keyword |viewport|
+% which allows to show just a part of an image. However, one needs to
+% put there the actual coordinates of the viewport window. Sometimes
+% it is useful to have relative coordinates as fractions of
+% natural size. For example, one may want to print a large image on a
+% spread, putting a half on a verso page, and another half on the next
+% recto page. For this one would need a viewport occupying exactly
+% one half of the file's bounding box, whatever the actual width of the
+% image may be.
+%
+% Here we define the new option |rviewport| for
+% Relative Viewport. It works like this. Suppose the image has the
+% bounding box $x_{ll}$, $y_{ll}$, $x_{ur}$, $y_{ur}$. We give four
+% numbers $\xi_{ll}$, $\eta_{ll}$, $\xi_{ur}$, $\eta_{ur}$, and the viewport
+% coordinates become
+% \begin{align*}
+% x'_{ll} &= x_{ll} + \xi_{ll}\Delta_x\\
+% y'_{ll} &= y_{ll} + \eta_{ll}\Delta_y\\
+% x'_{ur} &= x_{ll} + \xi_{ur}\Delta_x\\
+% y'_{ur} &= y_{ll} + \eta_{ur}\Delta_y
+% \end{align*}
+% where
+% \begin{align*}
+% \Delta_x &= x_{ur} - x_{ll}\\
+% \Delta_y &= y_{ur} - y_{ll}
+% \end{align*}
+% This means that the left half of the image can be defined as
+% |rviewport = 0 0 0.5 1|,
+% and the right half can be defined as |rviewport = 0.5 0 1 1|.
+%
+% The package may be loaded before or after \progname{graphicx}
+% package.
+%
+%
+%\section{Examples}
+%\label{sec:examples}
+%
+%
+% \def\Example#1{%
+% \begin{center}
+% \includegraphics[rviewport=#1,clip]{vitruvian}\\*
+% \cmd{\includegraphics}[rviewport=#1,clip]\texttt{\{vitruvian\}}
+% \end{center}}
+%
+% \Example{0 0 1 1}
+% \Example{0 0 0.5 1}
+% \Example{0.5 0 1 1}
+% \Example{0 0 0.5 0.5}
+% \Example{0 0.5 1 1}
+% \Example{0 0 1 0.5}
+% \Example{0.4 0.6 0.6 0.9}
+%
+%
+%\StopEventually{}
+%
+% \clearpage
+%
+% \section{Implementation}
+% \label{sec:implementation}
+%
+%
+%\subsection{Declarations}
+%\label{sec:decl}
+%
+% We start with declaration, who we are:
+%
+%
+% \begin{macrocode}
+%<*style>
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{rviewport}
+[2011/08/27 v1.0 Relative viewport for graphics inclusion]
+% \end{macrocode}
+%
+% The package \progname{graphicx} loads \progname{keyval}, but in case
+% we are loaded before \progname{graphicx} we require it here:
+% \begin{macrocode}
+\RequirePackage{keyval}
+% \end{macrocode}
+%
+%
+%\subsection{The New Key}
+%\label{sec:key}
+%
+% We add a new key for the \progname{graphicx} package:
+% \begin{macrocode}
+\define@key{Gin}{rviewport}
+ {\let\Gin@viewport@code\Gin@rviewport\Gread@parse@rvp#1 \\}
+% \end{macrocode}
+%
+%
+% \begin{macro}{\Gread@parse@rvp}
+% We parse four numbers into the corresponding macros:
+% \begin{macrocode}
+\def\Gread@parse@rvp#1 #2 #3 #4 #5\\{%
+ \def\Gin@vllx{#1}%
+ \def\Gin@vlly{#2}%
+ \def\Gin@vurx{#3}%
+ \def\Gin@vury{#4}}%
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\Gin@rviewport}
+% And the viewport code. Note that |pdftex.def| relies on
+% the values of |\Gin@v...| macros, so we redefine them as well.
+% \begin{macrocode}
+\def\Gin@rviewport{%
+ \let\Gin@ollx\Gin@llx
+ \let\Gin@olly\Gin@lly
+ \let\Gin@ourx\Gin@urx
+ \let\Gin@oury\Gin@ury
+ \Gin@nat@width\Gin@urx\p@
+ \advance\Gin@nat@width-\Gin@llx\p@
+ \Gin@nat@height\Gin@ury\p@
+ \advance\Gin@nat@height-\Gin@lly\p@
+ \dimen@\Gin@vurx\Gin@nat@width
+ \edef\Gin@vurx{\strip@pt\dimen@}%
+ \advance\dimen@\Gin@llx\p@
+ \edef\Gin@urx{\strip@pt\dimen@}%
+ \dimen@\Gin@vury\Gin@nat@height
+ \edef\Gin@vury{\strip@pt\dimen@}%
+ \advance\dimen@\Gin@lly\p@
+ \edef\Gin@ury{\strip@pt\dimen@}%
+ \dimen@\Gin@vllx\Gin@nat@width
+ \edef\Gin@vllx{\strip@pt\dimen@}%
+ \advance\dimen@\Gin@llx\p@
+ \edef\Gin@llx{\strip@pt\dimen@}%
+ \dimen@\Gin@vlly\Gin@nat@height
+ \edef\Gin@vlly{\strip@pt\dimen@}%
+ \advance\dimen@\Gin@lly\p@
+ \edef\Gin@lly{\strip@pt\dimen@}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+%
+%\subsection{The Last Words}
+%\label{sec:last}
+%
+%
+%
+% \begin{macrocode}
+%</style>
+% \end{macrocode}
+%\Finale
+%\clearpage
+%
+%\PrintChanges
+%\clearpage
+%\PrintIndex
+%
+\endinput
diff --git a/macros/latex/contrib/rviewport/rviewport.ins b/macros/latex/contrib/rviewport/rviewport.ins
new file mode 100644
index 0000000000..d88c0ef0a4
--- /dev/null
+++ b/macros/latex/contrib/rviewport/rviewport.ins
@@ -0,0 +1,29 @@
+%
+% Doctrip file for rviewport
+% This file is in public domain
+% $Id: rviewport.ins,v 1.1 2011-08-27 22:46:19 boris Exp $
+%
+\def\batchfile{rviewport.ins}
+\input docstrip
+\keepsilent
+\showprogress
+
+
+\askforoverwritefalse
+
+\generate{%
+ \file{rviewport.sty}{\from{rviewport.dtx}{style}}}
+
+\obeyspaces
+\Msg{******************************************************}%
+\Msg{* Congratulations! You successfully generated the *}%
+\Msg{* rviewport package. *}%
+\Msg{* *}%
+\Msg{* Please move the file rviewport.sty the place where *}%
+\Msg{* LaTeX files are kept in your system. The manual *}%
+\Msg{* for the package is in the file rviewport.pdf. *}%
+\Msg{* *}%
+\Msg{* The package is released under LPPL *}%
+\Msg{* *}%
+\Msg{* Happy TeXing! *}%
+\Msg{******************************************************}% \ No newline at end of file
diff --git a/macros/latex/contrib/rviewport/rviewport.pdf b/macros/latex/contrib/rviewport/rviewport.pdf
new file mode 100644
index 0000000000..14cf40206d
--- /dev/null
+++ b/macros/latex/contrib/rviewport/rviewport.pdf
Binary files differ
diff --git a/macros/latex/contrib/rviewport/vitruvian.jpg b/macros/latex/contrib/rviewport/vitruvian.jpg
new file mode 100644
index 0000000000..406573b7d0
--- /dev/null
+++ b/macros/latex/contrib/rviewport/vitruvian.jpg
Binary files differ