From 841aed00b258ed3eb5fb6a6d49b6c6537cabf3be Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 8 Oct 2017 22:42:37 +0000 Subject: overpic (8oct17) git-svn-id: svn://tug.org/texlive/trunk@45500 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/overpic/overpic.dtx | 389 +++++++++++++++++++++ Master/texmf-dist/source/latex/overpic/overpic.ins | 59 ++++ 2 files changed, 448 insertions(+) create mode 100644 Master/texmf-dist/source/latex/overpic/overpic.dtx create mode 100644 Master/texmf-dist/source/latex/overpic/overpic.ins (limited to 'Master/texmf-dist/source/latex/overpic') diff --git a/Master/texmf-dist/source/latex/overpic/overpic.dtx b/Master/texmf-dist/source/latex/overpic/overpic.dtx new file mode 100644 index 00000000000..aaa2ffde7a0 --- /dev/null +++ b/Master/texmf-dist/source/latex/overpic/overpic.dtx @@ -0,0 +1,389 @@ +% \iffalse meta-comment +% +% Copyright (C) 2017 by Rolf Niepraschk +% --------------------------------------------------------------------------- +% 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 this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Rolf Niepraschk. +% +% This work consists of the files overpic.dtx and overpic.ins +% and the derived filebase overpic.sty. +% +%<*package> +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{overpic}[2017/10/06 1.0 picture overlays] +% +% +%<*driver> +\ProvidesFile{overpic.dtx} +\documentclass{ltxdoc} +\usepackage{overpic,pict2e,xcolor} +\usepackage{lmodern} +\usepackage{listings} +\setlength\parindent{0pt} +\newlength\myparskip +\setlength\myparskip{.6em plus 0.1em minus 0.1em} +\setlength\parskip{\myparskip} +\lstset{% + language=[AlLaTeX]TeX, + gobble=2, + keywordstyle=\bfseries, + commentstyle=\small\ttfamily, + basicstyle=\small\ttfamily, + basewidth=0.55em, + backgroundcolor=\color{black!10}, + keepspaces, + numbers=none, + aboveskip=\myparskip, + belowskip=\myparskip, + framesep=\fboxsep, + frame=single +} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} + \DocInput{overpic.dtx} + \PrintChanges + \PrintIndex +\end{document} +% +% \fi +% +% \CheckSum{174} +% +% \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 \~} +% +% +% \changes{0.60}{2014/06/16}{Converted to .dtx} +% \changes{1.0}{2017/10/06}{mostly rewritten} +% +% \DoNotIndex{\newcommand,\renewcommand,\newenvironment,\renewenvironment} +% \DoNotIndex{\providecommand,\def,\edef,\let,\gdef,\xdef,\global,\newtoks} +% \DoNotIndex{\usebox,\sbox,\relax,\@viipt,\@viiipt,\count@,\dimexpr,\newif} +% \DoNotIndex{\RequirePackage,\DeclareOption,\ProcessOptions,\ExecuteOptions} +% \DoNotIndex{\PassOptionsToPackage,\endinput,\lowercase} +% \DoNotIndex{\input,\InputIfFileExists} +% \DoNotIndex{\@ifdefinable,\@ifundefined,\@percentchar} +% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage} +% \DoNotIndex{\PackageError,\PackageWarning,\PackageWarningNoLine,\PackageInfo} +% \DoNotIndex{\MessageBreak,\typeout} +% \DoNotIndex{\z@,\z@skip,\p@,\@ne,\tw@,\thr@@,\@iv,\@m,\strip@pt} +% \DoNotIndex{\the,\if,\else,\or,\fi,\ifnum,\ifdim,\ifcase,\ifodd} +% \DoNotIndex{\advance,\multiply,\divide} +% \DoNotIndex{\@tfor,\do,\@ehc,\@tempcnta,\@tempcntb} +% \DoNotIndex{\csname,\endcsname,\begingroup,\endgroup} +% \DoNotIndex{\expandafter,\afterassignment,\noexpand} +% +% \providecommand*{\url}{\texttt} +% \GetFileInfo{overpic.sty} +% \title{The \textsf{overpic} package} +% \author{Rolf Niepraschk \\ (\url{Rolf.Niepraschk@gmx.de)}} +% \date{Version~\fileversion~--~\filedate} +% +% \maketitle +% +% \section{Introduction} +% +% The overpic environment is a combination between the \LaTeX\ picture +% environment and another \LaTeX\ object like an image used with the +% command \cmd{\includegraphics} of graphicx or a tabular. The +% resulting picture environment has the same dimensions as the included +% object. \LaTeX\ commands can be placed on the object at any position; +% setting a grid for the orientation is possible. +% +% \section{Usage} +% +% Put |\usepackage[|\meta{options}|]{overpic}| in the preamble of the document. +% The following package options are available: +% \begin{itemize} +% \item |abs|: Absolute positioning in multiples of \cmd{\unitlength}. +% \item |percent|: Relative positioning; the longer dimension has +% value 100. The \cmd{\unitlength} will be calculated accordingly. This +% is the default mode. +% \item |permil|: Relative positioning; the longer dimension has +% value 1000. The \cmd{\unitlength} will be calculated accordingly. +% \end{itemize} +% Other options will be tranfered to package |graphicx|. +% +% \DescribeEnv{overpic} +% |\begin{overpic}[|\meta{options}|]{|\meta{filename}|}| \meta{picture code} +% |\end{overpic}| \par +% Sets the graphic \meta{filename} and puts the \meta{picture code} on the +% top of the graphic. The picture code can be any \TeX\ code inclusive other +% graphics. +% +% The following options are possible: +% \begin{itemize} +% \item |abs|, |percent|, |permil|: The same as the package +% options (true or false). +% \item |rel|: Other value as base for relative positioning +% (e.g. 10000) +% \item |grid|: Drawing a grid for better orientation (true or false, +% default: false). +% \item |tics|: The distance of the grid tics (default: 10). +% \item |unit|: Sets \cmd{\unitlength} (any \TeX\ dimension, only +% effective in abs mode). +% \end{itemize} +% \DescribeEnv{Overpic} +% |\begin{Overpic}[|\meta{options}|]{|\meta{\TeX\ code}|}| +% \meta{picture code} |\end{Overpic}| \par +% Similar to environment |overpic| but instead of a graphic any +% \TeX\ code (e.g. a tabular) is set as basement of the following picture +% overlay. +% +% \DescribeMacro\setOverpic +% \cmd{\setOverpic}|{|\meta{options}|}| \par +% Sets new default values. +% +% \section{Examples} +% +% The graphic (\texttt{golfer.eps}) in the following examples is +% part of the program \texttt{ghostscript} and must be accesible to \TeX{}. +% To use the command \cmd{\color} the package |xcolor| (or |color|) must +% be loaded. +% +% \subsection{Environment ``overpic'' (absolute positioning)} +% +% \begin{lstlisting} +% \begin{overpic}[abs,unit=1mm,scale=.25,grid]{golfer.eps} +% \put(3,27){\color{blue}\huge\LaTeX} +% \end{overpic} +% \end{lstlisting} +% \par\medskip\pagebreak[3] +% \begin{overpic}[abs,unit=1mm,scale=.25,grid]{golfer.eps} +% \put(3,27){\color{blue}\huge\LaTeX} +% \end{overpic} +% +% \subsection{Environment ``overpic'' (relative positioning)} +% +% The longer dimension is defined as 100\%. \pagebreak[3] +% +% \begin{lstlisting} +% \begin{overpic}[scale=.25,percent,grid]{golfer.eps} +% \put(5,45){\color{blue}\huge\LaTeX} +% \put(55,10){\color{red}% +% \frame{\includegraphics[scale=.07]{golfer.eps}}} +% \end{overpic} +% \end{lstlisting} +% \par\medskip\pagebreak[3] +% \begin{overpic}[scale=.25,percent,grid]{golfer.eps} +% \put(5,45){\color{blue}\huge\LaTeX} +% \put(55,10){\color{red}% +% \frame{\includegraphics[scale=.07]{golfer.eps}}} +% \end{overpic} +% +% \subsection{Environment ``Overpic'' (absolute positioning)} +% +% To use the picture command \cmd{\polygon} the package |pict2e| must +% be loaded. +% +% \begin{lstlisting} +% \begin{Overpic}[abs,unit=1mm,grid=true,tics=5]{% +% \begin{tabular}{*{8}{p{8mm}}} +% H & & & & & & & He\\ +% Li & Be & B & C & N & O & F & Ne\\ +% Na & Mg & Al & Si & P & S & Cl & Ar\\ +% K & Ca & Ga & Ge & As & Se & Br & Kr\\ +% Rb & Sr & In & Sn & Sb & Te & I & Xe\\ +% Cs & Ba & Tl & Pb & Bi & Po & At & Rn\\ +% Fr & Ra & 112& & 114& & &\\ +% \end{tabular}}% +% \linethickness{0.5mm} \color{blue}% +% \put(0,0){\polygon(0,30)(10,30)(10,21.5)(44,21.5)(44,13.5)% +% (22,13.5)(22,4.5)(0,4.5)} +% \end{Overpic} +% \end{lstlisting} +% \par\medskip\pagebreak[3] +% \begin{Overpic}[abs,unit=1mm,grid=true,tics=5]{% +% \begin{tabular}{*{8}{p{8mm}}} +% H & & & & & & & He\\ +% Li & Be & B & C & N & O & F & Ne\\ +% Na & Mg & Al & Si & P & S & Cl & Ar\\ +% K & Ca & Ga & Ge & As & Se & Br & Kr\\ +% Rb & Sr & In & Sn & Sb & Te & I & Xe\\ +% Cs & Ba & Tl & Pb & Bi & Po & At & Rn\\ +% Fr & Ra & 112& & 114& & &\\ +% \end{tabular}}% +% \linethickness{0.5mm} \color{blue}% +% \put(0,0){\polygon(0,30)(10,30)(10,21.5)(44,21.5)(44,13.5)% +% (22,13.5)(22,4.5)(0,4.5)} +% \end{Overpic} +% +% \StopEventually{} +% +% \section{Implementation} +% +% \iffalse +%<*package> +% \fi +% \begin{macrocode} +\RequirePackage{graphicx,epic} +% \end{macrocode} +% +% \begin{macro}{\OVP@scale} +% Reference value for rel mode, "100" (percent) and "1000" (permil) +% \begin{macrocode} +\newcommand*\OVP@scale{\z@} +% \end{macrocode} +% \end{macro} +% All the keys. +% \begin{macrocode} +\define@key{Gin}{rel}{% + \def\OVP@scale{#1}% + \ifnum\OVP@scale>\z@ + \let\OVP@calc\OVP@calc@rel + \else + \PackageError{overpic}{Invalid number for option `rel'}\@ehc + \fi +} +\define@key{Gin}{percent}[]{% + \setkeys{Gin}{rel=100}% +} +\define@key{Gin}{permil}[]{% + \setkeys{Gin}{rel=\@m}% +} +\define@key{Gin}{abs}[]{% + \let\OVP@calc\OVP@calc@abs +} +\newif\ifGin@grid +\define@key{Gin}{grid}[true]{\lowercase{\Gin@boolkey{#1}}{grid}} +\define@key{Gin}{tics}{\count@=#1} +\define@key{Gin}{unit}{\unitlength=\dimexpr#1\relax} +% \end{macrocode} +% \begin{macro}{\OVP@calc@abs} +% Some calculations in abs mode. \cmd{\@tempcnta} is the normalized width +% and \cmd{\@tempcntb} is the normalized height. \cmd{\count@} is the +% tics value. +% \begin{macrocode} +\newcommand*\OVP@calc@abs{% + \divide\@tempcnta by \unitlength + \divide\@tempcntb by \unitlength + \ifnum\count@=\z@\count@=10\fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\OVP@calc@rel} +% Some calculations in rel mode. The bigger value of width or height +% is the base. +% \changes{1.0}{2017/10/06}{Suggested by \mbox{Heiko Oberdiek}} +% \begin{macrocode} +\newcommand*\OVP@calc@rel{% + \ifnum\@tempcnta>\@tempcntb + \divide\@tempcnta by \OVP@scale + \unitlength=\@tempcnta sp % + \@tempcnta=\OVP@scale + \divide\@tempcntb by \unitlength + \else + \divide\@tempcntb by \OVP@scale + \unitlength=\@tempcntb sp % + \@tempcntb=\OVP@scale + \divide\@tempcnta by \unitlength + \fi + \ifnum\count@=\z@ + \count@=\OVP@scale + \divide\count@ by 10 % + \fi +} +% \end{macrocode} +% \end{macro} +% The package options set the defaults. +% \begin{macrocode} +\DeclareOption{percent}{\setkeys{Gin}{rel=100}} +\DeclareOption{permil}{\setkeys{Gin}{rel=\@m}} +\DeclareOption{abs}{\setkeys{Gin}{abs}} +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{graphicx}} +\ExecuteOptions{percent} +\ProcessOptions +% \end{macrocode} +% +% \begin{environment}{overpic} +% Box 0 gets a graphic. +% \begin{macrocode} +\newenvironment{overpic}[2][]{% + \sbox\z@{\includegraphics[#1]{#2}}% +% \end{macrocode} +% reset the graphics parameter +% \begin{macrocode} + \let\Gin@outer@scalex\relax + \let\Gin@outer@scaley\relax + \let\Gin@angle\relax + \let\Gin@ewidth\Gin@exclamation + \let\Gin@eheight\Gin@ewidth + \def\Gin@scalex{1}% + \let\Gin@scaley\Gin@exclamation + \OVP@picture{#1}% +}{\endpicture} +% \end{macrocode} +% \end{environment} +% \begin{environment}{Overpic} +% \changes{1.0}{2017/10/06}{Suggested by \mbox{Herbert Vo\ss}} +% Box 0 gets any \TeX\ code. +% \begin{macrocode} +\newenvironment{Overpic}[2][]{% + \sbox\z@{#2}% + \OVP@picture{#1}% +}{\endpicture} +% \end{macrocode} +% \end{environment} +% \begin{macro}{\OVP@picture} +% Put box 0 and an optionally grid at the lower left corner of a +% picture environment. +% \begin{macrocode} +\newcommand*\OVP@picture[1]{% + \settodepth{\@tempcnta}{\usebox\z@}% + \settoheight{\@tempcntb}{\usebox\z@}% + \advance\@tempcntb\@tempcnta + \settowidth{\@tempcnta}{\usebox\z@}% + \count@=\z@ \Gin@gridfalse + \setkeys{Gin}{#1}% + \OVP@calc + \picture(\@tempcnta,\@tempcntb)% + \put(0,0){\makebox(0,0)[bl]{\usebox\z@}}% + \ifGin@grid + \put(0,0){\normalfont\fontsize\@viipt\@viiipt\selectfont + \grid(\@tempcnta,\@tempcntb)(\count@,\count@)[0,0]}% + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\setOverpic} +% Sets new defaults. +% \begin{macrocode} +\newcommand*\setOverpic[1]{% + \setkeys{Gin}{#1}% +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\endinput +% \end{macrocode} +% +% \iffalse +% +% \fi +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex/overpic/overpic.ins b/Master/texmf-dist/source/latex/overpic/overpic.ins new file mode 100644 index 00000000000..30fdda1081e --- /dev/null +++ b/Master/texmf-dist/source/latex/overpic/overpic.ins @@ -0,0 +1,59 @@ +%% Copyright (C) 2014 by Rolf Niepraschk +%% -------------------------------------------------------------------------- +%% 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 this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Rolf Niepraschk. +%% +%% This work consists of the files overpic.dtx and overpic.ins +%% and the derived filebase overpic.sty. +%% + +\input docstrip.tex +\keepsilent + +\usedir{tex/latex/overpic} + +\preamble + +This is a generated file. + +Copyright (C) 1997-2016 by Rolf Niepraschk +-------------------------------------------------------------------------- +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 this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of LaTeX +version 2005/12/01 or later. + +\endpreamble + +\askforoverwritefalse + +\generate{\file{overpic.sty}{\from{overpic.dtx}{package}}} + +\obeyspaces +\Msg{*************************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the following *} +\Msg{* file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* overpic.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file overpic.dtx *} +\Msg{* through LaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{*************************************************************} + +\endbatchfile -- cgit v1.2.3