From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/pict2e/README.md | 43 + macros/latex/contrib/pict2e/manifest.txt | 19 + macros/latex/contrib/pict2e/p2e-drivers.dtx | 638 +++++ macros/latex/contrib/pict2e/p2e-drivers.pdf | Bin 0 -> 216023 bytes macros/latex/contrib/pict2e/pict2e.dtx | 3769 +++++++++++++++++++++++++++ macros/latex/contrib/pict2e/pict2e.ins | 109 + macros/latex/contrib/pict2e/pict2e.pdf | Bin 0 -> 577516 bytes 7 files changed, 4578 insertions(+) create mode 100644 macros/latex/contrib/pict2e/README.md create mode 100644 macros/latex/contrib/pict2e/manifest.txt create mode 100644 macros/latex/contrib/pict2e/p2e-drivers.dtx create mode 100644 macros/latex/contrib/pict2e/p2e-drivers.pdf create mode 100644 macros/latex/contrib/pict2e/pict2e.dtx create mode 100644 macros/latex/contrib/pict2e/pict2e.ins create mode 100644 macros/latex/contrib/pict2e/pict2e.pdf (limited to 'macros/latex/contrib/pict2e') diff --git a/macros/latex/contrib/pict2e/README.md b/macros/latex/contrib/pict2e/README.md new file mode 100644 index 0000000000..cda901f5a1 --- /dev/null +++ b/macros/latex/contrib/pict2e/README.md @@ -0,0 +1,43 @@ + +# The pict2e package + +This package was described in the 2nd edition of "LaTeX: A Document +Preparation System", but the LaTeX project team declined to produce +the package. For a long time, LaTeX has included a "pict2e package" +that merely produced an apologetic error message. + +The new package extends the existing LaTeX picture environment, using +the familiar technique (cf. the graphics and color packages) of driver +files. The package documentation (pict2e.dtx) has a fair number of +examples of use, showing where things are improved by comparison with +the LaTeX picture environment. + +Caveats: + +1. Unpacking the package in the usual way (processing pict2e.ins) + produces a file pict2e-example.cfg; this file is a satisfactory + pict2e.cfg file, for most purposes. You can't generate the + documentation (by processing pict2e.dtx) unless you have a + pict2e.cfg file. so you are recommended to rename + pict2e-example.cfg as pict2e.cfg, beforehand. The file pict2e.pdf, + in the distribution, was generated in this way, using PDFLaTeX. + +2. If you have not installed the 2003/12/01 release of LaTeX, you + already have a pict2e.sty. You should ensure that you install the + new pict2e.sty in such a way that it gets chosen by your TeX system + in preference to the old version. One way of achieving this is + simply to delete the old version, which is to be found on a TDS + system in $TEXMF/tex/latex/base + +Recommended TDS locations: +``` + pict2e.sty and driver files: tex/latex/pict2e + pict2e.pdf, p2e-drivers.pdf: doc/latex/pict2e + pict2e.cfg: tex/latex/[TEXDIST]/graphics.cfg +``` + +For general installation advice, see +http://www.tex.ac.uk/cgi-bin/texfaq2html?label=instpackages + +For bug reports use the GitHub repository: https://github.com/rolfn/pict2e/issues + diff --git a/macros/latex/contrib/pict2e/manifest.txt b/macros/latex/contrib/pict2e/manifest.txt new file mode 100644 index 0000000000..57b7cdf847 --- /dev/null +++ b/macros/latex/contrib/pict2e/manifest.txt @@ -0,0 +1,19 @@ +% +% CONTENTS OF THE PICT2E PACKAGE +% ============================== + +pict2e.ins + Installation script. + +pict2e.dtx + Extended versions of some of the commands of the `picture' + environment. + +p2e-drivers.dtx + Source for driver files for supported drivers. + +README.md + Short notes about the package. + +manifest.txt + This file. diff --git a/macros/latex/contrib/pict2e/p2e-drivers.dtx b/macros/latex/contrib/pict2e/p2e-drivers.dtx new file mode 100644 index 0000000000..8f27acfa7f --- /dev/null +++ b/macros/latex/contrib/pict2e/p2e-drivers.dtx @@ -0,0 +1,638 @@ +% \iffalse meta-comment +% +% p2e-drivers.dtx +% +% +% Copyright (C) 2003-2016 +% Rolf Niepraschk, Rolf.Niepraschk@gmx.de +% Hubert Gaesslein, hubertjg@gmx.de +% Josef Tkadlec, j.tkadlec@email.cz +% +% +% 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 2003/12/01 or later. +% +% This work has the LPPL maintenance status "author-maintained". +% +% This work consists of all files listed in manifest.txt. +% +% +% This file is part of the New Implementation of the Standard LaTeX +% picture commands (package pict2e). It complements the file +% drivers.dtx from the Standard LaTeX `Graphics Bundle'. +% +% +%\ProvidesFile{p2e-template.def} +%\ProvidesFile{p2e-dvips.def} +%\ProvidesFile{p2e-xdvi.def} +%\ProvidesFile{p2e-pdftex.def} +%\ProvidesFile{p2e-luatex.def} +%\ProvidesFile{p2e-vtex.def} +%\ProvidesFile{p2e-dvipdfm.def} +%\ProvidesFile{p2e-dvipdfmx.def} +%\ProvidesFile{p2e-xetex.def} +%\ProvidesFile{p2e-textures.def} +%\ProvidesFile{p2e-pctexps.def} +%\ProvidesFile{p2e-pctex32.def} +% +%<*driver> +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{p2e-drivers.dtx} +% +% +%\ProvidesFile{pict2e.cfg}% + [2016/02/05 v0.1u +%<*!cfg> + Driver-dependant file (RN,HjG,JT)] +% +% pict2e configuration for teTeX/TeXLive] +% +%<*driver> +\documentclass{ltxdoc} + \GetFileInfo{p2e-drivers.dtx} + \def\docdate{2016/02/05} +\begin{document} + \title{Graphics drivers for \textsf{pict2e}\thanks + {This document corresponds to \textsf{\filename} \fileversion, + dated \filedate, documentation dated \docdate.}} + \author{Rolf Niepraschk\thanks{\texttt{Rolf.Niepraschk@gmx.de}}, + Hubert G\"a{\ss}lein,%\thanks{\texttt{HubertJG@open.mind.de}} + \,and Josef Tkadlec\thanks{\texttt{j.tkadlec@email.cz}}} + \date{\filedate} + % \maketitle + \DocInput{p2e-drivers.dtx} +\end{document} +% +% \fi +% +% \CheckSum{166} +% +% \changes{v0.1g}{2003/11/07}{Translated documentation to English (HjG)} +% \changes{v0.1g}{2003/11/07}{Added driver \texttt{dvipdfm} (RN)} +% \changes{v0.1h}{2003/11/12}{Move check for \texttt{ver@\backslash Gin@driver} +% to package pict2e (RN,HjG)} +% \changes{v0.1h}{2003/11/12}{General cleaning (RN,HjG)} +% \changes{v0.1h}{2003/11/12}{More general cleaning (HjG)} +% \changes{v0.1i}{2003/11/22}{M-x delete-trailing-whitespace (HjG)} +% \changes{v0.1j}{2003/12/13}{Resurrect reference to latexbugs address (HjG)} +% \changes{v0.1j}{2003/12/13}{Try new driver for \textsf{xdvi}---to no avail (HjG)} +% \changes{v0.1k}{2003/12/18}{Polish up documentation (HjG)} +% \changes{v0.1l}{2003/12/19}{Some tentative entries for new drivers (HjG)} +% \changes{v0.1l}{2003/12/19}{Polish up documentation (HjG)} +% \changes{v0.1m}{2003/12/21}{Polish up documentation (HjG)} +% \changes{v0.1o}{2004/02/19}{Fix some typos (HjG)} +% \changes{v0.1p}{2004/03/26}{Minor changes to documentation (HjG)} +% \changes{v0.1q}{2004/04/22}{Added lppl (RN/HjG)} +% \changes{v0.1r}{2004/06/25}{Small fixes in documentation (HjG)} +% \changes{v0.1s}{2009/08/05}{Support for xetex added (JT)} +% \changes{v0.1t}{2011/04/05}{Support for dvipdfmx added (JT)} +% \changes{v0.1u}{2016/02/05}{Support for luatex >0.85 +% (suggested by David Carlisle) added (RN)} +% +% \newcommand*\PS{PostScript} +% \newcommand*\PDF{PDF} +% \newcommand*\teTeX{te\kern-.11em\TeX} +% \newcommand*\TeXlive{\TeX live} +% +% \makeatletter +% \@ifundefined{ifdeveloping}{\newif\ifdeveloping}{} ^^A false by default +% \makeatother +% +% \ifdeveloping +% \makeatletter +% +% \newcommand*\isodattim{} +% \begingroup +% \count@\time +% \divide\count@ 60 +% \count2=-\count@ +% \multiply\count2 60 +% \advance\count2 \time +% \xdef\isodattim{^^A +% \the\year-\two@digits{\the\month}-\two@digits{\the\day}^^A +% ~\two@digits{\the\count@}:\two@digits{\the\count2}} +% \endgroup +% +% \newcommand*\ps@myfootings{^^A cf. \ps@plain +% \let\@mkboth\@gobbletwo +% \let\@oddhead\@empty +% \let\@evenhead\@empty +% \def\@oddfoot{\reset@font +% \rlap{\textsf{\filename}~\fileversion~\filedate}^^A +% \hfil\thepage\hfil +% \llap{\TeX ed \texttt{\isodattim}}}^^A +% \def\@evenfoot{\reset@font +% \rlap{\TeX ed \texttt{\isodattim}}^^A +% \hfil\thepage\hfil +% \llap{\filedate~\fileversion~\textsf{\filename}}}^^A +% } +% \pagestyle{myfootings} +% \let\pagestyle\@gobble +% \let\thispagestyle\@gobble +% +% \makeatother +% \else +% \makeatletter +% ^^A \ifdim\overfullrule>\z@\else\let\ps@myfootings\ps@plain\fi +% \makeatother +% \fi +% +% +% \maketitle +% +% +% \section{Driver files} +% +% This file implements some of the currently supported drivers for +% the new version of the \textsf{pict2e} package. +% If the driver you use is not in this list then a `\texttt{.def}' +% file may be distributed with the pict2e package, +% or may be distributed with the standard \LaTeX\ graphics bundle, +% or may be distributed with your driver. +% +% If not, send us some details of the driver's |\special| syntax, and +% we will try to produce a suitable file. +% +% Note that some of these files are for graphics drivers to which we +% have no access, so they are untested. +% Please send any corrections to the latexbugs address or directly to +% the authors. +% +% \StopEventually{} +% +% \subsection{Template} +% +% A template for a \textsf{pict2e} driver file. +% +% \begin{macro}{\pIIe@mode} +% This macro serves as an indicator to the \textsf{pict2e} package +% which mode the driver supports: +% +% \smallskip +% \begin{tabular}{rl} +% $-1$ & inapt\slash incapable (default, +% already set in \textsf{pict2e}) \\ +% $0$ & standard \LaTeX\ only \\ +% $1$ & \PS \\ +% $2$ & \PDF \\ +% & (other values are reserved for future use) +% \end{tabular} +% \smallskip +% +% \noindent +% Incapable drivers should not alter the default value given by the +% \textsf{pict2e} package, or set it explicitly to $-1$. +% ^^A (Or set it to $0$ to request standard \LaTeX\ mode.) +% \begin{macrocode} +%<*template> +\def\pIIe@mode{-1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@code} +% The \textsf{pict2e} package expects the driver file to define the +% \cmd{\pIIe@code} command in a suitable way. +% +% This command should locally establish the standard \PS\slash\PDF\ +% coordinate system +% (i.e., a cartesian coordinate system +% with positive x-axis pointing right +% and positive y-axis pointing up, +% and with unit $1\,\mathrm{bp} = 1/72\,\mathrm{in}$), +% albeit with the origin at \TeX's current point instead of the lower +% left corner of the page. +% +% Furthermore, it should save and restore the graphics state +% (|gsave|\slash|grestore| in \PS, |q|\slash|Q| in \PDF.) +% This may be achieved by using appropriate \cmd{\special} (or +% \cmd{\pdfliteral}, respectively) commands. +% +% Moreover, this command should preserve (i.e., it should not change) +% the current colour as defined by the user via the commands of the +% \textsf{color} package from the graphics bundle. +% +% Thus, the \cmd{\Gin@PS@restored} command that various +% \meta{driver}|.def| files from the graphics bundle provide should +% usually come close to what is expected here. +% \begin{macrocode} +\def\pIIe@code#1{} +% +% \end{macrocode} +% \end{macro} +% +% +% \subsection{dvips} +% +% A \textsf{pict2e} driver file for the \textsf{dvips} driver. +% +% \begin{macro}{\pIIe@mode} +% We are about to generate \PS\ code. +% \begin{macrocode} +%<*dvips> +\def\pIIe@mode{1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@code} +% In this case the code inserted by the driver on behalf of the +% \cmd{\Gin@PS@restored} command performs a ``|0| |setgray|'' +% operation, thus resetting any colour the user might have set by +% means of the \textsf{color} package. +% \ (See also \LaTeX\ problem report graphics/3569.) \ ^^A +% We therefore have to resort to the following kludge: +% As long as we output only simple picture objects, our operations are +% ``atomic.'' +% Hence, we won't need to set colours or gray shades within the \PS\ +% code generated by \textsf{pict2e}; +% thus the offending |setgray| operator may as well be a no-op. +% To keep this redefinition local, we enclose the call to +% \cmd{\Gin@PS@restored} by a |save|\slash|restore| pair. +% \changes{v0.1}{2003/08/27}{Fix for dvips' \cmd{\Gin@PS@restored} +% (prevent resetting current color to black). (HjG,RN)} +% \begin{macrocode} +\def\pIIe@code#1{% + \Gin@PS@raw{save /setgray { pop } def}% + \Gin@PS@restored{#1}% + \Gin@PS@raw{restore}% +} +% +% \end{macrocode} +% \end{macro} +% +% +% \subsection{pdfTeX} +% +% A \textsf{pict2e} driver file for the \textsf{pdftex} driver. +% +% \begin{macro}{\pIIe@mode} +% We are about to generate \PDF\ code. +% (Only, if pdf\TeX\ is actually generating \PDF; +% otherwise nothing will be output.) +% \begin{macrocode} +%<*pdftex> +\begingroup + \@ifundefined{pdfoutput}{}{% + \ifnum\pdfoutput>0\relax + \gdef\pIIe@mode{2} + \fi + } +\endgroup +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@code} +% The save\slash restore operators are necessary here to prevent the +% change of the CTM (scaling and rotation operations) that +% \textsf{pict2e} inserts from propagating. +% \begin{macrocode} +\ifcase\pIIe@mode\relax \or\or + \def\pIIe@code#1{\pdfliteral{ q #1 Q }} +\fi +% +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Lua\TeX} +% +% A \textsf{pict2e} driver file for the \textsf{luatex} driver. +% +% \begin{macro}{\pIIe@mode} +% We are about to generate \PDF\ code. +% (Only, if Lua\TeX\ is actually generating \PDF; +% otherwise nothing will be output.) +% \begin{macrocode} +%<*luatex> +\begingroup + \ifnum\outputmode>0\relax + \gdef\pIIe@mode{2} + \fi +\endgroup +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@code} +% The save\slash restore operators are necessary here to prevent the +% change of the CTM (scaling and rotation operations) that +% \textsf{pict2e} inserts from propagating. +% \begin{macrocode} +\ifcase\pIIe@mode\relax \or\or + \def\pIIe@code#1{\pdfextension literal{ q #1 Q }} + \protected\edef\pIIe@pdfliteral{\pdfextension literal} +\fi +% +% \end{macrocode} +% \end{macro} +% +% +% \subsection{V\TeX} +% +% A \textsf{pict2e} driver file for the \textsf{vtex} driver. +% +% \begin{macro}{\pIIe@mode} +% With \textsf{V\TeX}, we should use \PS\ code also for \PDF\ mode +% (Email from Michael Vulis, MicroPress). +% \begin{macrocode} +%<*vtex> +\begingroup + \@ifundefined{VTeXversion}{}{% + \ifnum\OpMode>0\relax + \ifnum\OpMode<3\relax + \gdef\pIIe@mode{1}% + \fi + \fi + } +\endgroup +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@code} +% Here |\Gin@PS@restored| suffices as provided by the graphics driver +% file |vtex.def|. +% \begin{macrocode} +\ifcase\pIIe@mode\relax \or + \let\pIIe@code\Gin@PS@restored +\fi +% +% \end{macrocode} +% \end{macro} +% +% +% \subsection{dvipdfm} +% +% A \textsf{pict2e} driver file for the \textsf{dvipdfm} driver. +% +% \begin{macro}{\pIIe@mode} +% We are about to generate \PDF\ code. +% \begin{macrocode} +%<*dvipdfm> +\def\pIIe@mode{2} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@code} +% This seems to be sufficient. +% \begin{macrocode} +\def\pIIe@code#1{\special{pdf: content #1}} +% +% \end{macrocode} +% \end{macro} +% +% +% \subsection{dvipdfmx} +% +% A \textsf{pict2e} driver file for the \textsf{dvipdfmx} driver. +% +% \begin{macro}{\pIIe@mode} +% We are about to generate \PDF\ code. +% \begin{macrocode} +%<*dvipdfmx> +\def\pIIe@mode{2} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@code} +% \begin{macrocode} +\def\pIIe@code#1{\special{pdf: content #1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@pdfliteral} +% \begin{macrocode} +\def\pIIe@pdfliteral#1{\special{pdf: literal #1}} +% +% \end{macrocode} +% \end{macro} +% +%\iffalse +% \subsection{xdvi} +% +% A \textsf{pict2e} driver file for the \textsf{xdvi} driver. +% +% \begin{macro}{\pIIe@mode} +% We are about to generate \PS\ code. +% \begin{macrocode} +%<*xdvi> +\def\pIIe@mode{1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@code} +% As long as our operations are ``atomic,'' we won't need to set +% colours or gray shades within our code, hence the offending +% \verb+setgray+ operator may as well be a no-op. +% See also \LaTeX\ problem report graphics/3569. +% \changes{v0.1}{2003/08/27}{Fix for dvips' \cmd{\Gin@PS@restored} +% (prevent resetting current color to black). (HjG,RN)} +% \begin{macrocode} +\def\pIIe@code#1{% + % \Gin@PS@raw{save /setgray { pop } def}% + \Gin@PS@restored{#1}% + % \Gin@PS@raw{restore}% +} +% +% \end{macrocode} +% \end{macro} +%\fi +% +% +% \subsection{xetex} +% +% A \textsf{pict2e} driver file for the \textsf{xetex} driver. +% \begin{macro}{\pIIe@mode} +% We are about to generate \PDF\ code. +% \begin{macrocode} +%<*xetex> +\def\pIIe@mode{2} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@code} +% \begin{macrocode} +\def\pIIe@code#1{\special{pdf: literal q #1 Q}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@pdfliteral} +% \begin{macrocode} +\def\pIIe@pdfliteral#1{\special{pdf: literal #1}} +% +% \end{macrocode} +% \end{macro} +% +% \subsection{dvipdf} +% +% A \textsf{pict2e} driver file for the \textsf{dvipdf} driver +% (not yet implemented). +% +% \begin{macro}{\pIIe@mode} +% \begin{macrocode} +%<*dvipdf> + %\def\pIIe@mode{-1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@code} +% This is the same as the definition for |\Gin@PS@restored| +% in |dvipdf.def| as defined in |drivers.dtx|! +% Better use the higher-level macro instead of the |\special|? +% \begin{macrocode} + %\def\pIIe@code#1{\special{" #1}} % \Gin@PS@restored{#1} +% +% \end{macrocode} +% \end{macro} +% +% +% \subsection{textures} +% +% A \textsf{pict2e} driver file for the \textsf{textures} driver +% (not yet implemented). +% +% \begin{macro}{\pIIe@mode} +% \begin{macrocode} +%<*textures> + % \def\pIIe@mode{-1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@code} +% \begin{macrocode} + % \def\pIIe@code#1{} +% +% \end{macrocode} +% \end{macro} +% +% +% \subsection{dvipsone} +% +% A \textsf{pict2e} driver file for the \textsf{dvipsone} driver +% (not yet implemented). +% +% \begin{macro}{\pIIe@mode} +% \begin{macrocode} +%<*dvipsone> + % \def\pIIe@mode{-1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@code} +% \begin{macrocode} + % \def\pIIe@code#1{} +% +% \end{macrocode} +% \end{macro} +% +% +% \subsection{pctexps} +% +% A \textsf{pict2e} driver file for the \textsf{pctexps} driver +% (not yet implemented). +% +% \begin{macro}{\pIIe@mode} +% \begin{macrocode} +%<*pctexps> + % \def\pIIe@mode{-1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@code} +% \begin{macrocode} + % \def\pIIe@code#1{} +% +% \end{macrocode} +% \end{macro} +% +% +% \subsection{pctex32} +% +% A \textsf{pict2e} driver file for the \textsf{pctex32} driver +% (not yet implemented). +% +% \begin{macro}{\pIIe@mode} +% \begin{macrocode} +%<*pctex32> + % \def\pIIe@mode{-1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@code} +% \begin{macrocode} + % \def\pIIe@code#1{} +% +% \end{macrocode} +% \end{macro} +% +% +% \section{A Sample Configuration File} +% +% ^^A Preamble? +% +% This one is taken from |color.cfg| of the +% \teTeX\slash\TeXlive\ distributions. +% \begin{macrocode} +%<*cfg> +%% Select an appropriate default driver. +\begingroup + \chardef\x=0 % + % check luatex + \ifx\luatexversion\@undefined + % check pdfTeX + \@ifundefined{pdfoutput}{}{% + \ifcase\pdfoutput + \else + \chardef\x=1 % + \fi + }% + % check VTeX + \@ifundefined{OpMode}{}{% + \chardef\x=2 % + }% + % check XeTeX + \@ifundefined{XeTeXrevision}{}{% + \chardef\x=3 % + }% + \else + \ifnum\luatexversion>85 + \ifnum\outputmode>0 + \chardef\x=4\relax + \fi + \else + \ifnum\pdfoutput>0 + \chardef\x=1\relax + \fi + \fi + \fi +\expandafter\endgroup +\ifcase\x + % 0: default case + \ExecuteOptions{dvips}% +\or + % 1: pdfTeX is running in pdf mode + \ExecuteOptions{pdftex}% +\or + % 2: VTeX is running + \ExecuteOptions{vtex}% +\or + % 3: XeTeX is running + \ExecuteOptions{xetex}% +\or + % 4: LuaTeX (> 0.85) is running + \ExecuteOptions{luatex}% +\fi +% \end{macrocode} +% You can also specify other options to the \textsf{pict2e} package in +% the configuration file. +% For example, if you prefer PSTricks-like arrows, just uncomment the +% line below. +% \begin{macrocode} +%% \ExecuteOptions{pstarrows} +% +% \end{macrocode} +% +% \Finale +\endinput diff --git a/macros/latex/contrib/pict2e/p2e-drivers.pdf b/macros/latex/contrib/pict2e/p2e-drivers.pdf new file mode 100644 index 0000000000..1b8add2b0e Binary files /dev/null and b/macros/latex/contrib/pict2e/p2e-drivers.pdf differ diff --git a/macros/latex/contrib/pict2e/pict2e.dtx b/macros/latex/contrib/pict2e/pict2e.dtx new file mode 100644 index 0000000000..9c4baa4f3f --- /dev/null +++ b/macros/latex/contrib/pict2e/pict2e.dtx @@ -0,0 +1,3769 @@ +% \iffalse meta-comment +% +% +% +% Copyright (C) 2003-2016 +% Rolf Niepraschk, Rolf.Niepraschk@gmx.de +% Hubert Gaesslein, hubertjg@gmx.de +% Josef Tkadlec, j.tkadlec@email.cz +% +% +% 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 2003/12/01 or later. +% +% This work has the LPPL maintenance status "author-maintained". +% +% This work consists of all files listed in manifest.txt. +% +% +%<*package> +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{pict2e}[2019/08/20 v0.3c Improved picture commands (HjG,RN,JT)] +% +% +%<*driver> +\listfiles +\errorcontextlines5 +\documentclass{ltxdoc} +\usepackage{pict2e} % [pstarrows] +%%\usepackage[debug]{pict2e} +\IfFileExists{ebezier.sty}{\usepackage{ebezier}}{% +} % \providecommand*\cbezier{} +\usepackage{color} +\usepackage{graphicx} +\usepackage{array} +%%\usepackage{pstcol} +\usepackage{longtable} +\IfFileExists{geometry.sty}{% + \usepackage[left=\marginparwidth,textwidth=1.15\textwidth,% + top=20mm,bottom=30mm]{geometry}}{} +\IfFileExists{url.sty}{\usepackage{url}} + {\newcommand*\url[1]{\texttt{#1}}} +%\OnlyDescription +\AlsoImplementation +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\begin{document} +%%\tracingmacros\maxdimen +%%\tracingall \tracingonline0 +%%\loggingall + \setlength\emergencystretch{3em} + \DocInput{pict2e.dtx} +\end{document} +% +% \fi +% +% \GetFileInfo{pict2e.sty} +% \def\docdate{2016/01/09} +% +% \CheckSum{2158} +% +% ^^A ======== +% +% \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 \~} +% +% +% ^^A ======== +% +% \makeatletter +% \@ifundefined{ifdeveloping}{\newif\ifdeveloping}{} ^^A false by default +% \makeatother +% +% ^^A ======== +% +% \ifdeveloping ^^A Should be further refined +% +% \changes{v0.1a}{2003/07/18}{First version. New code for \cmd{\@sline}. (RN)} +% \changes{v0.1b}{2003/07/20}{New code for \cmd{\@circle} and \cmd{\@dot} +% added. (RN)} +% \changes{v0.1c}{2003/07/21}{More flexibility with sampling the graphic +% operators in token register (\cmd{\pIIe@GRAPH}). (RN)} +% \changes{v0.1c}{2003/07/21}{Code for \cmd{\@bezier} added. (RN)} +% \changes{v0.1d}{2003/07/22}{New code for \cmd{\cbezier} +% (package `ebezier'). (RN)} +% \changes{v0.1e}{2003/07/24}{New option ``debug''} +% \changes{v0.1f}{2003/08/17}{Changed mode numbers. (RN)} +% \changes{v0.1f}{2003/08/17}{\cmd{\pIIe@add@rcurveto} added. (RN)} +% \changes{v0.1f}{2003/08/17}{\cmd{\pIIe@add@XY} added. (RN)} +% \changes{v0.1g}{2003/08/23}{Changed code for \cmd{\pIIe@add@qcircle}. +% (HjG,RN)} +% \changes{v0.1g}{2003/08/23}{New code for \cmd{\@oval}. (HjG,RN)} +% \changes{v0.1i}{2003/08/28}{Translation, scaling, rotation added. (HjG,RN)} +% \changes{v0.1j}{2003/08/29}{Loads now `color.cfg' instead of `graphics.cfg' +% for system default driver (no more trouble with commands like +% \cmd{\DeclareGraphicsRule}) (RN)} +% \changes{v0.1j}{2003/08/29}{Driver specific code now in new files +% ``p2e-DRIVER.def''. (RN)} +% \changes{v0.1k}{2003/08/30}{\cmd{\pIIe@PTtoBP} removed. Scaling with +% PS/PDF code instead. (RN)} +% \changes{v0.1l}{2003/09/24}{First implementation of \cmd{\vector}. (RN,HjG)} +% \changes{v0.1m}{2003/09/26}{\cmd{\vector} complete (arctan version). (RN,HjG)} +% \changes{v0.1n}{2003/10/01}{Loads now the own configuration file `pict2e.cfg' +% instead of `color.cfg' (RN,HjG)} +% \changes{v0.1n}{2003/10/01}{New Option `hide' suppresses the ps or pdf output (RN)} +% \changes{v0.1o}{2003/10/17}{New implementation of opt. arg. to \cmd{\oval} (HjG,RN)} +% \changes{v0.1p}{2003/10/29}{Improve \cmd{\@sline} (HjG,RN)} +% \changes{v0.1p}{2003/10/29}{Some cleaning (HjG,RN)} +% \changes{v0.1p}{2003/10/29}{Rudimentary Documentation, translated to English (HjG,RN)} +% \changes{v0.1q}{2003/11/02}{Small fixes in documentation (HjG)} +% \changes{v0.1r}{2003/11/12}{Cleaning and revamping (RN,HjG)} +% \changes{v0.1r}{2003/11/12}{Rename commands: operators get `@op' suffix, +% drawing commands loose `@add' (RN,HjG)} +% \changes{v0.1s}{2003/11/13}{Avoid use of dimen registers +% \cmd{\@tempdima} and \cmd{\@tempdimb} in all but low level auxillary +% macros -- avoid potential pitfall (RN,HjG)} +% \changes{v0.1t}{2003/11/13}{Some code and documentation cleaning (RN)} +% \changes{v0.1u}{2003/11/18}{M-x delete-trailing-whitespace (HjG)} +% \changes{v0.1u}{2003/11/19}{Some cleaning and revamping (HjG)} +% \changes{v0.1u}{2003/11/20}{Finally, bring code snippets in a more +% meaningful order (HjG)} +% \changes{v0.1u}{2003/11/21}{Save many tokens by introducing ancillary macros (HjG)} +% \changes{v0.1v}{2003/11/21}{More cleaning and revamping (HjG)} +% \changes{v0.1v}{2003/11/22}{Return of ``cleaning and revamping'' (HjG)} +% \changes{v0.1w}{2003/11/25}{Son of ``cleaning and revamping'' (HjG)} +% \changes{v0.1w}{2003/11/25}{More documentation about usage (HjG)} +% \changes{v0.1w}{2003/11/27}{Small fixes (RN,HjG)} +% \changes{v0.1x}{2003/11/27}{Improve PSTricks-like arrows. (RN,HjG)} +% \changes{v0.1y}{2003/11/27}{Implement LaTeX-like arrows. (RN,HjG)} +% \changes{v0.1z}{2003/12/04}{Change \cmd{\cbezier}. (RN,HjG)} +% \changes{v0.2a}{2003/12/04}{Return of the son of ``cleaning and revamping'' (HjG)} +% \changes{v0.2a}{2003/12/05}{M-x delete-trailing-whitespace (HjG)} +% \changes{v0.2}{2003/12/11}{Minor changes. (RN,HjG)} +% \changes{v0.2b}{2003/12/13}{Merge v0.2a and v0.2 (HjG)} +% \changes{v0.2c}{2003/12/13}{Grandson of ``cleaning and revamping'' (HjG)} +% \changes{v0.2c}{2003/12/13}{Try new driver for \textsf{xdvi}---to no avail (HjG)} +% \changes{v0.2*}{2003/12/17}{Improve LaTeX-like arrows. (RN,HjG)} +% \changes{v0.2d}{2003/12/18}{Merge v0.2c and v0.2*. (HjG)} +% \changes{v0.2e}{2003/12/18}{Merge new figures created by RN. (HjG)} +% \changes{v0.2e}{2003/12/19}{Return of the grandson of ``cleaning and revamping'' (HjG)} +% \changes{v0.2f}{2003/12/19}{Cousin of ``cleaning and revamping'' (HjG)} +% \changes{v0.2f}{2003/12/20}{Return of the cousin of ``cleaning and revamping'' (HjG)} +% \changes{v0.2g}{2003/12/21}{Nephew of ``cleaning and revamping'' (HjG)} +% \changes{v0.2h}{2004/01/07}{Documentation and small code improvements (RN,HjG)} +% \changes{v0.2i}{2004/01/29}{Slope arguments for \cmd{\vector} restricted +% to values $\vert s \vert \le 1000$ (RN,HjG)} +% \changes{v0.2i*}{2004/02/11}{Final touches for release (RN)} +% \changes{v0.2j}{2004/02/19}{Final touches for release (HjG)} +% \changes{v0.2k}{2004/03/24}{Return of the nephew of ``cleaning and revamping'' (HjG)} +% \changes{v0.2k}{2004/03/26}{Better control for history entries +% while debugging (HjG)} +% \changes{v0.2l}{2004/04/08}{Added redefinition of \cmd{\line} (RN,HjG)} +% \changes{v0.2m}{2004/04/10}{Minor touches (HjG)} +% \changes{v0.2n}{2004/04/22}{Added lppl (RN,HjG)} +% \changes{v0.2o}{2004/06/25}{Fix two bugs (HjG)} +% \changes{v0.2o}{2004/06/25}{Numerous small fixes in documentation (HjG)} +% \changes{v0.2p}{2004/07/06}{Small fixes in documentation (HjG)} +% \changes{v0.2s}{2006/03/05}{Wrong PSTricks-like arrows corrected (RN)} +% \changes{v0.2t}{2008/05/11}{All lines by \cmd{\@sline}, +% added \cmd{\arc}, \cmd{\Line}, \cmd{\polyline}, \cmd{\polygon}, +% types of lines and their connections, path commands (JT)} +% \changes{v0.2u}{2008/06/29}{Also real slopes for lines and vectors. (JT)} +% \changes{v0.2v}{2008/07/19}{Improved internal division macro. (JT)} +% \changes{v0.2w}{2008/07/22}{Number of points in \cmd{\qbezier} not ignored. (JT)} +% \changes{v0.2x}{2009/08/05}{Support for xetex. (JT)} +% \changes{v0.2y}{2011/04/05}{Support for dvipdfmx. (JT)} +% \changes{v0.2z}{2014/01/12}{Conflict wit epic, eepic solved. (JT)} +% \changes{v0.3a}{2016/01/09}{Local line types, documentation fixes. (JT)} +% \fi +% +% \changes{v0.1a}{2003/07/18}{First version. (RN)} +% \changes{v0.2j}{2004/02/27}{First release to CTAN +% (2004/02/19 v0.2j). (LaTeX Team)} +% \changes{v0.2n}{2004/05/27}{Second release to CTAN +% (2004/04/22 v0.2n). (RN/HjG)} +% \changes{v0.2o}{2004/06/25}{Third release to CTAN +% (2004/06/25 v0.2o). (RN/HjG)} +% \changes{v0.2p}{2004/07/28}{Fourth release to CTAN +% (2004/07/28 v0.2p). (RN)} +% \changes{v0.2q}{2004/08/06}{Fourth release to CTAN +% (2004/08/06 v0.2q). (RN/HjG)} +% \changes{v0.2u}{2008/06/29}{Fifth release to CTAN +% (2008/06/29 v0.2u). (JT)} +% \changes{v0.2v}{2008/07/19}{Sixth release to CTAN +% (2008/07/19 v0.2v). (JT)} +% \changes{v0.2w}{2008/07/22}{Seventh release to CTAN +% (2008/07/19 v0.2w). (JT)} +% \changes{v0.2x}{2009/08/08}{Eigth release to CTAN +% (2009/08/08 v0.2x). (JT)} +% \changes{v0.2y}{2011/04/05}{Nineth release to CTAN +% (2011/04/05 v0.2y). (JT)} +% \changes{v0.2z}{2014/01/12}{10th release to CTAN +% (2011/04/05 v0.2z). (JT)} +% \changes{v0.3a}{2016/01/09}{11th release to CTAN +% (2016/01/09 v0.3a). (JT)} +% \changes{v0.3b}{2016/02/05}{12th release to CTAN +% (2016/02/05 v0.3b). (RN)} +% +% \DoNotIndex{\newcommand,\renewcommand,\newenvironment,\renewenvironment} +% \DoNotIndex{\providecommand,\def,\edef,\let,\gdef,\xdef,\global,\newtoks} +% \DoNotIndex{\RequirePackage,\DeclareOption,\ProcessOptions,\ExecuteOptions} +% \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,\two@fourteen,\strip@pt} +% \DoNotIndex{\the,\if,\else,\or,\fi,\ifnum,\ifdim,\ifcase,\ifodd} +% \DoNotIndex{\advance,\multiply,\divide} +% \DoNotIndex{\@tfor,\do} +% \DoNotIndex{\csname,\endcsname,\begingroup,\endgroup} +% \DoNotIndex{\expandafter,\afterassignment,\noexpand} +% +% \changes{v0.1w}{2003/11/25}{Index use of temporary registers +% while debugging (HjG)} +% \changes{v0.2k}{2004/03/26}{Better control for indexing temporary +% registers while debugging (HjG)} +%^^A \ifdim0pt<\overfullrule\else +% \ifdeveloping\else +% \DoNotIndex{\@tempdima,\@tempdimb,\@tempdimc,\@tempcnta,\@tempcntb} +% \DoNotIndex{\@halfwidth,\@wholewidth,\unitlength} +% \DoNotIndex{\@clnwd,\@clnht,\@ovdx,\@ovdy,\@ovro,\@ovri,\@ovxx,\@ovyy} +% \DoNotIndex{\@xarg,\@xdim,\@yarg,\@ydim,\@linelen,\@dashdim,\dimen@} +% \fi +% +% \DoNotIndex{\reserved@a,\relax,\protect,\space} +% \DoNotIndex{\if@tempswa,\@tempswatrue,\@tempswafalse} +% \DoNotIndex{\if@ovt,\if@ovb,\if@ovl,\if@ovr} +% \DoNotIndex{\@ovttrue,\@ovbtrue,\@ovltrue,\@ovrtrue} +% \DoNotIndex{\@ovtfalse,\@ovbfalse,\@ovlfalse,\@ovrfalse} +% +% \DoNotIndex{\pdfcompresslevel} +% +% \DoNotIndex{\x,\y} +% ^^A \DoNotIndex{} +% +% \newcommand*\BigIndent{\hspace{.2\linewidth}} +% \renewcommand*\floatpagefraction{0.8} +% +% \newcommand*\PS{PostScript} +% \newcommand*\PSTricks{PSTricks} +% \newcommand*\PDF{PDF} +% \newcommand*\SL{Standard \LaTeX} +% ^^A stolen from pictex.tex +% \newcommand*\PiC{P\kern-.12em\lower.5ex\hbox{I}\kern-.075emC} +% \newcommand*\PiCTeX{\PiC\kern-.11em\TeX} +% \newcommand*\teTeX{te\kern-.11em\TeX} +% \newcommand*\TeXlive{\TeX live} +% +% \newenvironment*{ltxquote}{\quote\slshape}{\endquote} +% +% \changes{v0.2k}{2004/03/26}{Better control over funny pagestyle +% while debugging (HjG)} +% \changes{v0.2l}{2004/04/08}{Even better control over funny pagestyle +% while debugging (RN)} +% \ifdeveloping +% \makeatletter +% +% \newcommand*\isodattim{} +% \begingroup +% \count@\time +% \divide\count@ 60 +% \count2=-\count@ +% \multiply\count2 60 +% \advance\count2 \time +% \xdef\isodattim{^^A +% \the\year-\two@digits{\the\month}-\two@digits{\the\day}^^A +% ~\two@digits{\the\count@}:\two@digits{\the\count2}} +% \endgroup +% +% \newcommand*\ps@myfootings{^^A cf. \ps@plain +% \let\@mkboth\@gobbletwo +% \let\@oddhead\@empty +% \let\@evenhead\@empty +% \def\@oddfoot{\reset@font +% \rlap{\textsf{\filename}~\fileversion~\filedate}^^A +% \hfil\thepage\hfil +% \llap{\TeX ed \texttt{\isodattim}}}^^A +% \def\@evenfoot{\reset@font +% \rlap{\TeX ed \texttt{\isodattim}}^^A +% \hfil\thepage\hfil +% \llap{\filedate~\fileversion~\textsf{\filename}}}^^A +% } +% \pagestyle{myfootings} +% \let\pagestyle\@gobble +% \let\thispagestyle\@gobble +% +% \makeatother +% \else +% \makeatletter +% ^^A \ifdim\overfullrule>\z@\else\let\ps@myfootings\ps@plain\fi +% \makeatother +% \fi +% +% \DeleteShortVerb{\|} +% \newcommand*\abs[1]{\ensuremath{|#1|}} +% \MakeShortVerb{\|} +% +% ^^A ======== +% +% \newcommand*\OPOINT{^^A +% \begingroup +% \setlength\unitlength{.8pt}^^A +% \circle{5}^^A +% \endgroup +% } +% \newcommand*\FPOINT{^^A +% \begingroup +% \setlength\unitlength{.8pt}^^A +% \circle*{5}^^A +% \endgroup +% } +% \newcommand*\THICKLINES{\linethickness{1.4pt}} +% \newcommand*\CBEZIER[4]{^^A +% \cbezier(#1)(#2)(#3)(#4)^^A +% \put(#2){\FPOINT}\put(#3){\FPOINT}} +% +% \newcommand*\LINETEST[1][1]{^^A +% \setlength\unitlength{.007\linewidth}^^A +% \begin{minipage}{100\unitlength} +% \ifnum #1>0 \else\OriginalPictureCmds\fi^^A +% \begin{picture}(100,100)^^A (-50,-50)^^A +% \put(0,0){\framebox(100,100){}}^^A +% \linethickness{2.6\unitlength} +% \put(0,0){\line(1,0){50}}^^A +% \put(0,0){\line(2,1){50}}^^A +% \put(0,0){\line(1,1){50}}^^A +% \put(0,0){\line(1,2){50}}^^A +% \put(0,0){\line(0,1){50}}^^A +% \ifnum #1>0 +% \color{red}^^A +% \linethickness{3.8\unitlength}^^A +% \put(50,0){\line(966,259){25}}^^A 15 degrees +% \put(50,0){\line(866,500){25}}^^A 30 degrees +% \put(50,0){\line(707,707){25}}^^A 45 degrees +% \put(50,0){\line(500,866){25}}^^A 60 degrees +% \put(50,0){\line(259,966){25}}^^A 75 degrees +% \normalcolor^^A +% \fi +% \color{blue}^^A +% \thicklines +% \put(50,0){\line(4,2){50}} +% \put(50,0){\line(2,4){50}} +% ^^A \put(50,0){\line(5,5){50}} +% \end{picture}^^A +% \end{minipage} +% } +% +% \newcommand*\VECTORTEST[1][1]{^^A +% \setlength\unitlength{.007\linewidth}^^A +% \begin{minipage}{100\unitlength} +% \ifnum #1>0 \else\OriginalPictureCmds\fi^^A +% \begin{picture}(100,100)(-50,-50)^^A +% \put(-50,-50){\framebox(100,100){}}^^A +% \thinlines +% \put(0,0){\vector(1,0){50}}^^A +% \thicklines +% \put(0,0){\vector(2,1){50}}^^A +% \linethickness{1.4pt}^^A +% \put(0,0){\vector(1,1){50}}^^A +% \linethickness{2.0pt}^^A +% \put(0,0){\vector(1,2){25}}^^A +% \ifnum #1>0 +% \color{red}^^A +% \linethickness{2.6pt}^^A +% \put(0,0){\vector(259,966){13}}^^A 75 degrees +% \linethickness{3.8pt}^^A +% \put(0,0){\vector(-259,966){13}}^^A +% \normalcolor^^A +% \fi +% \linethickness{3.2pt}^^A +% \put(0,0){\vector(0,1){50}}^^A +% \linethickness{4.4pt}^^A +% \put(0,0){\vector(-1,1){50}}^^A +% \linethickness{5.0pt}^^A +% \put(0,0){\vector(-1,-1){50}}^^A +% \linethickness{8.0pt}^^A +% \put(0,0){\vector(1,-1){50}}^^A +% \thicklines^^A +% \thinlines^^A +% \put(1,-30){\line(1,0){10}}^^A +% \put(-1,-30){\line(-1,0){10}}^^A +% \put(0,-30){\vector(0,-1){0}}^^A +% \put(0,-30){\vector(1,1){0}}^^A +% \put(0,-30){\vector(-1,1){0}}^^A +% ^^A \put(0,15){\psline[linecolor=green,linewidth=8.0pt,unit=\unitlength]{->}(50,-50)}^^A +% \end{picture}^^A +% \end{minipage} +% } +% +% \newcommand*\CIRCLETEST[1][1]{^^A +% \setlength\unitlength{.007\linewidth}^^A +% \setlength\fboxsep{0pt} +% \fbox{^^A +% \begin{minipage}{118\unitlength} +% \ifnum #1>0 \else\OriginalPictureCmds\fi^^A +% \begin{picture}(118,60)(-45,-30)^^A +% \linethickness{1.6pt}^^A +% \put(-30,0){\circle{15}}^^A +% \put(-20,0){\circle{20}}^^A +% \put(-10,0){\circle{25}}^^A +% \put(0,0){\circle{30}}^^A +% \put(10,0){\circle{35}}^^A +% \put(20,0){\circle{40}}^^A +% \put(30,0){\circle{45}}^^A +% \put(40,0){\circle{50}}^^A +% \end{picture}^^A +% \par +% \begin{picture}(118,35)(-45,-20)^^A +% \put(-20,0){\circle*{30}}^^A +% \put(-10,0){\circle*{25}}^^A +% \put(0,0){\circle*{20}}^^A +% \put(10,0){\circle*{15}}^^A +% \put(20,0){\circle*{12}}^^A +% \put(30,0){\circle*{9}}^^A +% \put(40,0){\circle*{6}}^^A +% \put(50,0){\circle*{3}}^^A +% \end{picture}^^A +% \end{minipage}} +% } +% +% \newcommand*\OVALTESTi[1][1]{^^A +% \setlength\unitlength{.007\linewidth}^^A +% \begin{minipage}{100\unitlength} +% \ifnum #1>0 \else\OriginalPictureCmds\fi^^A +% \begin{picture}(100,80)^^A +% \put(0,0){\framebox(100,80){}} +% ^^A \linethickness{1\unitlength} +% \thicklines +% ^^A \color{blue}^^A +% \put(55,40){\oval[2](80,70)[r]}^^A +% \put(55,40){\oval[2](65,40)[r]}^^A +% \put(55,40){\oval[2](60,20)[r]}^^A +% \put(55,40){\oval[2](55,15)[r]}^^A +% \put(55,40){\oval[2](50,10)[r]}^^A +% \put(55,40){\oval[2](45,5)[r]}^^A +% \put(55,40){\oval[2](40,2)[r]}^^A +% ^^A \color{black}^^A +% \put(45,40){\oval(80,70)[l]}^^A +% \put(45,40){\oval(65,40)[l]}^^A +% \put(45,40){\oval(60,20)[l]}^^A +% \put(45,40){\oval(55,15)[l]}^^A +% \put(45,40){\oval(50,10)[l]}^^A +% \put(45,40){\oval(45,5)[l]}^^A +% \put(45,40){\oval(40,2)[l]}^^A +% \end{picture}^^A +% \end{minipage} +% } +% +% \newcommand*\OVALTESTii[1]{^^A +% \renewcommand*\maxovalrad{#1}^^A +% \setlength\unitlength{.0060\linewidth}^^A +% \noindent +% \begin{minipage}{155\unitlength} +% \begin{picture}(155,50)^^A +% \put(0,0){\framebox(155,50){}}^^A +% \put(0,0){^^A NE +% \setlength\unitlength{.5\unitlength}^^A +% \begin{picture}(100,100)(-50,-50)^^A +% \put(-50,-50){\framebox(100,100){}}^^A +% \put(0,0){\oval(80,80)}% +% \put(0,0){\makebox(0,0){2.5}}% +% \end{picture}^^A +% }^^A +% \put(55,0){^^A NW +% \setlength\unitlength{.4\unitlength}^^A +% \begin{picture}(100,100)(-50,-50)^^A +% \put(-50,-50){\framebox(100,100){}}^^A +% \put(0,0){\oval(80,80)}% +% \put(0,0){\makebox(0,0){2}}% +% \end{picture}^^A +% }^^A +% \put(100,0){^^A SW +% \setlength\unitlength{.3\unitlength}^^A +% \begin{picture}(100,100)(-50,-50)^^A +% \put(-50,-50){\framebox(100,100){}}^^A +% \put(0,0){\oval(80,80)}% +% \put(0,0){\makebox(0,0){1.5}}% +% \end{picture}^^A +% }^^A +% \put(135,0){^^A SE +% \setlength\unitlength{.2\unitlength}^^A +% \begin{picture}(100,100)(-50,-50)^^A +% \put(-50,-50){\framebox(100,100){}}^^A +% \put(0,0){\oval(80,80)}% +% \put(0,0){\makebox(0,0){1}}% +% \end{picture}^^A +% }^^A +% \end{picture}^^A +% \end{minipage} +% } +% +% \newcommand*\QBEZIERTEST[1][1]{^^A +% \setlength\unitlength{.007\linewidth}^^A +% \begin{minipage}{120\unitlength} +% \ifnum #1>0 \else\OriginalPictureCmds\fi^^A +% \begin{picture}(120,100)^^A +% \put(0,0){\framebox(120,100){}} +% \qbezier[0](10,10)(40,90)(110,90) +% \put(10,10){\FPOINT}\put(40,90){\OPOINT}\put(110,90){\FPOINT} +% \color{green}^^A +% \qbezier[0](10,10)(20,90)(30,10) +% \put(10,10){\FPOINT}\put(20,90){\OPOINT}\put(30,10){\FPOINT} +% \end{picture}^^A +% \end{minipage} +% } +% +% \newcommand*\CBEZIERTEST[1][1]{^^A +% \setlength\unitlength{.01\linewidth}^^A +% \begin{minipage}{80\unitlength} +% \ifnum #1>0 \else\OriginalPictureCmds\fi^^A +% \begin{picture}(80,80)(-40,-40)^^A +% \put(-40,-40){\framebox(80,80){}} +% \cbezier(-10,-10)(-30,30)(30,30)(30,-5) +% \cbezier(30,-5)(30,-30)(0,-35)(-20,-20) +% \put(-10,-10){\FPOINT} +% \put(-30,30){\OPOINT}\put(30,30){\OPOINT} +% \put(30,-5){\FPOINT} +% \put(30,-30){\OPOINT}\put(0,-35){\OPOINT} +% \put(-20,-20){\FPOINT} +% \color{green}^^A +% \cbezier(0,36)(24,36)(24,24)(0,0) +% \cbezier(0,0)(-24,-24)(-24,-36)(0,-36) +% \put(0,36){\FPOINT} +% \put(24,36){\OPOINT}\put(24,24){\OPOINT} +% \put(0,0){\FPOINT} +% \put(-24,-24){\OPOINT}\put(-24,-36){\OPOINT} +% \put(0,-36){\FPOINT} +% \end{picture}^^A +% \end{minipage} +% } +% +% \newcommand*\QCBEZIERTEST[1][1]{^^A +% \setlength\unitlength{.007\linewidth}^^A +% \begin{minipage}{100\unitlength} +% \ifnum #1>0 \else\OriginalPictureCmds\fi^^A +% \begin{picture}(100,120)(-50,-60)^^A +% \put(-50,-60){\framebox(100,120){}} +% \color{green}^^A +% \qbezier[0](-40,-30)(-30,10)(0,10) +% \qbezier[0](0,10)(30,10)(40,50) +% \put(-40,-30){\FPOINT}\put(-30,10){\OPOINT} +% \put(0,10){\FPOINT} +% \put(30,10){\OPOINT}\put(40,50){\FPOINT} +% \color{black}^^A +% \cbezier[0](-40,-50)(-20,30)(20,-50)(40,30) +% \put(-40,-50){\FPOINT}\put(-20,30){\OPOINT} +% \put(20,-50){\OPOINT}\put(40,30){\FPOINT} +% \end{picture}^^A +% \end{minipage} +% } +% +% ^^A ======== +% +% \newcommand*\Acknowledgements{% +% \section*{Acknowledgements} +% We would like to thank Michael Wichura for granting us permission to +% use his implementation of the algorithm for ``pythagorean addition'' +% from his \PiCTeX\ package. +% Thanks go to Michael Vulis (MicroPress) for hints regarding a driver +% for the \textsf{V\TeX} system. +% Walter Schmidt has reviewed the documentation and code, and has +% tested the V\TeX\ driver. +% The members of the ``\TeX-Stamm\-tisch'' in Berlin, Germany, have +% been involved in the development of this package as our guinea pigs, +% i.e., alpha-testers; +% Jens-Uwe Morawski and Herbert Voss have also been helpful with many +% suggestions and discussions. +% Thanks to Claudio Beccari (\texttt{curve2e}) for some macros and testing. +% Thanks to Petr Ol\v{s}\'ak for some macros. +% \par +% Finally we thank the members of The \LaTeX\ Team for taking the time +% to evaluate our new implementation of the picture mode commands, and +% eventually accepting it as the ``official'' \textsf{pict2e} package, +% as well as providing the \texttt{README} file. +% \par +% } +% +% ^^A ======== +% +% \title{The \textsf{pict2e} package\thanks{This document +% corresponds to \textsf{\filename} \fileversion, +% dated \filedate, documentation dated \docdate.}} +% \author{% +% Hubert G\"a{\ss}lein, +% Rolf Niepraschk\thanks{\texttt{Rolf.Niepraschk@gmx.de}} +% \,and +% Josef Tkadlec\thanks{\texttt{j.tkadlec@email.cz}}} +% +% \date{\filedate} +% +% \maketitle +% +% \begin{abstract} +% This package was described in the 2nd edition of ``\LaTeX{}: A +% Document Preparation System'', but the \LaTeX{} project team +% declined to produce the package. +% For a long time, \LaTeX{} has included a ``pict2e package'' +% that merely produced an apologetic error message. +% +% The new package extends the existing \LaTeX{} \texttt{picture} +% environment, using the familiar technique (cf.\ the +% \textsf{graphics} and \textsf{color} packages) of driver +% files. +% In the user-level part of this documentation there is a fair +% number of examples of use, showing where things are improved by +% comparison with the \SL\ \texttt{picture} environment. +% \end{abstract} +% +% \tableofcontents +% +% \listoffigures +% +% \section{Introduction} +% +% Here's a quote from the obsolete original official version of the +% \textsf{pict2e} package (1993--2003): +% \begin{ltxquote} +% The package \textsf{pict2e} that is mentioned in the 2nd edition of +% ``\LaTeX: A Document Preparation System'' has not yet been produced. +% It is unlikely that the \LaTeX3 Project Team will ever produce this +% package thus we would be very happy if someone else creates it. +% \end{ltxquote} +% Finally, +% \marginpar[\hfill\texttt{:-)}]{\texttt{:-)}} +% someone has produced a working implementation of the +% \textsf{pict2e} package. +% +% This package redefines some of the drawing commands of the \LaTeX\ % +% \textsf{picture} environment. +% Like the \textsf{graphics} and \textsf{color} packages, it uses +% driver files. +% +% ^^A Depending on the output format, we use \PS\ or \PDF\ Operators. +% Currently there are only back-ends for \PS\ and \PDF. +% (Other output formats may be added in the future.) +% +% \bigskip ^^A \pagebreak[2] +% \noindent +% Note/Warning: +% \begin{itemize} +% \item Documentation has been written somewhat ``hastily'' and may be +% inaccurate. +% \item +% The status of this package is currently somewhere between ``beta'' +% and ``release'' \dots\ +% Users and package programmers should \emph{not} rely on +% \emph{any} feature sported by the internal commands. +% (Especially, the internal control sequence names may change without +% notice in future versions of this package.) +% \end{itemize} +% +% \section{Usage} +% +% To use the \textsf{pict2e} package, you put a +% |\usepackage|\linebreak[0]\oarg{optionlist}\linebreak[0]|{pict2e}| +% instruction in the preamble of your document. +% Likewise, class or package writers just say +% |\RequirePackage|\linebreak[0]\oarg{optionlist}\linebreak[0]|{pict2e}| +% in an appropriate place in their class or package file. +% (Nothing unusual here.) +% +% \noindent +% Like the \textsf{graphics} and \textsf{color} packages, the +% \textsf{pict2e} package supports a +% configuration file (see Section~\ref{sec:cfg-file}). +% +% \subsection{Package options} +% +% \subsubsection{Driver options} +% +% \begin{minipage}{.5\textwidth} +% \begin{tabular}{@{}lc@{\qquad\qquad}lc@{}} +% driver & notes & driver & notes\\ \hline +% dvips & x & oztex & (x) \\ +% xdvi & x & dvipsone & x? \\ +% pdftex & x & dviwindo & x? \\ +% vtex & x & dvipdf & x? \\ +% dvipdfm & x & textures & x? \\ +% dvipdfmx& x & pctexps & x? \\ +% xetex & x & pctex32 & x? \\ +% luatex ($>0.85$) & x & ~ & ~ \\ \hline +% ^^A emtex & -- +% \end{tabular} +% +% \smallskip +% \noindent x\,=\,supported; (x)\,=\,supported but untested; \par +% \noindent x?\,=\,not yet implemented +% ^^A --\,=\,unlikely to be ever supported +% \end{minipage} +% +% \smallskip +% The driver options are (mostly) implemented by means of definition +% files (|p2e-|\meta{driver}\linebreak[0]|.def|). +% For details, see file \texttt{p2e-drivers.dtx}. +% +% \begin{em} +% Note: +% You should specify the same driver for \textsf{pict2e} you use with +% the \textsf{graphics/x} and \textsf{color} packages. +% Otherwise, things may go haywire. +% \par +% \end{em} +% +% \subsubsection{Other options} +% +% Currently, there are two options that allow you to choose between +% variants of the arrows-heads generated by the \cmd{\vector} +% command. +% See Figure~\ref{fig:vector:comparison} +% in Section~\ref{sec:usage:vector} for the difference. +% +% \noindent +% \begin{tabular}{@{}lp{.7\textwidth}@{}} +% option & meaning \\ +% \hline +% ltxarrows & Draw \LaTeX\ style vectors (default). \\ +% pstarrows & Draw \PSTricks\ style vectors. \\ +% \hline +% \end{tabular} +% +% \subsubsection{Debugging options} +% +% These options are (mainly) for development and testing purposes. +% +% \noindent +% \begin{tabular}{@{}lp{.7\textwidth}@{}} +% option & meaning \\ +% \hline +% original & Suppresses the new definitions. \\ +% debug & Suppresses the compressing of pdf\TeX\ output; +% marks the \textsf{pict2e} generated code in the output +% files. \\ +% hide & Suppresses all graphics output from \textsf{pict2e}. \\ +% \hline +% \end{tabular} +% +% \subsection{Configuration file} +% \label{sec:cfg-file} +% +% Similar to the \textsf{graphics} and \textsf{color} packages, +% in most cases it is not necessary to give a driver option explicitly +% with the \cmd{\usepackage} (or \cmd{\RequirePackage}) command, +% if a suitable configuration file \texttt{pict2e.cfg} is present on your +% system (see the example file \texttt{pict2e-example.cfg}). +% On many systems it may be sufficient to copy +% \texttt{pict2e-example.cfg} to \texttt{pict2e.cfg}; +% on others you might need to modify your copy to suit your system. +% +% \subsection{Details: Changes to user-level commands} +% +% This section describes the improvements of the new implementation of +% (some of) the \texttt{picture} commands. +% For details, look up ``\texttt{pict2e} package'' in the index of the +% \LaTeX\ manual~\cite{LAMPORT}. +% +% Here's a collection of quotes relevant to the \textsf{pict2e} package +% from the \LaTeX\ manual~\cite{LAMPORT}. +% +% ^^A Indicate Chapter/Section with these quotes ??? +% +% From \cite[p.~118]{LAMPORT}: +% \begin{ltxquote} +% However, the \texttt{pict2e} package uses device-driver support to +% provide enhanced versions of these commands that remove some of +% their restrictions. +% The enhanced commands can draw straight lines and arrows of any +% slope, circles of any size, and lines (straight and curved) of any +% thickness. +% \end{ltxquote} +% +% From \cite[p.~179]{LAMPORT}: +% \begin{ltxquote} +% \begin{description} +% \item[\texttt{pict2e}] +% Defines enhanced versions of the \texttt{picture} environment +% commands that remove restrictions on the line slope, circle +% radius, and line thickness. +% \end{description} +% \end{ltxquote} +% +% From \cite[pp.~221--223]{LAMPORT}: +% \begin{ltxquote} +% \begin{description} +% \item[\cmd{\qbezier}]\mbox{}\\ +% (With the \texttt{pict2e} package, there is no limit to the +% number of points plotted.) +% \item[\cmd{\line}\textrm{ and }\cmd{\vector}] +% Slopes $\abs x,\abs y \le 6 \mbox{ or } 4$, with no common +% divisor except $\pm1$:\\ +% (These restrictions are eliminated by the \texttt{pict2e} +% package.) +% \item[\cmd{\line}\textrm{ and }\cmd{\vector}] +% Smallest horizontal extent of sloped lines and vectors that can +% be drawn:\\ +% (This does not apply when the \texttt{pict2e} package is +% loaded.) +% \item[\cmd{\circle}\textrm{ and }\cmd{\circle*}] +% Largest circles and disks that can be drawn:\\ +% (With the \texttt{pict2e} package, any size circle or disk can +% be drawn.) +% \item[\cmd{\oval}] +% \oarg{rad}:\\ +% An explicit \emph{rad} argument can be used only with the +% \texttt{pict2e} package; the default value is the radius of the +% largest quarter-circle \LaTeX\ can draw without the +% \texttt{pict2e} package. +% \end{description} +% \end{ltxquote} +% +% \subsubsection{Line} +% \label{sec:usage:line} +% +% \DescribeMacro\line +% |\line|\parg{X,Y}\marg{LEN}\\ +% In the \SL\ implementation the slope arguments \parg{X,Y} are +% restricted to integers in the range $-6 \le X,Y \le +6$, with no +% common divisors except $\pm 1$. +% (I.e., $X$ and $Y$ must be relatively prime.) +% Furthermore, only horizontal and vertical lines can assume arbitrary +% thickness; +% sloped lines are restricted to the widths given by +% the |\thinlines| and |\thicklines| declarations +% (i.e., 0.4pt and 0.8pt, respectively). +% +% From \cite[p.~222]{LAMPORT}: +% \begin{ltxquote} +% These restrictions are eliminated by the \texttt{pict2e} package. +% \end{ltxquote} +% +% However, to avoid overflow of \TeX's dimens, the slope arguments are real +% numbers in the range $-16383 \le X,Y \le +16383$. It is usually not a good +% idea to use slope arguments with the absolute value less then $10^{-4}$ +% (the best accuracy is obtained if you use multiples of arguments such that +% you eliminate as much decimal parts as possible). The slope greater then +% 16384 cannot be obtained. +% ^^A ??? +% +% Furthermore, unlike the \SL\ implementation, which silently converts +% the ``impossible'' slope to a vertical line extending in the upward +% direction ($(0,0) \mapsto (0,1)$), the \textsf{pict2e} package now +% treats this as an error. +% ^^A ??? +% +% In the \SL\ implementation the horizontal extent of sloped lines +% must be at least 10\,pt. +% ^^A exactly or approximately ??? +% +% From \cite[p.~222]{LAMPORT}: +% \begin{ltxquote} +% This does not apply when the \texttt{pict2e} package is loaded. +% \end{ltxquote} +% +% Figure~\ref{fig:line} shows the difference between the old and new +% implementations: +% The black lines in the left half of each picture all have slopes +% that conform to the restrictions of \SL. +% However, with the new implementation of \textsf{pict2e} sloped lines +% may assume any arbitrary width given by the |\linethickness| +% declaration. +% The right half demonstrates that now arbitrary slopes are possible. +% +% The blue lines represent ``illegal'' slopes specifications, +% i.e., with common divisors. +% Note the funny effect \SL\ produces in such cases. +% (In \LaTeX\ releases prior to 2003/12/01, +% some such ``illegal'' slopes might even lead to infinite loops! +% Cf.\ problem report latex/3570.) +% +% The new implementation imposes no restriction with respect to line +% thickness, minimal horizontal extent, and slope. +% +% The red lines correspond to angles of \(15^\circ\), \(30^\circ\), +% \(45^\circ\), \(60^\circ\), and \(75^\circ\), respectively. +% This was achieved by multiplying the sine and cosine of each angle +% by 1000 and rounding to the nearest integer, like this: +%\begin{verbatim} +% \put(50,0){\line(966,259){25}} +% \put(50,0){\line(866,500){25}} +% \put(50,0){\line(707,707){25}} +% \put(50,0){\line(500,866){25}} +% \put(50,0){\line(259,966){25}} +%\end{verbatim} +% +% \begin{figure} +% \noindent +% \begin{tabular} +% {@{}>{\centering}p{.5\textwidth}@{} +% >{\centering}p{.5\textwidth}@{}} +% \textbf{Original Commands} & \textbf{New Commands} \tabularnewline[1ex] +% \LINETEST[0] & \LINETEST +% \end{tabular} +% \caption{Line} +% \label{fig:line} +% \end{figure} +% +% \subsubsection{Vector} +% \label{sec:usage:vector} +% +% \DescribeMacro\vector +% |\vector|\parg{X,Y}\marg{LEN}\\ +% In the \SL\ implementation the slope arguments \parg{X,Y} are +% restricted to integers in the range $-4 \le X,Y \le +4$, with no +% common divisors except $\pm 1$. +% (I.e., $X$ and $Y$ must be relatively prime.) +% Furthermore, arrow heads come only in two shapes, corresponding to +% the |\thinlines| and |\thicklines| declarations. +% (There's also a flaw: the lines will be printed over the arrow +% heads. +% ^^A pr/??? +% See vertical vector in Figure~\ref{fig:vector}.) +% +% From \cite[p.~222]{LAMPORT}: +% \begin{ltxquote} +% These restrictions are eliminated by the \texttt{pict2e} package. +% \end{ltxquote} +% +% However, to avoid overflow of \TeX's dimen arithmetic, the current +% implementation restricts the slope arguments to real numbers in the range +% $-1000 \le X,Y \le +1000$, which should be enough. It is usually not a good +% idea to use slope arguments with the absolute value less then $10^{-4}$ (the +% best accuracy is obtained if you use multiples of arguments such that you +% eliminate as much decimal parts as possible). The slope greater then 16384 +% cannot be obtained. +% ^^A ??? +% +% Furthermore, unlike the \SL\ implementation, which silently converts +% the ``impossible'' slope to a vertical vector extending in the upward +% direction ($(0,0) \mapsto (0,1)$), the \textsf{pict2e} package now +% treats this as an error. +% ^^A ??? +% +% In the \SL\ implementation the horizontal extent of sloped vectors +% must be at least 10\,pt. +% ^^A exactly or approximately ??? +% +% From \cite[p.~222]{LAMPORT}: +% \begin{ltxquote} +% This does not apply when the \texttt{pict2e} package is loaded. +% \end{ltxquote} +% +% Figure~\ref{fig:vector} shows the difference between the old and new +% implementations: +% The black arrows all have ``legal'' slopes. +% The red arrows have slope arguments out of the range permitted by \SL. +% Slope arguments that are ``illegal'' in \SL\ produce results similar +% to those with the \cmd{\line} command (this has not been +% demonstrated here). +% +% The new implementation imposes no restriction with respect to line +% thickness, minimal horizontal extent, and slope. +% +% As with \SL, the arrow head will always be drawn. +% In particular, only the arrow head will be drawn, if the total length +% of the arrow is less than the length of the arrow head. +% ^^A \SL: only if =0 ??? +% See right hand side of Figure~\ref{fig:vector:comparison}. +% +% \begin{figure} +% \noindent +% \begin{tabular} +% {@{}>{\centering}p{.5\textwidth}@{} +% >{\centering}p{.5\textwidth}@{}} +% \textbf{Original Commands} & \textbf{New Commands} \tabularnewline[1ex] +% \VECTORTEST[0] & \VECTORTEST[1] +% \end{tabular} +% \caption{Vector} +% \label{fig:vector} +% \end{figure} +% +% The current version of the \textsf{pict2e} package offers two +% variants for the shape of the arrow heads, controlled by package +% options. +% One variant tries to mimic the fonts used in the \SL\ +% implementation (package option \textsf{ltxarrows}, the default; +% see Figure~\ref{fig:vector:comparison}, top row), +% though it is difficult to extrapolate from just two design sizes. +% The other one is implemented like the arrows of the \PSTricks\ +% package~\cite{PSTRICKS} (package option \textsf{pstarrows}; +% see Figure~\ref{fig:vector:comparison}, bottom row). +% ^^A See Figure~\ref{fig:vector:comparison}. +% +% \begin{figure} +% \setlength\unitlength{.004\linewidth}^^A +% \centering +% \begin{picture}(200,100) +% \put(0,0){\framebox(200,100){}} +% \linethickness{12\unitlength} +% \makeatletter \let\pIIe@vector=\pIIe@vector@pst \makeatother +% \put(15,25){\vector(1,0){100}} +% \put(185,25){\vector(1,0){0}} +% \makeatletter \let\pIIe@vector=\pIIe@vector@ltx \makeatother +% \put(15,75){\vector(1,0){100}} +% \put(185,75){\vector(1,0){0}} +% \end{picture} +% \caption[Vector: shape variants of the arrow-heads]% +% {Vector: shape variants of the arrow-heads. +% Top: \LaTeX\ style vectors. +% Bottom: \PSTricks\ style vectors.} +% \label{fig:vector:comparison} +% \end{figure} +% +% \subsubsection{Circle and Dot} +% \label{sec:usage:circle+dot} +% +% \DescribeMacro\circle +% \DescribeMacro{\circle*} +% |\circle|\marg{DIAM}\\ +% |\circle*|\marg{DIAM}\\ +% The (hollow) circles and disks (filled circles) of the \SL\ ^^A +% implementation had severe restrictions on the number of different +% diameters and maximum diameters available. +% +% From \cite[p.~222]{LAMPORT}: +% \begin{ltxquote} +% With the \texttt{pict2e} package, any size circle or disk can be +% drawn. +% \end{ltxquote} +% +% \noindent +% With the new implementation there are no more restrictions to the +% diameter argument. +% (However, negative +% ^^A or zero +% diameters are now trapped as an error.) +% +% Furthermore, hollow circles (like sloped lines) can now be drawn +% with any line thickness. +% Figure~\ref{fig:circle-dot} shows the difference. +% +% \begin{figure} +% \noindent +% \begin{tabular} +% {@{}>{\centering}p{.5\textwidth}@{} +% >{\centering}p{.5\textwidth}@{}} +% \textbf{Original Commands} & \textbf{New Commands} \tabularnewline[1ex] +% \CIRCLETEST[0] & \CIRCLETEST +% \end{tabular} +% \caption{Circle and Dot} +% \label{fig:circle-dot} +% \end{figure} +% +% \subsubsection{Oval} +% \label{sec:usage:oval} +% +% \DescribeMacro\oval +% |\oval|\oarg{rad}\parg{X,Y}\oarg{POS}\\ +% In the \SL\ implementation, the user has no control over the shape +% of an oval besides its size, since its corners would always consist +% of the ``quarter circles of the largest possible radius less than or +% equal to \emph{rad}''~\cite[p.~223]{LAMPORT}. +% +% From \cite[p.~223]{LAMPORT}: +% \begin{ltxquote} +% An explicit \emph{rad} argument can be used only with the +% \texttt{pict2e} package; the default value is the radius of the +% largest quarter-circle \LaTeX\ can draw without the \texttt{pict2e} +% package. +% \end{ltxquote} +% +% This default value is 20\,pt, a length. +% However, in an early reimplementation of the picture +% commands~\cite{PSPICTURE}, there is such an optional argument too, +% but it is given as a mere number, to be multiplied by |\unitlength|. +% +% Since both alternatives may make sense, we left the choice to the +% user. +% \ (See Figure~\ref{fig:oval:rad:2} for the differences.) \ ^^A +% I.e., this implementation of \cmd{\oval} will ``auto-detect'' +% whether its \oarg{rad} argument is a length or a number. +% \DescribeMacro\maxovalrad +% Furthermore, the default value is not hard-wired either; +% the user may access it under the moniker \cmd{\maxovalrad}, +% by the means of \cmd{\renewcommand*}. +% (Names or values of length and counter registers may be given as +% well, both as an explicit \oarg{rad} argument and when redefining +% \cmd{\maxovalrad}.) +% +% (Both \oarg{rad} and the default value \cmd{\maxovalrad} are ignored +% in ``standard \LaTeX\ mode''). +% +% The behaviour of |\oval| in the absence of the \oarg{rad} argument +% is shown in Figure~\ref{fig:oval:rad:1}, left half of each picture. +% Note that in the \SL\ implementation there is a minimum radius as +% well (innermost ``salami'' is ``broken''). +% In the right half of each picture, a \oarg{rad} argument has been +% used: it has no effect with the original |\oval| command. +% +% \begin{figure} +% \noindent +% \begin{tabular} +% {@{}>{\centering}p{.5\textwidth}@{} +% >{\centering}p{.5\textwidth}@{}} +% \textbf{Original Commands} & \textbf{New Commands}\tabularnewline[1ex] +% \OVALTESTi[0] & \OVALTESTi +% \end{tabular} +% \caption{Oval: Radius argument for \cmd{\oval} vs.\ \cmd{\maxovalrad}} +% \label{fig:oval:rad:1} +% \end{figure} +% +% Both \oarg{rad} and \cmd{\maxovalrad} may be given as an explicit +% (rigid) length (i.e., with unit) or as a number. +% In the latter case the value is used as a factor to multiply by +% \cmd{\unitlength}. +% \ (A length or counter register will do as well, of course.) +% +% If a number is given, the rounded corners of an oval will scale +% according to the current value of \cmd{\unitlength}. +% (See Figure~\ref{fig:oval:rad:2}, first row.) +% +% If a length is specified, the rounded corners of an oval will be the +% same regardless of the current value of \cmd{\unitlength}. +% (See Figure~\ref{fig:oval:rad:2}, second row.) +% +% The default value is 20\,pt as specified for the \oarg{rad} +% argument of \cmd{\oval} by the \LaTeX\ manual \cite[p.~223]{LAMPORT}. +% (See Figure~\ref{fig:oval:rad:2}, third row.) +% +% \bigskip +% +% \begin{figure} +% \centering +% \noindent +% \begin{tabular}{@{}c@{}} +% \textbf{Original Commands}, +% \oarg{rad} or \cmd{\maxovalrad} ignored\\[1ex] +% \OriginalPictureCmds\OVALTESTii{0}\tabularnewline[1ex]\tabularnewline +% \textbf{New Commands}, +% \oarg{rad} or \cmd{\maxovalrad} depends on \cmd{\unitlength}\\[1ex] +% \OVALTESTii{20}\tabularnewline[1ex]\tabularnewline +% \textbf{New Commands}, +% \oarg{rad} or \cmd{\maxovalrad} a fixed length\\[1ex] +% \OVALTESTii{10.44pt} +% \end{tabular} +% \caption[Oval: Radius argument for \cmd{\oval}: length vs.\ number]% +% {Oval: Radius argument for \cmd{\oval}: length vs.\ number. +% The number at the centre of each oval gives the relative value of +% \texttt{\char`\\unitlength}.} +% \label{fig:oval:rad:2} +% \end{figure} +% +% \subsubsection{Bezier Curves} +% \label{sec:usage:bezier-curves} +% +% \DescribeMacro\bezier +% \DescribeMacro\qbezier +% \DescribeMacro\cbezier +% \DescribeMacro\qbeziermax +% |\bezier|\marg{N}\parg{AX,AY}\parg{BX,BY}\parg{CX,CY}\\ +% |\qbezier|\oarg{N}\parg{AX,AY}\parg{BX,BY}\parg{CX,CY}\\ +% |\cbezier|\oarg{N}\parg{AX,AY}\parg{BX,BY}\parg{CX,CY}\parg{DX,DY}\\ +% In \SL, the \emph{N} argument specifies the number of points to +% plot: $N+1$ for a positive integer $N$, appropriate number +% (at most \cmd{\qbeziermax}) for $N=0$ or if +% the optional argument is missing. +% With \LaTeX\ versions prior to 2003/12/01, the quadratic Bezier +% curves plotted by this package will not match those of the \SL\ +% implementation exactly, due to a bug in positioning the dots used to +% produce a curve (cf.~latex/3566). +% +% \cmd{\bezier} is the obsolescent variant from the old +% \textsf{bezier} package of vintage \LaTeX2.09. +% +% The |\cbezier| command draws a cubic Bezier curve; +% see~\cite{EBEZIER}. +% (This is not mentioned in \cite{LAMPORT} and has been added to the +% package deliberately.) +% +% From \cite[p.~221--223]{LAMPORT}: +% \begin{ltxquote} +% With the \texttt{pict2e} package, there is no limit to the number +% of points plotted. +% \end{ltxquote} +% +% \noindent +% More accurately, if the optional argument is absent or is 0, +% the \textsf{pict2e} package uses primitive operators of the +% output (back-end) format to draw a full curve. +% +% \begin{figure} +% \noindent +% \begin{tabular} +% {@{}>{\centering}p{.5\textwidth}@{} +% >{\centering}p{.5\textwidth}@{}} +% \textbf{Original Commands} & \textbf{New Commands} \tabularnewline[1ex] +% \QBEZIERTEST[0] & \QBEZIERTEST +% \end{tabular} +% \caption{Quadratic Bezier curves} +% \label{fig:qbezier2} +% \end{figure} +% +% \begin{figure} +% \noindent +% \begin{tabular} +% {@{}>{\centering}p{.5\textwidth}@{} +% >{\centering}p{.5\textwidth}@{}} +% \textbf{Original Commands} & \textbf{New Commands} \tabularnewline[1ex] +% \IfFileExists{ebezier.sty}{\CBEZIERTEST[0]}{% +% \begin{slshape}^^A +% Note: +% Since the \textsf{ebezier} package is not installed on your system, +% the `original' \cmd{\cbezier} command can't be used here.\par +% \end{slshape}} & \CBEZIERTEST +% \end{tabular} +% \caption{Cubic Bezier curves} +% \label{fig:cbezier} +% \end{figure} +% +% \begin{figure} +% \noindent +% \begin{tabular} +% {@{}>{\centering}p{.5\textwidth}@{} +% >{\centering}p{.5\textwidth}@{}} +% \textbf{Original Commands} & \textbf{New Commands} \tabularnewline[1ex] +% \IfFileExists{ebezier.sty}{\QCBEZIERTEST[0]}{% +% \begin{slshape}^^A +% Note: +% Since the \textsf{ebezier} package is not installed on your system, +% the `original' \cmd{\cbezier} command can't be used here.\par +% \end{slshape}} & \QCBEZIERTEST +% \end{tabular} +% \caption{Quadratic (green) and Cubic Bezier curves} +% \label{fig:qcbezier} +% \end{figure} +% +% \subsection{Extensions} +% +% This section desribe new commands that extend the possibilities of the +% \texttt{picture} environment. It is not our aim to create a powerful +% collection of macros (like \texttt{pstricks} or \texttt{tikz}). The main goal +% of this package is to eliminate the limitations of the standard +% \texttt{picture} commands. But this is done by \PS\ and \PDF\ operators +% that might be easily used for user-level commands and hence significantly +% improve the drawing possibilities. +% +% \subsubsection{Circle arcs} +% \label{sec:usage:circle-arcs} +% +% \DescribeMacro\arc +% \DescribeMacro{\arc*} +% |\arc|\oarg{ANGLE1,ANGLE2}\marg{RAD}\\ +% |\arc*|\oarg{ANGLE1,ANGLE2}\marg{RAD}\\ +% These commands are generalizations of \cmd{\circle} and \cmd{\circle*} +% commands except that the radius instead of the diameter is given. The +% optional argument is a comma separated pair of angles given in degrees +% (implicit value is $[0,360]$). The arc starts at the point given by +% $ANGLE1$. If $ANGLE2$ is greater than $ANGLE1$ the arc is drawn in the +% positive orientation (anticlockwise), if the $ANGLE2$ is smaller than +% $ANGLE1$ the arc is drawn in the negative orientation (clockwise). The angle +% of the arc is the absolute value the difference of $ANGLE1$ and $ANGLE2$. +% Hence the pair $[-10,80]$ gives the same arc as $[80,-10]$ (a quarter of a +% circle) while the pairs $[80,350]$ and $[350,80]$ give the complementary +% arc. +% +% In fact, the arc is approximated by cubic Bezier curves with an inaccuracy +% smaller than 0.0003 (it seems to be sufficiently good). +% +% If \cmd{\squarecap} is active then \cmd{\arc\marg{RAD}} produces a circle +% with a square. +% +% An equivalent \cmd{\pIIearc} to \cmd{\arc} is defined to solve possible +% conflicts with other packages. +% +% \subsubsection{Lines, polygons} +% \label{sec:usage:lines+polygons} +% +% \DescribeMacro\Line +% \DescribeMacro\polyline +% \DescribeMacro\polygon +% \DescribeMacro{\polygon*} +% |\Line|\parg{X1,Y1}\parg{X2,Y2}\\ +% |\polyline|\parg{X1,Y1}\parg{X2,Y2}\dots\parg{Xn,Yn}\\ +% |\polygon|\parg{X1,Y1}\parg{X2,Y2}\dots\parg{Xn,Yn}\\ +% |\polygon*|\parg{X1,Y1}\parg{X2,Y2}\dots\parg{Xn,Yn}\\ +% A natural way how to describe a line segment is to give the coordinates of +% the endpoints. The syntax of the \cmd{\line} is different because +% the lines in the standard \texttt{picture} environment are made from small +% line segments of a limited number of slopes given in a font. However, this +% package changes the \cmd{\line} command computing the coordinates of the +% endpoints and using an internal macro for drawing a line segment with given +% endpoints. Hence it would be crazy do not use this possibility directly. +% This is done by the command \cmd{\Line}. The command \cmd{\polyline} draws a +% stroken line connecting points with given coordinates. The command +% \cmd{\polygon} draws a polygon with given vertices, the star variant gives +% filled polygon. At least two points should be given. +% +% These command need not be used within a \cmd{\put} command (if the +% coordinates are absolute). +% +% \subsubsection{Path commands} +% \label{sec:usage:path-commands} +% +% \DescribeMacro\moveto +% \DescribeMacro\lineto +% \DescribeMacro\curveto +% \DescribeMacro\circlearc +% |\moveto|\parg{X,Y}\\ +% |\lineto|\parg{X,Y}\\ +% |\curveto|\parg{X2,Y2}\parg{X3,Y3}\parg{X4,Y4}\\ +% |\circlearc|\oarg{N}\marg{X}\marg{Y}\marg{RAD}\marg{ANGLE1}\marg{ANGLE2}\\ +% These commands directly correspond to the \PS\ and \PDF\ path operators. You +% start defining a path giving its initial point by \cmd{\moveto}. Then you +% can consecutively add a line segment to a given point by \cmd{\lineto}, a +% cubic Bezier curve by \cmd{\curveto} (two control points and the endpoint +% are given) or an arc by \cmd{\circlearc} (mandatory parameters are +% coordinates of the center, radius, initial and final angle). +% +% Drawing arcs is a bit more complicated. There is a special operator only in +% \PS\ (not in \PDF) but also in \PS\ it is approximated by cubic Bezier +% curves. Here we use common definition for \PS\ and \PDF. The arc is drawn +% such that the initial point given by the initial angle is rotated by +% $ANGLE2-ANGLE1$ (anticlockwise for positive value and clockwise for negative +% value) after reducing this difference to the interval $[-720, 720]$. +% Implicitely (the optional parameter $N=0$) before drawing an arc a +% \cmd{\lineto} to the initial point of the arc is added. For $N=1$ +% \cmd{\moveto} instead of \cmd{\lineto} is executed---it is useful if you +% start the path by an arc and do not want to compute and set the initial +% point. For $N=2$ the \cmd{\lineto} before drawing the arc is omitted---it +% leads to a bit shorter code for the path but you should be sure that the +% already defined part of the path ends precisely at the initial point of the +% arc. +% +% \DescribeMacro\closepath +% \DescribeMacro\strokepath +% \DescribeMacro\fillpath +% The command \cmd{\closepath} is equivalent to \cmd{\lineto} to the initial +% point of the path. After defining paths you might use either +% \cmd{\strokepath} to draw them or, for closed paths, \cmd{\fillpath} to draw +% an area bounded by them. +% +% The path construction need not be used within a \cmd{\put} command (if the +% coordinates are absolute). +% +% \subsubsection{Ends of paths, joins of subpaths} +% \label{sec:usage:ends-joins} +% +% \DescribeMacro\buttcap +% \DescribeMacro\roundcap +% \DescribeMacro\squarecap +% The shape of ends of paths is controlled by the following commands: +% \cmd{\buttcap} (implicit) define the end as a line segment, \cmd{\roundcap} +% adds a halfdisc, \cmd{\squarecap} adds a halfsquare. While \cmd{\squarecap} +% is ignored for the path with zero length, \cmd{\roundcap} places a disc to +% the given point. These commands do not apply to \cmd{\vector} and to +% closed paths (\cmd{\circle}, full \cmd{\oval}, +% parameter, path constructions ended by \cmd{\closepath}). +% +% \DescribeMacro\miterjoin +% \DescribeMacro\roundjoin +% \DescribeMacro\beveljoin +% The shape of joins of subpaths is controlled by the following commands: +% \cmd{\miterjoin} (implicit) might be defined in such a way that +% ``boundaries'' of subpaths are prolonged until they intersect (it might be a +% rather long distance for lines with a small angle between them); +% \cmd{\roundjoin} corresponds to \cmd{\roundcap} for both subpaths; +% \cmd{\beveljoin} adds a convex hull of terminal line segments of both +% subpaths. +% +% \StopEventually{^^A +% \Acknowledgements +% ^^A \typeout{!!! +% ^^A \ifx\Finale\relax \string\OnlyDescription +% ^^A \else \string\AlsoImplementation \fi}^^A +% ^^A Dirty Hack: +% \ifx\Finale\relax ^^A \OnlyDescription +% \begin{thebibliography}{9} +% \raggedright +% +% \bibitem{LAMPORT} Leslie Lamport: \textit{\LaTeX\ -- A Document +% Preparation System}, 2nd ed., 1994 +% +% \bibitem{PSTRICKS} Timothy Van Zandt: \textit{The pstricks bundle.} +% \texttt{CTAN:~graphics/pstricks/}, 1993, 1994, 2000 +% +% \bibitem{PSPICTURE} David Carlisle: \textit{The pspicture package.} +% \texttt{CTAN:~macros/latex/contrib/carlisle/}, 1992 +% +% \bibitem{EBEZIER} Gerhard A. Bachmaier: \textit{The ebezier package.} +% \texttt{CTAN:~macros/latex/contrib/ebezier/}, 2002 +% +% \end{thebibliography}^^A +%\else ^^A \AlsoImplementation +% \begin{thebibliography}{9} +% \raggedright +% +% \bibitem{LAMPORT} Leslie Lamport: \textit{\LaTeX\ -- A Document +% Preparation System}, 2nd ed., 1994 +% +% \bibitem{COMPANION} Michel Goossens, Frank Mittelbach, Alexander +% Samarin: \textit{The \LaTeX\ Companion}, 1993 +% +% \bibitem{EBEZIER} Gerhard A. Bachmaier: \textit{The ebezier package.} +% \texttt{CTAN:~macros/latex/contrib/ebezier/}, 2002 +% +% \bibitem{PICTEX} Michael Wichura: \textit{The PiC\TeX\ package.} +% \texttt{CTAN:~graphics/pictex}, 1987 +% +% \bibitem{PSPICTURE} David Carlisle: \textit{The pspicture package.} +% \texttt{CTAN:~macros/latex/contrib/carlisle/}, 1992 +% +% \bibitem{TRIG} David Carlisle: \textit{The trig package.} +% \texttt{CTAN:~macros/latex/required/graphics/}, 1999 +% +% \bibitem{PSPIC} Kresten Krab Thorup: \textit{The pspic package.} +% \texttt{CTAN:~macros/latex209/contrib/misc/}, 1991 +% +% \bibitem{PSTRICKS} Timothy Van Zandt: \textit{The pstricks bundle.} +% \texttt{CTAN:~graphics/pstricks/}, 1993, 1994, 2000 +% +% ^^A Wichura@Galton.Uchicago.EDU +% +% \end{thebibliography} +% +% \PrintChanges +% \PrintIndex +% +%\fi +% } ^^A \StopEventually +% +% ^^A +% \clearpage +% +% \section{Implementation} +% +% ^^A cite some of these packages !!! ??? +% Unlike other packages that have reimplemented or extended some of +% the commands from \SL's \texttt{picture} environment, +% we do not use special fonts, +% nor draw arbitrary shapes by the means of myriads of small (point) +% characters, +% nor do we use sophisticated programming in some back-end +% programming language. +% +% In its present state, this implementation supports just \PS\ and +% \PDF\ as back-end formats. +% It just calculates the necessary control points and uses primitive +% path drawing operators. +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \subsection{Initialisation} +% +% \begin{macro}{\Gin@codes} +% First we save the catcodes of some characters, and set them to +% fixed values whilst this file is being read. +% \changes{v0.2o}{2004/06/25} +% {Save and restore catcodes (HjG)} +% (This is done in almost the same manner as in the \textsf{graphics} +% and \textsf{color} packages. Alas, we don't need nor want to have +% |*| as part of control sequence names, so we omit it here.) +% \begin{macrocode} +\edef\Gin@codes{% + \catcode`\noexpand\^^A\the\catcode`\^^A\relax + \catcode`\noexpand\"\the\catcode`\"\relax +% \catcode`\noexpand\*\the\catcode`\*\relax + \catcode`\noexpand\!\the\catcode`\!\relax + \catcode`\noexpand\:\the\catcode`\:\relax} +% \end{macrocode} +% +% \begin{macrocode} +\catcode`\^^A=\catcode`\% +\@makeother\"% +% \catcode`\*=11 +\@makeother\!% +\@makeother\:% +% \end{macrocode} +% \end{macro} +% +% \subsection{Preliminaries} +% +% \begin{macro}{\pIIe@mode} +% \begin{macro}{\pIIe@code} +% \begin{macro}{\Gin@driver} +% The first two of these commands determine how the \textsf{pict2e} +% package works internally; +% they should be defined properly by the +% |p2e-|\meta{driver}\linebreak[0]|.def| +% files. +% (See file \texttt{p2e-drivers.dtx} for details and sample +% implementations.) +% +% The latter command is well known from the \textsf{graphics} and +% \textsf{color} packages from the \SL\ graphics bundle; +% it should be set by a package option---most likely in a (system +% dependent) configuration file \texttt{pict2e.cfg}. +% (File \texttt{p2e-drivers.dtx} contains an example configuration +% file suitable for the \teTeX\ and \TeXlive\ distributions; +% it will be extracted as \texttt{pict2e-example.cfg}.) +% \begin{macrocode} +\newcommand*\pIIe@mode{-1} +\newcommand*\pIIe@code[1]{} +\providecommand*\Gin@driver{} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\pIIe@tempa} +% \begin{macro}{\pIIe@tempb} +% \begin{macro}{\pIIe@tempc} +% At times, we need some temporary storage bins. +% However, we only use some macros and do not allocate any new +% registers; the ``superfluous'' ones from the picture module of the +% kernel (|ltpictur.dtx|) and the general scratch registers should +% suffice. +% ^^A (This leads to somewhat vulnerable code below!) +% \begin{macrocode} +\newcommand*\pIIe@tempa{} +\newcommand*\pIIe@tempb{} +\newcommand*\pIIe@tempc{} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Option processing} +% +% The driver options are not much of a surprise: +% they are similar to those of the \textsf{graphics} and +% \textsf{color} packages. +% \changes{v0.3b}{2016/02/05}{New option `luatex' (RN)} +% \begin{macrocode} +\DeclareOption{dvips}{\def\Gin@driver{dvips.def}} +\DeclareOption{xdvi}{\ExecuteOptions{dvips}} +\DeclareOption{dvipdf}{\def\Gin@driver{dvipdf.def}} +\DeclareOption{dvipdfm}{\def\Gin@driver{dvipdfm.def}} +\DeclareOption{dvipdfmx}{\def\Gin@driver{dvipdfmx.def}} +\DeclareOption{pdftex}{\def\Gin@driver{pdftex.def}} +\DeclareOption{luatex}{\def\Gin@driver{luatex.def}} +\DeclareOption{xetex}{\def\Gin@driver{xetex.def}} +\DeclareOption{dvipsone}{\def\Gin@driver{dvipsone.def}} +\DeclareOption{dviwindo}{\ExecuteOptions{dvipsone}} +\DeclareOption{oztex}{\ExecuteOptions{dvips}} +\DeclareOption{textures}{\def\Gin@driver{textures.def}} +\DeclareOption{pctexps}{\def\Gin@driver{pctexps.def}} +\DeclareOption{pctex32}{\def\Gin@driver{pctex32.def}} +\DeclareOption{vtex}{\def\Gin@driver{vtex.def}} +% \end{macrocode} +% Request ``original'' \LaTeX\ mode. +% ^^A Emulation. To be implemented yet. +% \begin{macrocode} +\DeclareOption{original}{\def\pIIe@mode{0}} +% \end{macrocode} +% +% \begin{macro}{\ifpIIe@pdfliteral@ok} +% \begin{macro}{\pIIe@pdfliteral} +% Check, whether if \cmd{\pIIe@pdfliteral} is given in the driver file or +% \cmd{\pdfliteral} available directly. +% \begin{macrocode} +\newif\ifpIIe@pdfliteral@ok +\pIIe@pdfliteral@oktrue +\ifx\pIIe@pdfliteral\@undefined + \ifx\pdfliteral\@undefined + \pIIe@pdfliteral@okfalse + \def\pIIe@pdfliteral#1{% + \PackageWarning{pict2e}{pdfliteral not supported}% + }% + \else + \let\pIIe@pdfliteral\pdfliteral + \fi +\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\pIIe@buttcap} +% Do \cmd{\buttcap} only if available. +% \begin{macrocode} +\def\pIIe@buttcap{% + \ifpIIe@pdfliteral@ok + \buttcap + \fi +} +% \end{macrocode} +% \end{macro} +% Arrow shape options. +% The values for \LaTeX-style arrows are ``hand optimized''; +% they should be regarded as experimental, +% i.e., they may change in future versions of this package. +% The values for \PSTricks-style arrows are the default ones used by +% that bundle. +% If the \textsf{pstricks} package is actually loaded, then +% \textsf{pict2e} will obey the current values of the corresponding +% internal \PSTricks\ parameters; +% this feature should be regarded as experimental, +% i.e., it may change in future versions of this package. +% \begin{macrocode} +\DeclareOption{ltxarrows}{\AtEndOfPackage{% + \let\pIIe@vector=\pIIe@vector@ltx + \def\pIIe@FAL{1.52}% + \def\pIIe@FAW{3.2}% + \def\pIIe@CAW{1.5pt}% + \def\pIIe@FAI{0.25}% + }} +\DeclareOption{pstarrows}{\AtEndOfPackage{% + \let\pIIe@vector=\pIIe@vector@pst + \iffalse + \def\pIIe@FAL{1.4}% + \def\pIIe@FAW{2}% + \def\pIIe@CAW{1.5pt}% + \def\pIIe@FAI{0.4}% + \else % These are the ltxarrows values, which looks better. (RN) + \def\pIIe@FAL{1.52}% + \def\pIIe@FAW{3.2}% + \def\pIIe@CAW{1.5pt}% + \def\pIIe@FAI{0.25}% + \fi + }} +% \end{macrocode} +% +% \begin{macro}{\pIIe@debug@comment} +% This makes debugging easier. +% \begin{macrocode} +\newcommand*\pIIe@debug@comment{} +\DeclareOption{debug}{% + \def\pIIe@debug@comment{^^J^^J\@percentchar\space >>> pict2e <<<^^J}% + \begingroup + \@ifundefined{pdfcompresslevel}{}{\global\pdfcompresslevel\z@}% + \endgroup} +% \end{macrocode} +% \end{macro} +% A special variant of debugging. (Obsolescent? Once used for +% performance measurements: arctan vs.\ pyth-add versions of +% \cmd{\vector}.) +% \begin{macrocode} +\DeclareOption{hide}{\AtEndOfPackage{% +% \def\pIIe@code#1{}% + \let\pIIe@code\@gobble +}} +% \end{macrocode} +% Unknown options default to mode ``original.'' +% \begin{macrocode} +\DeclareOption*{\ExecuteOptions{original}} +% \end{macrocode} +% By default, arrows are in the \LaTeX\ style. +% \begin{macrocode} +\ExecuteOptions{ltxarrows} +% \end{macrocode} +% Like the \textsf{graphics} and \textsf{color} packages, we support a +% configuration file. (See file \texttt{p2e-drivers.dtx} for details +% and an example.) +% \begin{macrocode} +\InputIfFileExists{pict2e.cfg}{}{} +% \end{macrocode} +% This now should make clear which ``mode'' and ``code'' we should use. +% \begin{macrocode} +\ProcessOptions\relax +% \end{macrocode} +% +% \subsection{Output driver check} +% +% \begin{macrocode} +\ifnum\pIIe@mode=\z@ + \PackageInfo{pict2e}{Package option `original' requested} +\else +% \end{macrocode} +% This code fragment is more or less cloned from the +% \textsf{graphics} and \textsf{color} packages. +% \begin{macrocode} + \if!\Gin@driver! + \PackageError{pict2e} + {No driver specified at all} + {You should make a default driver option in a file\MessageBreak + pict2e.cfg\MessageBreak eg: \protect\ExecuteOptions{dvips}}% + \else + \PackageInfo{pict2e}{Driver file: \Gin@driver} + \@ifundefined{ver@\Gin@driver}{\input{\Gin@driver}}{} + \PackageInfo{pict2e}{Driver file for pict2e: p2e-\Gin@driver} + \InputIfFileExists{p2e-\Gin@driver}{}{% + \PackageError{pict2e}% + {Driver file ``p2e-\Gin@driver'' not found}% + {Q: Is the file properly installed? A: No!}} + \fi +\fi +% \end{macrocode} +% +% \subsection{Mode check} +% +% For \PS\ and \PDF\ modes. +% \begin{macrocode} +\ifnum\pIIe@mode>\z@ + \ifnum\pIIe@mode<\thr@@ + \RequirePackage{trig} +% \end{macrocode} +% +% \begin{macro}{\pIIe@oldline} +% \begin{macro}{\pIIe@old@sline} +% \begin{macro}{\pIIe@oldvector} +% \begin{macro}{\pIIe@old@circle} +% \begin{macro}{\pIIe@old@dot} +% \begin{macro}{\pIIe@old@bezier} +% \begin{macro}{\pIIe@old@cbezier} +% \begin{macro}{\pIIe@oldoval} +% \begin{macro}{\pIIe@old@oval} +% Saved versions of some macros. (Or dummy definitions.) +% \begin{macrocode} + \let\pIIe@oldline\line + \let\pIIe@old@sline\@sline + \let\pIIe@oldvector\vector + \let\pIIe@old@circle\@circle + \let\pIIe@old@dot\@dot + \let\pIIe@old@bezier\@bezier + \AtBeginDocument{% + \@ifundefined{@cbezier}{% + \def\pIIe@old@cbezier[#1](#2,#3)(#4,#5)(#6,#7)(#8,#9){}% + }{\let\pIIe@old@cbezier\@cbezier}} + \let\pIIe@oldoval\oval + \let\pIIe@old@oval\@oval +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\OriginalPictureCmds} +% Switches back to the original definitions; +% for testing and demonstration purposes only. +% \begin{macrocode} + \newcommand*\OriginalPictureCmds{% + \let\@sline\pIIe@old@sline + \let\line\pIIe@oldline + \let\vector\pIIe@oldvector + \let\@circle\pIIe@old@circle + \let\@dot\pIIe@old@dot + \let\@bezier\pIIe@old@bezier + \let\@cbezier\pIIe@old@cbezier + \renewcommand*\oval[1][]{\pIIe@oldoval}% + \let\@oval\pIIe@old@oval + } +% \end{macrocode} +% \end{macro} +% Overambitious drivers. +% \begin{macrocode} + \else + \PackageError{pict2e} + {Unsupported mode (\pIIe@mode) specified} + {The driver you specified requested a mode\MessageBreak + not supported by this version of this package} + \fi +% \end{macrocode} +% Incapable drivers. +% \begin{macrocode} +\else + \ifnum\pIIe@mode<\z@ + \PackageError{pict2e} + {No suitable driver specified} + {You should make a default driver option in a file\MessageBreak + pict2e.cfg\MessageBreak eg: \protect\ExecuteOptions{dvips}} + \fi +\fi +% \end{macrocode} +% Big switch,\label{big-switch-begin} +% completed near the end of the package +% (see page~\pageref{big-switch-end}). +% \begin{macrocode} +\ifnum\pIIe@mode>\z@ +% \end{macrocode} +% +% \subsection{Graphics operators} +% +% The following definitions allow the \PS\ and \PDF\ operations below +% to share some of the code. +% \begin{macrocode} + \ifcase\pIIe@mode\relax +% \end{macrocode} +% +% \begin{macro}{\pIIe@moveto@op} +% \begin{macro}{\pIIe@lineto@op} +% \begin{macro}{\pIIe@setlinewidth@op} +% \begin{macro}{\pIIe@stroke@op} +% \begin{macro}{\pIIe@fill@op} +% \begin{macro}{\pIIe@curveto@op} +% \begin{macro}{\pIIe@concat@op} +% \begin{macro}{\pIIe@closepath@op} +% \PS +% \begin{macrocode} + \or + \newcommand*\pIIe@moveto@op{moveto} + \newcommand*\pIIe@lineto@op{lineto} + \newcommand*\pIIe@setlinewidth@op{setlinewidth} + \newcommand*\pIIe@stroke@op{stroke} + \newcommand*\pIIe@fill@op{fill} + \newcommand*\pIIe@curveto@op{curveto} + \newcommand*\pIIe@concat@op{concat} + \newcommand*\pIIe@closepath@op{closepath} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\pIIe@moveto@op} +% \begin{macro}{\pIIe@lineto@op} +% \begin{macro}{\pIIe@setlinewidth@op} +% \begin{macro}{\pIIe@stroke@op} +% \begin{macro}{\pIIe@fill@op} +% \begin{macro}{\pIIe@curveto@op} +% \begin{macro}{\pIIe@concat@op} +% \begin{macro}{\pIIe@closepath@op} +% \PDF +% \begin{macrocode} + \or + \newcommand*\pIIe@moveto@op{m} + \newcommand*\pIIe@lineto@op{l} + \newcommand*\pIIe@setlinewidth@op{w} + \newcommand*\pIIe@stroke@op{S} + \newcommand*\pIIe@fill@op{f} + \newcommand*\pIIe@curveto@op{c} + \newcommand*\pIIe@concat@op{cm} + \newcommand*\pIIe@closepath@op{h} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \noindent +% (Currently, there are no other modes.) +% \begin{macrocode} + \fi +% \end{macrocode} +% +% \subsection{Low-level operations} +% +% \subsubsection{Collecting the graphics instructions and handling the output} +% +% \begin{macro}{\pIIe@GRAPH} +% \begin{macro}{\pIIe@addtoGraph} +% \changes{v0.1h}{2003/08/27}{Added newline code (to be improved eventually). +% (RN,HjG)} +% We collect all \PS\slash\PDF\ output code for a single picture +% object in a token register. +% \begin{macrocode} + \@ifdefinable\pIIe@GRAPH{\newtoks\pIIe@GRAPH} + \newcommand*\pIIe@addtoGraph[1]{% + \begingroup + \edef\x{\the\pIIe@GRAPH\space#1}% + \global\pIIe@GRAPH\expandafter{\x}% + \endgroup} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\pIIe@fillGraph} +% The path will either be filled \dots +% \begin{macrocode} + \newcommand*\pIIe@fillGraph{\begingroup \@tempswatrue\pIIe@drawGraph} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@strokeGraph} +% \dots\ or stroked. +% \begin{macrocode} + \newcommand*\pIIe@strokeGraph{\begingroup \@tempswafalse\pIIe@drawGraph} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@drawGraph} +% Common code. +% When we are done with collecting the path of the picture object, we +% output the contents of the token register. +% +% \changes{v0.1d}{2003/07/22}{``gsave/grestore'' added. (RN)} +% \changes{v0.1g}{2003/08/23}{``gsave/grestore'' removed. (RN)} +% \changes{v0.1i}{2003/08/28}{``gsave/grestore'' restored for PDF +% (see `p2e-drivers.dtx'). (RN)} +% \begin{macrocode} + \newcommand*\pIIe@drawGraph{% + \edef\x{\pIIe@debug@comment\space +% \end{macrocode} +% Instead of scaling individual coordinates, we scale the graph as a whole +% (pt$\rightarrow$bp); +% see Section~\ref{sec:implementation:transformations}. +% \begin{macrocode} + \pIIe@scale@PTtoBP}% + \if@tempswa + \edef\y{\pIIe@fill@op}% + \else + \edef\x{\x\space + \strip@pt\@wholewidth\space\pIIe@setlinewidth@op + \pIIe@linecap\pIIe@linejoin\space}% + \edef\y{\pIIe@stroke@op}% + \fi + \expandafter\pIIe@code\expandafter{% + \expandafter\x\the\pIIe@GRAPH\space\y}% +% \end{macrocode} +% \changes{v0.1u}{2003/11/19}{Clear current point after output (HjG)} +% Clear the graph and the current point after output. +% \begin{macrocode} + \global\pIIe@GRAPH{}\xdef\pIIe@CPx{}\xdef\pIIe@CPy{}% + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Auxilliary macros} +% +% The following macros save us a plethora of tokens in subsequent code. +% +% Note that since we are using \cmd{\@tempdima} and \cmd{\@tempdimb} +% both here and in medium-level macros below, we must be careful not +% to spoil their values. +% +% \begin{macro}{\pIIe@CPx} +% \begin{macro}{\pIIe@CPy} +% \begin{macro}{\pIIe@add@CP} +% \changes{v0.1u}{2003/11/21}{% +% Rename \cmd{\pIIe@add@XY} to \cmd{\pIIe@add@CP} (HjG)} +% The lengths (coordinates) given as arguments will be stored as +% ``real'' numbers using the common trick; i.e., they are put in +% `dimen' registers, scaled by $2^{16}$. +% At the same time, we remember the ``current point.'' +% (Not strictly necessary for \PS, but for some operations in \PDF, +% e.g., \textsl{rcurveto} emulation.) +% \begin{macrocode} + \newcommand*\pIIe@CPx{} \newcommand*\pIIe@CPy{} + \newcommand*\pIIe@add@CP[2]{% + \begingroup + \@tempdima#1\xdef\pIIe@CPx{\the\@tempdima}% + \@tempdimb#2\xdef\pIIe@CPy{\the\@tempdimb}% + \pIIe@addtoGraph{\strip@pt\@tempdima\space\strip@pt\@tempdimb}% + \endgroup} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\pIIe@add@nums} +% Similar, but does not set the ``current point.'' +% Values need not be coordinates (e.g., may be scaling factors, etc.). +% \begin{macrocode} + \newcommand*\pIIe@add@nums[2]{% + \begingroup + \@tempdima#1\relax + \@tempdimb#2\relax + \pIIe@addtoGraph{\strip@pt\@tempdima\space\strip@pt\@tempdimb}% + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@add@num} +% Likewise, for a single argument. +% \begin{macrocode} + \newcommand*\pIIe@add@num[1]{% + \begingroup + \@tempdima#1\relax + \pIIe@addtoGraph{\strip@pt\@tempdima}% + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \subsection{Medium-level operations} +% +% \subsubsection{Transformations} +% \label{sec:implementation:transformations} +% +% Transformation operators; not all are currently used. +% (Hence, some are untested.) +% +% \begin{macro}{\pIIe@PTtoBP} +% Scaling factor, used below. +% ``pt$\rightarrow$bp'' ($72 / 72.27 \approx 0.99626401$). +% Note the trailing space! +% (Don't delete it, it saves us some tokens.) +% \begin{macrocode} + \newcommand*\pIIe@PTtoBP{0.99626401 } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} + \ifcase\pIIe@mode\relax +% \end{macrocode} +% +% \begin{macro}{\pIIe@concat} +% \begin{macro}{\pIIe@translate} +% \begin{macro}{\pIIe@rotate} +% \begin{macro}{\pIIe@scale} +% \begin{macro}{\pIIe@scale@PTtoBP} +% \PS: Use some operators directly. +% \begin{macrocode} + \or + \newcommand*\pIIe@concat[6]{% + \begingroup + \pIIe@addtoGraph{[}% + \@tempdima#1\relax \@tempdimb#2\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#3\relax \@tempdimb#4\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#5\relax \@tempdimb#6\relax + \pIIe@add@nums\@tempdima\@tempdimb + \pIIe@addtoGraph{] \pIIe@concat@op}% + \endgroup} + \newcommand*\pIIe@translate[2]{\pIIe@add@nums{#1}{#2}\pIIe@addtoGraph{translate}} + \newcommand*\pIIe@rotate[1]{\pIIe@add@num{#1}\pIIe@addtoGraph{rotate}} + \newcommand*\pIIe@scale[2]{\pIIe@add@nums{#1}{#2}\pIIe@addtoGraph{scale}} + \newcommand*\pIIe@scale@PTtoBP{\pIIe@PTtoBP \pIIe@PTtoBP scale} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\pIIe@concat} +% \begin{macro}{\pIIe@translate} +% \begin{macro}{\pIIe@rotate} +% \begin{macro}{\pIIe@scale} +% \begin{macro}{\pIIe@scale@PTtoBP} +% \PDF: Emulate. \mbox{\texttt{:-(}} +% \begin{macrocode} + \or + \newcommand*\pIIe@concat[6]{% + \begingroup + \@tempdima#1\relax \@tempdimb#2\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#3\relax \@tempdimb#4\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#5\relax \@tempdimb#6\relax + \pIIe@add@nums\@tempdima\@tempdimb + \pIIe@addtoGraph\pIIe@concat@op + \endgroup} + \newcommand*\pIIe@translate[2]{\pIIe@concat\p@\z@\z@\p@{#1}{#2}} + \newcommand*\pIIe@rotate[1]{% + \begingroup + \@tempdima#1\relax + \edef\pIIe@tempa{\strip@pt\@tempdima}% + \CalculateSin\pIIe@tempa + \CalculateCos\pIIe@tempa + \edef\pIIe@tempb{\UseSin\pIIe@tempa}% + \edef\pIIe@tempc{\UseCos\pIIe@tempa}% + \pIIe@concat{\pIIe@tempc\p@}{\pIIe@tempb\p@}% + {-\pIIe@tempb\p@}{\pIIe@tempc\p@}\z@\z@ + \endgroup} + \newcommand*\pIIe@scale[2]{\pIIe@concat{#1}\z@\z@{#2}\z@\z@} + \newcommand*\pIIe@scale@PTtoBP{\pIIe@PTtoBP 0 0 \pIIe@PTtoBP 0 0 \pIIe@concat@op} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \noindent +% (Currently, there are no other modes.) +% \begin{macrocode} + \fi +% \end{macrocode} +% +% \subsubsection{Path definitions} +% \label{sec:implementation:path-definitions} +% +% \begin{macro}{\pIIe@moveto} +% Simple things \dots +% \begin{macrocode} + \newcommand*\pIIe@moveto[2]{% + \pIIe@add@CP{#1}{#2}\pIIe@addtoGraph\pIIe@moveto@op} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@lineto} +% \dots\ have to be defined, too. +% \begin{macrocode} + \newcommand*\pIIe@lineto[2]{% + \pIIe@add@CP{#1}{#2}\pIIe@addtoGraph\pIIe@lineto@op} +% \end{macrocode} +% \end{macro} +% +% \noindent +% We'll use \cmd{\pIIe@rcurveto} to draw quarter circles. +% (\cmd{\circle} and \cmd{\oval}). +% \begin{macrocode} + \ifcase\pIIe@mode\relax +% \end{macrocode} +% +% \begin{macro}{\pIIe@rcurveto} +% \PS: +% Use the ``rcurveto'' operator directly. +% \begin{macrocode} + \or + \newcommand*\pIIe@rcurveto[6]{% + \begingroup + \@tempdima#1\relax \@tempdimb#2\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#3\relax \@tempdimb#4\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#5\relax \@tempdimb#6\relax + \pIIe@add@CP\@tempdima\@tempdimb + \pIIe@addtoGraph{rcurveto}% + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@rcurveto} +% \PDF: +% It's necessary to emulate the \PS\ operator ``rcurveto''. +% For this, the ``current point'' must be known, i.e., all macros which +% change the ``current point'' must set \cmd{\pIIe@CPx} and +% \cmd{\pIIe@CPy}. +% \begin{macrocode} + \or + \newcommand*\pIIe@rcurveto[6]{% + \begingroup + \@tempdima#1\advance\@tempdima\pIIe@CPx\relax + \@tempdimb#2\advance\@tempdimb\pIIe@CPy\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#3\advance\@tempdima\pIIe@CPx\relax + \@tempdimb#4\advance\@tempdimb\pIIe@CPy\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#5\advance\@tempdima\pIIe@CPx\relax + \@tempdimb#6\advance\@tempdimb\pIIe@CPy\relax + \pIIe@add@CP\@tempdima\@tempdimb + \pIIe@addtoGraph\pIIe@curveto@op + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \noindent +% (Currently, there are no other modes.) +% \begin{macrocode} + \fi +% \end{macrocode} +% +% \begin{macro}{\pIIe@curveto} +% This is currently only used for Bezier curves and for drawing the +% heads of \LaTeX-like arrows. +% Note: It's the same for \PS\ and \PDF. +% \begin{macrocode} + \newcommand*\pIIe@curveto[6]{% + \begingroup + \@tempdima#1\relax \@tempdimb#2\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#3\relax \@tempdimb#4\relax + \pIIe@add@nums\@tempdima\@tempdimb + \@tempdima#5\relax \@tempdimb#6\relax + \pIIe@add@CP\@tempdima\@tempdimb + \pIIe@addtoGraph\pIIe@curveto@op + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@closepath} +% \begin{macrocode} + \newcommand*\pIIe@closepath{\pIIe@addtoGraph\pIIe@closepath@op} +% \end{macrocode} +% \end{macro} +% +% \subsection{``Pythagorean Addition'' and Division} +% +% \begin{macro}{\pIIe@pyth} +% This algorithm is copied from the \PiCTeX\ package +% \cite{PICTEX} by Michael Wichura, with his permission +% ^^A (cite Email!?). +% +% Here is his description: +% \begin{quote} +% Suppose $x>0$, $y>0$. +% Put $s = x+y$. Let $z = (x^2+y^2)^{1/2}$. +% Then $z = s\times f$, where +% \[ +% f = (t^2 + (1-t)^2)^{1/2} = ((1+\tau^2)/2)^{1/2} +% \] +% and $t = x/s$ and $\tau = 2(t-1/2)$. +% \end{quote} +% \changes{v0.2r}{2005/07/15}{Two wrong global assignment changed. (RN)} +% \begin{macrocode} + \newcommand*\pIIe@pyth[3]{% + \begingroup + \@tempdima=#1\relax +% \end{macrocode} +% $\cmd{\@tempdima}=\mathrm{abs}(x)$ +% \begin{macrocode} + \ifnum\@tempdima<\z@\@tempdima=-\@tempdima\fi + \@tempdimb=#2\relax +% \end{macrocode} +% $\cmd{\@tempdimb}=\mathrm{abs}(y)$ +% \begin{macrocode} + \ifnum\@tempdimb<\z@\@tempdimb=-\@tempdimb\fi +% \end{macrocode} +% $\cmd{\@tempdimb} = s = \mathrm{abs}(x)+\mathrm{abs}(y)$ +% \begin{macrocode} + \advance\@tempdimb\@tempdima + \ifnum\@tempdimb=\z@ +% \end{macrocode} +% $\cmd{\@tempdimc} = z = \sqrt{(x^2+y^2)}$ +% \begin{macrocode} + \@tempdimc=\z@ + \else +% \end{macrocode} +% $\cmd{\@tempdima} = 8 \times\mathrm{abs}(x)$ +% \begin{macrocode} + \multiply\@tempdima 8\relax +% \end{macrocode} +% $\cmd{\@tempdimc} = 8\,t = 8 \times\mathrm{abs}(x) / s$ +% \begin{macrocode} + \pIIe@divide\@tempdima\@tempdimb\@tempdimc +% \end{macrocode} +% $\cmd{\@tempdimc} = 4\tau = (8\,t-4)$ +% \begin{macrocode} + \advance\@tempdimc -4pt + \multiply\@tempdimc 2 + \edef\pIIe@tempa{\strip@pt\@tempdimc}% +% \end{macrocode} +% $\cmd{\@tempdima} = (8\,\tau)^2$ +% \begin{macrocode} + \@tempdima=\pIIe@tempa\@tempdimc +% \end{macrocode} +% $\cmd{\@tempdima} = [64+(8\,\tau)^2]/2 =(8\,f)^2$ +% \begin{macrocode} + \advance\@tempdima 64pt + \divide\@tempdima 2\relax +% \end{macrocode} +% initial guess at $\sqrt{(u)}$ +% \begin{macrocode} + \@dashdim=7pt +% \end{macrocode} +% $\cmd{\@dashdim} = \sqrt{(u)}$ +% \begin{macrocode} + \pIIe@@pyth\pIIe@@pyth\pIIe@@pyth + \edef\pIIe@tempa{\strip@pt\@dashdim}% + \@tempdimc=\pIIe@tempa\@tempdimb +% \end{macrocode} +% $\cmd{\@tempdimc} = z = (8\,f)\times s / 8$ +% \begin{macrocode} + \global\divide\@tempdimc 8 + \fi + \edef\x{\endgroup#3=\the\@tempdimc}% + \x} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@@pyth} +% $\cmd{\@dashdim} = g \leftarrow (g + u/g)/2$ +% \begin{macrocode} + \newcommand*\pIIe@@pyth{% + \pIIe@divide\@tempdima\@dashdim\@tempdimc + \advance\@dashdim\@tempdimc + \divide\@dashdim\tw@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@divide} +% The following macro for division is a slight modification of the macro from +% \texttt{curve2e} by Claudio Beccari with his permission. +% Real numbers are represented as dimens in \texttt{pt}. +% \begin{macrocode} + \newcommand*\pIIe@divide[3]{% +% \end{macrocode} +% All definitions inside a group. +% \begin{macrocode} + \begingroup + \dimendef\Numer=254\relax \dimendef\Denom=252\relax + \countdef\Num=254\relax \countdef\Den=252\relax + \countdef\I=250\relax \countdef\Numb=248\relax + \Numer #1\relax \Denom #2\relax +% \end{macrocode} +% Make numerator and denominator nonnegative, save sign. +% \begin{macrocode} + \ifdim\Denom<\z@ \Denom -\Denom \Numer=-\Numer \fi + \ifdim\Numer<\z@ \def\sign{-}\Numer=-\Numer \else \def\sign{}\fi +% \end{macrocode} +% Use \cmd{\maxdimen} for $x/0$ (this should not appear). +% \begin{macrocode} + \ifdim\Denom=\z@ + \edef\Q{\strip@pt\maxdimen}% + \PackageWarning{pict2e}% + {Division by 0, \sign\strip@pt\maxdimen\space used}{}% + \else +% \end{macrocode} +% Converse to integers and find integer part of the ratio. If it is too +% large (dimension overflow), use \cmd{\maxdimen} otherwise find the +% remainder and start the iteration process to find 6 digits of the decimal +% expression. +% \begin{macrocode} + \Num=\Numer \Den=\Denom + \Numb=\Num \divide\Numb\Den + \ifnum\Numb>16383 + \edef\Q{\strip@pt\maxdimen}% + \PackageWarning{pict2e}% + {Division overflow, \sign\strip@pt\maxdimen\space used}{}% + \else + \edef\Q{\number\Numb.}% + \multiply \Numb\Den \advance\Num -\Numb + \I=6\relax + \@whilenum \I>\z@ \do{\pIIe@@divide\advance\I\m@ne}% + \fi + \fi +% \end{macrocode} +% A useful trick to define \#3 outside the group without using \cmd{\global} +% (if the macro is used inside another group.) +% \begin{macrocode} + \edef\tempend{\noexpand\endgroup\noexpand#3=\sign\Q\p@}% + \tempend} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@@divide} +% Iteration macro for finding decimal expression of the ratio. \cmd{\Num} is +% the remainder of the previous division, \cmd{\Den} is the denominator (both +% are integers). +% \begin{macrocode} + \def\pIIe@@divide{% +% \end{macrocode} +% Reduce both numerator and denominator if necessary to avoid overflow in +% the next step. +% \begin{macrocode} + \@whilenum \Num>214748364 \do{\divide\Num\tw@ \divide\Den\tw@}% +% \end{macrocode} +% Find the next digit of the decimal expression. +% \begin{macrocode} + \multiply \Num 10 + \Numb=\Num \divide\Numb\Den + \edef\Q{\Q\number\Numb}% +% \end{macrocode} +% Find the remainder. +% \begin{macrocode} + \multiply \Numb\Den \advance \Num -\Numb +% \end{macrocode} +% Stop the iteration if the remainder is zero. +% \begin{macrocode} + \ifnum\Num>\z@\else\I=0\fi} +% \end{macrocode} +% \end{macro} +% +% \subsection{High-level operations} +% +% \begin{macro}{\pIIe@checkslopeargs} +% \changes{v0.3c}{2019/08/20}{\cmd{\edef} for parameters stored in macros -- +% suggested by Phelype Oleinik (RN)} +% Common code for \cmd{\line} and \cmd{\vector}. +% \begin{macrocode} + \newcommand*\pIIe@checkslopeargsline[2]{% + \pIIe@checkslopeargs{#1}{#2}{16383}} + \newcommand*\pIIe@checkslopeargsvector[2]{% + \pIIe@checkslopeargs{#1}{#2}{1000}} + \newcommand*\pIIe@checkslopeargs[3]{% + \edef\@tempa{#1}\expandafter\pIIe@checkslopearg\@tempa.:{#3}% + \edef\@tempa{#2}\expandafter\pIIe@checkslopearg\@tempa.:{#3}% +% \end{macrocode} +% A bit incompatible with \SL: slope \((0,0)\) raises an error. +% \begin{macrocode} + \ifdim #1\p@=\z@ \ifdim #2\p@=\z@ \@badlinearg \fi\fi} + \def\pIIe@checkslopearg #1.#2:#3{% + \def\@tempa{#1}% + \ifx\@tempa\empty\def\@tempa{0}\fi + \ifx\@tempa\space\def\@tempa{0}\fi + \ifnum\ifnum\@tempa<\z@-\fi\@tempa>#3 \@badlinearg \fi} + \def\@badlinearg{\PackageError + {pict2e}{Bad \protect\line\space or \protect\vector\space argument}{}} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Line} +% \label{sec:implementation:line} +% +% \begin{macro}{\line} +% \changes{v0.2l}{2004/04/08}{Macro added (RN/HjG)} +% \cmd{\line}\parg{x,y}\marg{$l_x$}: +% \changes{v0.2o}{2004/06/25}{Use \cmd{\pIIe@checkslopeargs} (HjG)} +% \changes{v0.2t}{2008/05/11}{All lines by \cmd{\@sline} (JT)} +% \begin{macrocode} + \def\line(#1,#2)#3{% + \pIIe@checkslopeargsline{#1}{#2}% + \@tempdima=#1pt\relax \@tempdimb=#2pt\relax + \@linelen #3\unitlength + \ifdim\@linelen<\z@ \@badlinearg \else \@sline \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@sline} +% (The implementation here is different from \cmd{\vector}!) +% \begin{macrocode} + \def\@sline{% + \begingroup + \ifdim\@tempdima=\z@ + \ifdim\@tempdimb<\z@\@linelen-\@linelen\fi + \@ydim=\@linelen + \@xdim=\z@ + \else + \ifdim\@tempdimb=\z@ + \ifdim\@tempdima<\z@\@linelen-\@linelen\fi + \@xdim=\@linelen + \@ydim=\z@ + \else + \ifnum\@tempdima<\z@\@linelen-\@linelen\fi + \pIIe@divide\@tempdimb\@tempdima\dimen@ + \@ydim=\strip@pt\dimen@\@linelen + \@xdim=\@linelen + \fi + \fi + \pIIe@moveto\z@\z@ + \pIIe@lineto\@xdim\@ydim + \pIIe@strokeGraph + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Vector} +% \label{sec:implementation:vector} +% +% \begin{macro}{\vector} +% Unlike \cmd{\line}, \cmd{\vector} must be redefined, because +% the kernel version checks for illegal slope arguments. +% +% \cmd{\vector}\parg{x,y}\marg{$l_x$}: +% Instead of calculating \(\theta = \arctan \frac{y}{x}\), we use +% ``pythagorean addition''~\cite{PICTEX} +% to determine \(s=\sqrt{x^2+y^2}\) and to obtain the length +% of the vector \(l = l_x \cdot \frac{s}{x}\) +% and the values of \(\sin \theta = \frac{y}{s}\) and +% \(\cos \theta = \frac{x}{s}\) for the rotation of the coordinate system. +% ^^A (This is faster; is it more accurate?) +% \changes{v0.2o}{2004/06/25}{Use \cmd{\pIIe@checkslopeargs} (HjG)} +% \begin{macrocode} + \def\vector(#1,#2)#3{% + \begingroup + \pIIe@checkslopeargsvector{#1}{#2}% + \@tempdima=#1pt\relax \@tempdimb=#2pt\relax + \@linelen#3\unitlength + \ifdim\@linelen<\z@ \@badlinearg \else + \pIIe@pyth{\@tempdima}{\@tempdimb}\dimen@ + \ifdim\@tempdima=\z@ + \else\ifdim\@tempdimb=\z@ + \else +% \end{macrocode} +% This calculation is only necessary, if the vector is actually +% sloped. +% \begin{macrocode} + \pIIe@divide\dimen@{\@tempdima}\@xdim + \@linelen\strip@pt\@xdim\@linelen + \ifdim\@linelen<\z@\@linelen-\@linelen\fi + \fi + \fi +% \end{macrocode} +% \BigIndent $\sin\theta$ and $\cos\theta$ +% \begin{macrocode} + \pIIe@divide{\@tempdimb}\dimen@\@ydim + \pIIe@divide{\@tempdima}\dimen@\@xdim +% \end{macrocode} +% Rotate the following vector\slash arrow outlines by angle $\theta$. +% \begin{macrocode} + \pIIe@concat\@xdim\@ydim{-\@ydim}\@xdim\z@\z@ +% \end{macrocode} +% Internal command to draw the outline of the vector\slash arrow. +% \begin{macrocode} + \pIIe@vector + \pIIe@fillGraph + \fi + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@vector} +% \changes{v0.1u}{2003/11/21}{New ancillary macro (HjG)} +% This command should be \cmd{\def}'ed or \cmd{\let} to a macro +% that generates the vector's outline path. +% Now initialized by package options, via |\AtEndOfPackage|. +% \begin{macrocode} + \newcommand*\pIIe@vector{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@FAL} +% \begin{macro}{\pIIe@FAW} +% \begin{macro}{\pIIe@CAW} +% \begin{macro}{\pIIe@FAI} +% \changes{v0.1x}{2003/11/27}{Introduce ``inset''. (RN,HjG)} +% \begin{macro}{\pIIe@@firstnum} +% \changes{v0.1x}{2003/11/27}{New ancillary macro (RN,HjG)} +% \begin{macro}{\pIIe@@secondnum} +% \changes{v0.1x}{2003/11/27}{New ancillary macro (RN,HjG)} +% Some macros to parametrize the shape of the vector outline. +% ^^A Should be user-level macros or changeable via key-value interface. +% ^^A (Defered to future version.) +% See Figures~\ref{fig:vector:ltx} and~\ref{fig:vector:pst}. +%\iffalse +% Note that when the \textsf{pstricks} package has been loaded, its +% arrow-drawing parameters will be dynamically evaluated; +% of course, +% this is only useful with the \textsf{pstarrows} package +% option. +% probably\slash most likely not useful with the default +% \textsf{ltxarrows} package option. +% \fi +% \begin{macrocode} + \newcommand*\pIIe@FAL{}\newcommand*\pIIe@FAW{}\newcommand*\pIIe@CAW{} + \newcommand*\pIIe@FAI{} + \newcommand*\pIIe@@firstnum{}\newcommand*\pIIe@@secondnum{} + \iffalse% the pstricks values gives too small arrows. (RN) + \AtBeginDocument{% + \@ifpackageloaded{pstricks}{% + \def\pIIe@FAL{\psk@arrowlength}% + \def\pIIe@FAW{\expandafter\pIIe@@secondnum\psk@arrowsize}% + \def\pIIe@CAW{\expandafter\pIIe@@firstnum\psk@arrowsize}% + \def\pIIe@FAI{\psk@arrowinset}% + \def\pIIe@@firstnum#1 #2 {#1\p@}% + \def\pIIe@@secondnum#1 #2 {#2}% + }{}% + } + \fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \paragraph{\LaTeX\ version} +% +% The arrows drawn by the variant generated by the \textsf{ltxarrows} +% package option are +% modeled after those in the fonts used by the \SL\ version of the +% picture commands (|ltpictur.dtx|). +% ^^A line10 linew10 +% See Figure~\ref{fig:vector:ltx}. +% +% \begin{figure} +% \setlength\unitlength{.0067\linewidth}\hfill +% \makebox[0pt][r]{^^A +% \begin{minipage}[c]{17em}^^A +% \unboldmath\small +% \setlength\arraycolsep{.5\arraycolsep}^^A +% \begin{eqnarray*} +% L & = & \cmd{\@linelen} \\ +% W & = & \cmd{\@wholewidth} = 2\times\cmd{\@halfwidth} \\ +% AW & = & \cmd{\pIIe@FAW}\times W + \cmd{\pIIe@CAW} \\ +% AL & = & \cmd{\pIIe@FAL}\times AW \\ +% IN & = & \cmd{\pIIe@FAI}\times AW / 2 +% \end{eqnarray*} +% \end{minipage}}^^A +% \hspace{\marginparsep} +% \begin{minipage}[c]{105\unitlength}^^A +% \rule{\linewidth}{0pt} +% \begin{picture}(105,55)(0,-25) +% \boldmath\bfseries +% \THICKLINES +% \put(100,0){\FPOINT} \put(101,-1){$P_1$} +% ^^A \makeatletter +% ^^A \pIIe@addtoGraph{^^J^^J\@percentchar\space >>> HUGO <<<^^J}^^A +% ^^A \makeatother +% \CBEZIER{100,0}{86.67,-1.67}{73.33,-8.33}{60,-20}^^A P1--P2 +% \put(60,-20){\FPOINT} \put(61,-23){$P_2$} +% \put(60,-20){\line(0,1){10}}^^A P2--P3 +% \put(60,-10){\FPOINT} \put(61,-9){$P_3$} +% \put(60,-10){\line(-1,0){60}}^^A P3--P4 +% \put(0,-10){\FPOINT} \put(1,-8){$P_4$} +% \put(0,-10){\line(0,1){20}}^^A P4--P5 +% \put(0,10){\FPOINT} \put(1,6){$P_5$} +% \put(0,10){\line(1,0){60}}^^A P5--P6 +% \put(60,10){\FPOINT} \put(61,7){$P_6$} +% \put(60,10){\line(0,1){10}}^^A P6--P7 +% \put(60,20){\FPOINT} \put(61,21){$P_7$} +% ^^A \makeatletter +% ^^A \pIIe@addtoGraph{^^J^^J\@percentchar\space >>> HUGO <<<^^J}^^A +% ^^A \makeatother +% \CBEZIER{60,20}{73.33,8.33}{86.67,1.67}{100,0}^^A P7--P1 +% \thinlines +% \put(100,0){\line(-2,-1){40}}^^A P1--P2 +% \put(60,20){\line(2,-1){40}}^^A P7--P1 +% ^^A +% \put(93,-8){$P_a$} +% \put(93,-6){\line(-3,2){6}}^^A +% \put(80,-5){\OPOINT} +% \put(73,-5){$P_m$} +% \put(67,-8){$P_b$} +% ^^A +% \put(93,6){$P_d$} +% \put(93,6){\line(-3,-2){6}}^^A +% \put(80,5){\OPOINT} +% \put(73,3){$P_n$} +% \put(67,6){$P_c$} +% ^^A +% \put(-2,0){\line(1,0){4}} +% \put(10,-7){\vector(-10,7){10}}\put(10,-8){$\,(0,0)$} +% ^^A +% \put(60,-20){\line(0,-1){5}}\put(100,0){\line(0,-1){25}} +% \put(60,-25){\vector(1,0){40}}\put(100,-25){\vector(-1,0){40}} +% \put(77,-24){$AL$} +% ^^A +% \put(0,10){\line(0,1){15}}\put(100,0){\line(0,1){25}} +% \put(0,25){\vector(1,0){100}}\put(100,25){\vector(-1,0){100}} +% \put(48,26){$L$} +% ^^A +% \put(60,-20){\line(-1,0){5}} \put(60,20){\line(-1,0){5}} +% \put(55,-20){\vector(0,1){40}} \put(55,20){\vector(0,-1){40}} +% \put(47,-2){$AW$} +% ^^A +% \put(25,-10){\vector(0,1){20}}\put(25,10){\vector(0,-1){20}} +% \put(20,-2){$W$} +% \put(80,-10){\line(1,0){5}} \put(80,-5){\line(1,0){5}} +% \put(85,-7.5){\vector(0,-1){2.5}} \put(85,-7.5){\vector(0,1){2.5}} +% \put(86,-10){$IN$} +% \end{picture} +% \end{minipage} +% \caption[\LaTeX-like implementation of \cmd{\vector}]^^A +% {Sketch of the path drawn by the \LaTeX-like implementation +% of \cmd{\vector}. (Note: We are using the redefined macros of +% \textsf{pict2e}!)} +% \label{fig:vector:ltx} +% \end{figure} +% +% \begin{macro}{\pIIe@vector@ltx} +% \changes{v0.1u}{2003/11/21}{New ancillary macro (HjG)} +% \changes{v0.1y}{2003/11/27}{First implementation. (RN,HjG)} +% The arrow outline. +% (Not yet quite the same as with \LaTeX's fonts.) +% +% Problem: Extrapolation. +% There are only two design sizes (thicknesses) for \LaTeX's line +% drawing fonts. +% Where can we go from there? +% +% Note that only the arrow head will be drawn, if the length argument +% of the \cmd{\vector} command is smaller than the calculated length +% of the arrow head. +% ^^A (Orig.\ \LaTeX: only, if length =~0!?) +% \begin{macrocode} + \newcommand*\pIIe@vector@ltx{% + \@ydim\pIIe@FAW\@wholewidth \advance\@ydim\pIIe@CAW\relax + \@ovxx\pIIe@FAL\@ydim + \@xdim\@linelen \advance\@xdim-\@ovxx + \divide\@ydim\tw@ + \divide\@ovxx\tw@ \advance\@ovxx\@xdim + \@ovyy\@ydim + \divide\@ovyy\tw@ \advance\@ovyy-\pIIe@FAI\@ydim +% \end{macrocode} +% \noindent +% \BigIndent $P_d = P_1 + 1/3 (P_n - P_1)$ +% \begin{macrocode} + \pIIe@bezier@QtoC\@linelen\@ovxx\@ovro + \pIIe@bezier@QtoC\z@\@ovyy\@ovri +% \end{macrocode} +% \BigIndent $P_c = P_7 + 1/3 (P_n - P_7)$ +% \begin{macrocode} + \pIIe@bezier@QtoC\@xdim\@ovxx\@clnwd + \pIIe@bezier@QtoC\@ydim\@ovyy\@clnht +% \end{macrocode} +% \BigIndent $P_1$ +% \begin{macrocode} + \pIIe@moveto\@linelen\z@ +% \end{macrocode} +% \BigIndent $P_a \quad P_b \quad P_2$ +% \begin{macrocode} + \pIIe@curveto\@ovro{-\@ovri}\@clnwd{-\@clnht}\@xdim{-\@ydim}% + \ifdim\@xdim>\z@ +% \end{macrocode} +% \BigIndent $P_3$ +% \begin{macrocode} + \pIIe@lineto\@xdim{-\@halfwidth}% +% \end{macrocode} +% \BigIndent $P_4$ +% \begin{macrocode} + \pIIe@lineto\z@{-\@halfwidth}% +% \end{macrocode} +% \BigIndent $P_5$ +% \begin{macrocode} + \pIIe@lineto\z@{\@halfwidth}% +% \end{macrocode} +% \BigIndent $P_6$ +% \begin{macrocode} + \pIIe@lineto\@xdim{\@halfwidth}% + \fi +% \end{macrocode} +% \BigIndent $P_7$ +% \begin{macrocode} + \pIIe@lineto\@xdim\@ydim +% \end{macrocode} +% \BigIndent $P_c \quad P_d \quad P_1$ +% \begin{macrocode} + \pIIe@curveto\@clnwd\@clnht\@ovro\@ovri\@linelen\z@} +% \end{macrocode} +% \end{macro} +% +% \paragraph{\PSTricks\ version} +% +% The arrows drawn by the variant generated by the \textsf{pstarrows} +% package option are +% modeled after those in the \textsf{pstricks} package~\cite{PSTRICKS}. +% See Figure~\ref{fig:vector:pst}. +% +% \begin{figure} +% \setlength\unitlength{.0067\linewidth}\hfill +% \makebox[0pt][r]{^^A +% \begin{minipage}[c]{17em}^^A +% \unboldmath\small +% \setlength\arraycolsep{.5\arraycolsep}^^A +% \begin{eqnarray*} +% L & = & \cmd{\@linelen} \\ +% W & = & \cmd{\@wholewidth} = 2\times\cmd{\@halfwidth} \\ +% AW & = & \cmd{\pIIe@FAW}\times W + \cmd{\pIIe@CAW} \\ +% AL & = & \cmd{\pIIe@FAL}\times AW \\ +% IN & = & \cmd{\pIIe@FAI}\times AL +% \end{eqnarray*} +% \end{minipage}}^^A +% \hspace{\marginparsep} +% \begin{minipage}[c]{105\unitlength}^^A +% \rule{\linewidth}{0pt} +% \begin{picture}(105,55)(0,-25) +% \boldmath\bfseries +% \THICKLINES +% \put(100,0){\FPOINT} \put(101,-1){$P_1$} +% \put(100,0){\line(-2,-1){40}}^^A P1--P2 +% \put(60,-20){\FPOINT} \put(61,-23){$P_2$} +% \put(60,-20){\line(4,5){8}}^^A P2--P3 +% \put(68,-10){\FPOINT} \put(70,-11){$P_3$} +% \put(68,-10){\line(-1,0){68}}^^A P3--P4 +% \put(0,-10){\FPOINT} \put(1,-8){$P_4$} +% \put(0,-10){\line(0,1){20}}^^A P4--P5 +% \put(0,10){\FPOINT} \put(1,6){$P_5$} +% \put(0,10){\line(1,0){68}}^^A P5--P6 +% \put(68,10){\FPOINT} \put(70,9){$P_6$} +% \put(68,10){\line(-4,5){8}}^^A P6--P7 +% \put(60,20){\FPOINT} \put(61,21){$P_7$} +% \put(60,20){\line(2,-1){40}}^^A P7--P1 +% \thinlines +% \put(76,0){\FPOINT} \put(78,-1){$P_i$} +% \put(68,-10){\line(4,5){8}}^^A P3--Pi +% \put(68,10){\line(4,-5){8}}^^A P6--Pi +% ^^A +% \put(-2,0){\line(1,0){4}} +% \put(10,-7){\vector(-10,7){10}}\put(10,-8){$\,(0,0)$} +% ^^A +% \put(60,-20){\line(0,-1){5}}\put(100,0){\line(0,-1){25}} +% \put(60,-25){\vector(1,0){40}}\put(100,-25){\vector(-1,0){40}} +% \put(77,-24){$AL$} +% ^^A +% \put(0,10){\line(0,1){15}}\put(100,0){\line(0,1){25}} +% \put(0,25){\vector(1,0){100}}\put(100,25){\vector(-1,0){100}} +% \put(48,26){$L$} +% ^^A +% \put(60,-20){\line(-1,0){5}} \put(60,20){\line(-1,0){5}} +% \put(55,-20){\vector(0,1){40}} \put(55,20){\vector(0,-1){40}} +% \put(47,-2){$AW$} +% ^^A +% \put(60,-20){\line(0,1){40}} +% \put(60,0){\vector(1,0){15}} +% \put(76,0){\vector(-1,0){16}} +% \put(65,1){$IN$} +% ^^A +% \put(25,-10){\vector(0,1){20}}\put(25,10){\vector(0,-1){20}} +% \put(20,-2){$W$} +% \end{picture} +% \end{minipage} +% \caption[\PSTricks-like implementation of \cmd{\vector}]^^A +% {Sketch of the path drawn by the \PSTricks-like implementation +% of \cmd{\vector}. (Note: We are using the redefined macros of +% \textsf{pict2e}!)} +% \label{fig:vector:pst} +% \end{figure} +% +% \begin{macro}{\pIIe@vector@pst} +% \changes{v0.1u}{2003/11/21}{New ancillary macro (HjG)} +% The arrow outline. +% Note that only the arrowhead will be drawn, if the length argument +% of the \cmd{\vector} command is smaller than the calculated length +% of the arrow head. +% ^^A (Orig.\ \LaTeX: only, if length =~0!?) +% \begin{macrocode} + \newcommand*\pIIe@vector@pst{% + \@ydim\pIIe@FAW\@wholewidth \advance\@ydim\pIIe@CAW\relax + \@ovxx\pIIe@FAL\@ydim + \@xdim\@linelen \advance\@xdim-\@ovxx + \divide\@ydim\tw@ + \@ovyy\@ydim \advance\@ovyy-\@halfwidth + \@ovdx\pIIe@FAI\@ovxx + \pIIe@divide\@ovdx\@ydim\@tempdimc + \@ovxx\strip@pt\@ovyy\@tempdimc + \advance\@ovxx\@xdim + \advance\@ovdx\@xdim +% \end{macrocode} +% \BigIndent $P_1$ +% \begin{macrocode} + \pIIe@moveto\@linelen\z@ +% \end{macrocode} +% \BigIndent $P_2$ +% \begin{macrocode} + \pIIe@lineto\@xdim{-\@ydim}% + \ifdim\@xdim>\z@ +% \end{macrocode} +% \BigIndent $P_3$ +% \begin{macrocode} + \pIIe@lineto\@ovxx{-\@halfwidth}% +% \end{macrocode} +% \BigIndent $P_4$ +% \begin{macrocode} + \pIIe@lineto\z@{-\@halfwidth}% +% \end{macrocode} +% \BigIndent $P_5$ +% \begin{macrocode} + \pIIe@lineto\z@{\@halfwidth}% +% \end{macrocode} +% \BigIndent $P_6$ +% \begin{macrocode} + \pIIe@lineto\@ovxx{\@halfwidth}% + \else +% \end{macrocode} +% \BigIndent $P_i$ +% \begin{macrocode} + \pIIe@lineto\@ovdx\z@ + \fi +% \end{macrocode} +% \BigIndent $P_7$ +% \begin{macrocode} + \pIIe@lineto\@xdim\@ydim +% \end{macrocode} +% \BigIndent $P_1$ +% \begin{macrocode} + \pIIe@lineto\@linelen\z@} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Circle and Dot} +% \label{sec:implementation:circle+dot} +% +% \begin{macro}{\@circle} +% The circle will either be stroked \dots +% \begin{macrocode} + \def\@circle#1{\begingroup \@tempswafalse\pIIe@circ{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@dot} +% \dots\ or filled. +% \begin{macrocode} + \def\@dot#1{\begingroup \@tempswatrue\pIIe@circ{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@circ} +% Common code. +% ^^A (Could\slash should be named \cmd{\@circ}!?) +% \begin{macrocode} + \newcommand*\pIIe@circ[1]{% +% \end{macrocode} +% We need the radius instead of the diameter. +% Unlike \SL, we check for negative or zero diameter argument. +% ^^A Useful: error check when calculating coordinates. +% \changes{v0.2h}{2004/01/07}{Check for negative or zero diameter +% argument (RN,HjG)} +% \changes{v0.2n}{2004/04/22}{Allow zero diameter (RN/HjG)} +% \begin{macrocode} + \@tempdima#1\unitlength + \ifdim\@tempdima<\z@ \pIIe@badcircarg \fi + \divide\@tempdima\tw@ + \pIIe@circle\@tempdima +% \end{macrocode} +% With the current state of affairs, we could use +% \cmd{\pIIe@drawGraph} directly; but that would possibly be a case of +% premature optimisation. +% (Note to ourselves: +% Use of the |@tempswa| switch both here and inside quarter-circle! +% Hence a group is necessary there.) +% \begin{macrocode} + \if@tempswa \pIIe@fillGraph \else \buttcap \pIIe@strokeGraph \fi + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@circle} +% Approximate a full circle by four quarter circles, use the standard shape +% of ends. +% \changes{v0.1g}{2003/08/23}{Changed code (using% +% \cmd{\pIIe@add@qcircle}). (HjG,RN)} +% \changes{v0.3a}{2016/01/09}{Changed code, closepath seems to be necessary.} +% \begin{macrocode} + \newcommand*\pIIe@circle[1]{% + \pIIe@qcircle[1]\z@{#1}\pIIe@qcircle \@ne{#1}% + \pIIe@qcircle \tw@{#1}\pIIe@qcircle\thr@@{#1}\pIIe@closepath} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@qcircle} +% \changes{v0.1u}{2003/11/21}{% +% Change coding of quadrant number to match bit number in +% \cmd{\pIIe@get@quadrants} (HjG)} +% \changes{v0.1v}{2003/11/22}{Exchange \cmd{\@xdim} and \cmd{\@ydim} to +% \cmd{\@ovri} and \cmd{\@ovro} (HjG)} +% Approximate a quarter circle, using cubic Bezier splines. +% +% \begin{figure} +% \setlength\unitlength{.0033\linewidth}\hfill +% \begin{minipage}{125\unitlength} +% \begin{picture}(125,122)(-13,-3) +% \boldmath\bfseries +% \thinlines +% ^^A\put(-13,-3){\framebox(125,122){}} +% \put(0,0){\OPOINT}\put(2,4){$(0,0)$} +% \put(2,0){\vector(1,0){96}}\put(98,0){\vector(-1,0){96}} +% \put(40,2){$radius$} +% \put(0,2){\vector(0,1){96}}\put(0,98){\vector(0,-1){96}} +% \put(-7,40){\rotatebox{90}{$radius$}} +% \put(100,0){\FPOINT}\put(89,4){$P_0$} +% \put(100,55){\OPOINT}\put(95,59){$P_1$} +% \put(100,0){\line(1,0){10}}\put(102,55){\line(1,0){8}} +% \put(110,0){\vector(0,1){55}}\put(110,55){\vector(0,-1){55}} +% \put(104,2){{\footnotesize\rotatebox{90}{$0.5523\times radius$}}} +% ^^A +% \put(0,100){\line(0,1){10}}\put(55,102){\line(0,1){8}} +% \put(0,110){\vector(1,0){55}}\put(55,110){\vector(-1,0){55}} +% \put(2,112){{\footnotesize $0.5523\times radius$}} +% ^^A +% \put(55, 100){\OPOINT}\put(57,98){$P_2$} +% \put(0,100){\FPOINT}\put(-12,98){$P_3$} +% \THICKLINES +% \cbezier(100,0)(100,55)(55,100)(0,100) +% \end{picture} +% \end{minipage}\hspace*{\fill} +% \caption[Auxillary macro \cmd{\pIIe@qcircle}---draw a quarter circle]^^A +% {Sketch of the quarter circle path drawn by \cmd{\pIIe@qcircle} (NE~quarter)} +% \label{fig:qcircle} +% \end{figure} +% +% \#1=Switch (0=no `moveto', 1=`moveto'), +% \#2=Quadrant No., \#3=Radius. +% +% \begin{tabular}{l@{\qquad}l} +% 0 = 1st Quadrant (NE) & 1 = 2nd Quadrant (NW) \\ +% 2 = 3rd Quadrant (SW) & 3 = 4th Quadrant (SE) +% \end{tabular} +% +% \noindent +% (\PS: We could use the \texttt{arc} operator!) +% +% $ 0.55228474983 = $``magic\ number'' (see~\cite{EBEZIER}). +% +% Sacrifice a save level (otherwise a private ``switch'' macro were +% necessary!) +% \begin{macrocode} + \newcommand*\pIIe@qcircle[3][0]{% + \begingroup + \@ovro#3\relax \@ovri0.55228474983\@ovro + \@tempdimc\@ovri \advance\@tempdimc-\@ovro + \ifnum#1>\z@ \@tempswatrue \else \@tempswafalse \fi + \ifcase#2\relax +% \end{macrocode} +% \BigIndent NE +% \begin{macrocode} + \pIIe@@qcircle\@ovro\z@\z@\@ovri\@tempdimc\@ovro{-\@ovro}\@ovro + \or +% \end{macrocode} +% \BigIndent NW +% \begin{macrocode} + \pIIe@@qcircle\z@\@ovro{-\@ovri}\z@{-\@ovro}\@tempdimc{-\@ovro}{-\@ovro}% + \or +% \end{macrocode} +% \BigIndent SW +% \begin{macrocode} + \pIIe@@qcircle{-\@ovro}\z@\z@{-\@ovri}{-\@tempdimc}{-\@ovro}\@ovro{-\@ovro}% + \or +% \end{macrocode} +% \BigIndent SE +% \begin{macrocode} + \pIIe@@qcircle\z@{-\@ovro}\@ovri\z@\@ovro{-\@tempdimc}\@ovro\@ovro + \fi + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@@qcircle} +% \changes{v0.1u}{2003/11/21}{New ancillary macro (HjG)} +% Ancillary macro; saves us some tokens above. +% +% Note: +% Use of |rcurveto| instead of |curveto| makes it possible (or at +% least much easier) to re-use this macro for the rounded corners of +% ovals. +% \begin{macrocode} + \newcommand*\pIIe@@qcircle[8]{% + \if@tempswa\pIIe@moveto{#1}{#2}\fi \pIIe@rcurveto{#3}{#4}{#5}{#6}{#7}{#8}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@badcircarg} +% \changes{v0.2h}{2004/01/07}{New error message. (RN,HjG)} +% Obvious cousin to |\@badlinearg| from the \LaTeX\ kernel. +% \begin{macrocode} + \newcommand*\pIIe@badcircarg{% + \PackageError{pict2e}% + {Illegal argument in \protect\circle(*), \protect\oval, \protect\arc(*) or + \protect\circlearc.}% + {The radius of a circle, dot, arc or oval corner must be greater than zero.}}% +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Oval} +% \label{sec:implementation:oval} +% +% \begin{macro}{\maxovalrad} +% User level command, may be redefined by \cmd{\renewcommand*}. +% It may be given as an explicit (rigid) length (i.e., with unit) +% or as a number. +% In the latter case it is used as a factor to be multiplied by +% \cmd{\unitlength}. +% \ (|dimen| and |count| registers should work, too.) \ ^^A +% The default value is 20\,pt as specified for the \oarg{rad} +% argument of \cmd{\oval} by the \LaTeX\ manual +% \cite[p.~223]{LAMPORT}. +% \begin{macrocode} + \newcommand*\maxovalrad{20pt} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@defaultUL} +% \begin{macro}{\pIIe@def@UL} +% The aforementioned behaviour seems necessary, since +% \cite[p.~223]{LAMPORT} does not specify explicitly whether the +% \oarg{rad} argument should be given in terms of \cmd{\unitlength} or +% as an absolute length. +% To implement this feature, we borrow from the \textsf{graphics} +% package: +% See \cmd{\Gin@defaultbp} and \cmd{\Gin@def@bp} from +% \texttt{graphics.dtx}. +% \begin{macrocode} + \newcommand*\pIIe@defaultUL[2]{% + \afterassignment\pIIe@def@UL\dimen@#2\unitlength\relax{#1}{#2}} +% \end{macrocode} +% However, things are simpler in our case, since we always need the +% value stored in \cmd{\dimen@}. +% Hence, we could\slash should omit the unnecessary argument!?) +% \changes{v0.2h}{2004/01/07}{Check for negative or zero radius +% argument (RN,HjG)} +% \changes{v0.2n}{2004/04/22}{Moved radius test to \cmd{\oval}, +% where it belongs (RN/HjG)} +% \begin{macrocode} + \newcommand*\pIIe@def@UL{} + \def\pIIe@def@UL#1\relax#2#3{% +% \if!#1!% +% \def#2{#3}% \edef ? +% \else +% \edef#2{\strip@pt\dimen@}% +% \fi + \edef#2{\the\dimen@}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\oval} +% \begin{macro}{\pIIe@maxovalrad} +% The variant of \cmd{\oval} defined here takes an additional optional +% argument, which specifies the maximum radius of the rounded corners +% (default = 20\,pt, as given above). +% ^^A [Test: length or counter register as optional argument?] +% Unlike \SL, we check for negative or zero radius argument. +% \cmd{\pIIe@maxovalrad} is the internal variant of \cmd{\maxovalrad}. +% \changes{v0.2n}{2004/04/22}{Moved radius test from \cmd{\pIIe@def@UL} +% (RN/HjG)} +% \changes{v0.2n}{2004/04/22}{Allow zero diameter (RN/HjG)} +% \begin{macrocode} + \newcommand*\pIIe@maxovalrad{} + \renewcommand*\oval[1][\maxovalrad]{% + \begingroup \pIIe@defaultUL\pIIe@maxovalrad{#1}% + \ifdim\pIIe@maxovalrad<\z@ \pIIe@badcircarg \fi +% \end{macrocode} +% Can't close the group here, since arguments must be parsed. +% (This is done by calling the saved original.) +% \begin{macrocode} + \pIIe@oldoval} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@oval} +% (This is called in turn by the saved original.) +% \begin{macrocode} + \def\@oval(#1,#2)[#3]{% +% \end{macrocode} +% In analogy to circles, we need only half of the size value. +% \begin{macrocode} + \@ovxx#1\unitlength \divide\@ovxx\tw@ + \@ovyy#2\unitlength \divide\@ovyy\tw@ + \@tempdimc \ifdim\@ovyy>\@ovxx \@ovxx \else \@ovyy \fi + \ifdim\pIIe@maxovalrad<\@tempdimc \@tempdimc\pIIe@maxovalrad\relax \fi +% \end{macrocode} +% Subtract the radius of the corners to get coordinates for the +% straight line segments. +% \begin{macrocode} + \@xdim\@ovxx \advance\@xdim-\@tempdimc + \@ydim\@ovyy \advance\@ydim-\@tempdimc +% \end{macrocode} +% Determine which parts of the oval we have to draw. +% \begin{macrocode} + \pIIe@get@quadrants{#3}% +% \end{macrocode} +% For the whole oval remove use the standard shape of ends. +% \begin{macrocode} + \ifnum15=\@tempcnta \pIIe@buttcap \fi +% \end{macrocode} +% ``\verb+@tempswa+ = false'' means, that we have to suppress the `moveto' +% in the following quadrant. +% \begin{macrocode} + \@tempswatrue +% \end{macrocode} +% The following isn't strictly necessary, but yields a single (unfragmented) +% path even for \verb+[r]+ (right half of oval only). +% Useful for future extensions. +% +% \noindent +% Bits 3 and 0 set? (SE/NE) +% \begin{macrocode} + \ifnum9=\@tempcnta + \pIIe@qoval\z@{-\@ovyy}{\@xdim}{-\@ovyy}\thr@@\@tempdimc\@ovxx\z@ +% \end{macrocode} +% Bit 0 set! (NE) +% \begin{macrocode} + \@tempcnta\@ne + \fi +% \end{macrocode} +% Bit 0 set? (NE) +% \begin{macrocode} + \pIIe@qoval\@ovxx\z@\@ovxx\@ydim\z@\@tempdimc\z@\@ovyy +% \end{macrocode} +% Bit 1 set? (NW) +% \begin{macrocode} + \pIIe@qoval\z@\@ovyy{-\@xdim}\@ovyy\@ne\@tempdimc{-\@ovxx}\z@ +% \end{macrocode} +% Bit 2 set? (SW) +% \begin{macrocode} + \pIIe@qoval{-\@ovxx}\z@{-\@ovxx}{-\@ydim}\tw@\@tempdimc\z@{-\@ovyy}% +% \end{macrocode} +% Bit 3 set? (SE) +% \begin{macrocode} + \pIIe@qoval\z@{-\@ovyy}{\@xdim}{-\@ovyy}\thr@@\@tempdimc\@ovxx\z@ +% \end{macrocode} +% Now we've finished, draw the oval and finally close the group opened +% by \cmd{\oval} above. +% \begin{macrocode} + \pIIe@strokeGraph + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@qoval} +% \changes{v0.1u}{2003/11/21}{New ancillary macro (HjG)} +% \changes{v0.1w}{2003/11/25}{Rename \cmd{\pIIe@oval} +% to \cmd{\pIIe@qoval} (HjG)} +% Ancillary macro; saves us some tokens above. +% +% \noindent +% (\PS: We could use the \texttt{arc} or \texttt{arcto} operator!) +% \begin{macrocode} + \newcommand*\pIIe@qoval[8]{% +% \end{macrocode} +% Bit set? +% \begin{macrocode} + \ifodd\@tempcnta + \if@tempswa\pIIe@moveto{#1}{#2}\fi + \pIIe@lineto{#3}{#4}\pIIe@qcircle{#5}{#6}\pIIe@lineto{#7}{#8}% + \@tempswafalse + \else + \@tempswatrue + \fi +% \end{macrocode} +% Shift by one bit. +% \begin{macrocode} + \divide\@tempcnta\tw@} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@get@quadrants} +% \changes{v0.1t}{2003/11/13}{Rename \cmd{\pIIe@get@ovalquadrants} to +% \cmd{\pIIe@get@quadrants} (RN)} +% According to the parameter (\texttt{tlbr}) bits are set in +% \cmd{\@tempcnta}:\par +% \begin{tabular}{l@{\qquad}l} +% 0 = 1st Quadrant (NE) & 1 = 2nd Quadrant (NW) \\ +% 2 = 3rd Quadrant (SW) & 3 = 4th Quadrant (SE) +% \end{tabular}\par\noindent +% (Cf.\ \cmd{\@oval} and \cmd{\@ovvert} in the \LaTeX\ kernel.) +% We abuse \cmd{\@setfpsbit} from the float processing modules of the +% kernel. +% ^^A (Should this go to section low-level?) +% \begin{macrocode} + \newcommand*\pIIe@get@quadrants[1]{% + \@ovttrue \@ovbtrue \@ovltrue \@ovrtrue \@tempcnta\z@ + \@tfor\reserved@a:=#1\do{\csname @ov\reserved@a false\endcsname}% + \if@ovr \if@ovb\@setfpsbit2\fi \if@ovt\@setfpsbit4\fi \fi + \if@ovl \if@ovb\@setfpsbit1\fi \if@ovt\@setfpsbit8\fi \fi} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Quadratic Bezier Curve} +% \label{sec:implementation:bezier-curves} +% +% \begin{macro}{\@bezier} +% \changes{v0.1u}{2003/11/21}{Change calculation of cubic bezier parameters +% to use less tokens (HjG)} +% \changes{v0.2o}{2004/06/25} +% {Supply \cmd{\ignorespaces} to match kernel version (HjG)} +% \changes{v0.2p}{2004/07/27}{\cmd{\@killglue} added. (RN)} +% +% If \#1=0 the primitive operators ot the (back-end) format are used. +% The kernel version of \cmd{\@bezier} uses \cmd{\put} internally, +% which features \cmd{\@killglue} and \cmd{\ignorespaces} commands +% in turn (at the beginning and end, respectively). +% Since we don't use \cmd{\put}, we have to add the latter commands +% by hand. +% \begin{macrocode} + \def\@bezier#1(#2,#3)(#4,#5)(#6,#7){% + \ifnum #1=\z@ +% \end{macrocode} +% \BigIndent $P_0=(\#2,\#3)$\quad$P_m=(\#4,\#5)$\quad$P_3=(\#6,\#7)$ +% \begin{macrocode} + \@killglue + \begingroup + \@ovxx#2\unitlength \@ovyy#3\unitlength + \@ovdx#4\unitlength \@ovdy#5\unitlength + \@xdim#6\unitlength \@ydim#7\unitlength +% \end{macrocode} +% \noindent +% \BigIndent $P_1 = P_m + 1/3 (P_0 - P_m)$ +% \begin{macrocode} + \pIIe@bezier@QtoC\@ovxx\@ovdx\@ovro + \pIIe@bezier@QtoC\@ovyy\@ovdy\@ovri +% \end{macrocode} +% \BigIndent $P_2 = P_m + 1/3 (P_3 - P_m)$ +% \begin{macrocode} + \pIIe@bezier@QtoC\@xdim\@ovdx\@clnwd + \pIIe@bezier@QtoC\@ydim\@ovdy\@clnht +% \end{macrocode} +% \BigIndent $(P_{0x},P_{0y})$ +% \begin{macrocode} + \pIIe@moveto\@ovxx\@ovyy +% \end{macrocode} +% \BigIndent $(P_{1x},P_{1y})$\quad$(P_{2x},P_{2y})$\quad$(P_{3x},P_{3y})$ +% \begin{macrocode} + \pIIe@curveto\@ovro\@ovri\@clnwd\@clnht\@xdim\@ydim + \pIIe@strokeGraph + \endgroup + \ignorespaces + \else + \pIIe@old@bezier{#1}(#2,#3)(#4,#5)(#6,#7) + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pIIe@bezier@QtoC} +% \changes{v0.1u}{2003/11/21}{New ancillary macro (HjG)} +% Ancillary macro; saves us some tokens above. +% +% \noindent +% Transformation: +% quadratic bezier parameters $\rightarrow$ cubic bezier parameters. +% +% \noindent +% (Missing: Reference for mathematical formula. Or is this trivial?) +% \begin{macrocode} + \newcommand*\pIIe@bezier@QtoC[3]{% + \@tempdimc#1\relax \advance\@tempdimc-#2\relax + \divide\@tempdimc\thr@@ \advance\@tempdimc #2\relax + #3\@tempdimc} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Circle arcs} +% \label{sec:implementation:circle-arcs} +% +% We need some auxiliary dimensions. +% \begin{macrocode} + \ifx\undefined\@arclen \newdimen\@arclen \fi + \ifx\undefined\@arcrad \newdimen\@arcrad \fi + \ifx\undefined\@tempdimd \newdimen\@tempdimd \fi +% \end{macrocode} +% \begin{macro}{\pIIe@arc} +% \#1: 0 (implicit) if we connect arc with a current point, 1 if we start +% drawing by this arc, 2 if we continue drawing. Other parameters: +% coordinates of the center (dimensions), radius (dimension), initial and +% final angle. If the final angle is greater then the initial angle, we +% ``draw'' in the positive sense (anticlockwise) otherwise in the negative +% sense (clockwise). First we check whether the radius is not negative and +% reduce the rotation to the interval $[-720,720]$. +% \begin{macrocode} + \newcommand*\pIIe@arc[6][0]{% + \@arcrad #4\relax + \ifdim \@arcrad<\z@ \pIIe@badcircarg \else + \@arclen #6\p@ \advance\@arclen -#5\p@ + \ifdim \@arclen<\z@ \def\sign{-}\else\def\sign{}\fi + \ifdim \sign\@arclen>720\p@ + \PackageWarning {pict2e}{The arc angle is reduced to -720..720}% + \@whiledim \sign\@arclen>720\p@ \do {\advance\@arclen-\sign360\p@}% + \@tempdima #5\p@ \advance\@tempdima \@arclen + \edef\@angleend{\strip@pt\@tempdima}% + \pIIe@@arc{#1}{#2}{#3}{#4}{#5}{\@angleend}% + \else + \pIIe@@arc{#1}{#2}{#3}{#4}{#5}{#6}% + \fi + \fi} +% \end{macrocode} +% If the angle (its absolute value) is too large, the arc is recursively +% divided into 2 parts until the angle is at most 90~degrees. +% \begin{macrocode} + \newcommand*\pIIe@@arc[6]{% + \begingroup + \ifdim \sign\@arclen>90\p@ + \divide\@arclen 2 + \@tempdima #5\p@ \advance\@tempdima \@arclen + \edef\@anglemid{\strip@pt\@tempdima}% + \def\@temp{\pIIe@@arc{#1}{#2}{#3}{#4}{#5}}% + \expandafter\@temp\expandafter{\@anglemid}% + \def\@temp{\pIIe@@arc{2}{#2}{#3}{#4}}% + \expandafter\@temp\expandafter{\@anglemid}{#6}% + \else +% \end{macrocode} +% We approximate the arc by a Bezier curve. First we calculate the +% coordinates of the initial point: +% \begin{macrocode} + \CalculateSin{#5}\CalculateCos{#5}% + \@tempdima\UseCos{#5}\@arcrad \advance\@tempdima #2\relax + \@tempdimb\UseSin{#5}\@arcrad \advance\@tempdimb #3\relax +% \end{macrocode} +% The coordinates are added to the path if and how necessary: +% \begin{macrocode} + \ifcase #1\relax + \pIIe@lineto\@tempdima\@tempdimb + \or \pIIe@moveto\@tempdima\@tempdimb + \or + \else \PackageWarning {pict2e}% + {Illegal obligatory argument in \protect\circlearc.}% + \fi +% \end{macrocode} +% The distance of control points from the endpoints is $\frac 43 r \tan \frac +% \varphi4$ ($\varphi$ is the angle and $r$ is the radius of the arc). +% \begin{macrocode} + \@tempdimc\@arclen \divide\@tempdimc\@iv + \edef\@angle{\strip@pt\@tempdimc}\CalculateTan{\@angle}% + \@linelen\UseTan{\@angle}\@arcrad \@linelen4\@linelen \divide\@linelen\thr@@ +% \end{macrocode} +% Coordinates of the first control point, added to the path: +% \begin{macrocode} + \advance\@tempdima-\UseSin{#5}\@linelen + \advance\@tempdimb \UseCos{#5}\@linelen + \pIIe@add@nums\@tempdima\@tempdimb +% \end{macrocode} +% Coordinates of the endpoint: +% \begin{macrocode} + \CalculateSin{#6}\CalculateCos{#6}% + \@tempdima \UseCos{#6}\@arcrad \advance\@tempdima #2\relax + \@tempdimb \UseSin{#6}\@arcrad \advance\@tempdimb #3\relax +% \end{macrocode} +% Coordinates of the second control point: +% \begin{macrocode} + \@tempdimc \UseSin{#6}\@linelen \advance\@tempdimc \@tempdima + \@tempdimd-\UseCos{#6}\@linelen \advance\@tempdimd \@tempdimb +% \end{macrocode} +% Adding the second control point and the endpoint to the path +% \begin{macrocode} + \pIIe@add@nums\@tempdimc\@tempdimd + \pIIe@add@CP\@tempdima\@tempdimb + \pIIe@addtoGraph\pIIe@curveto@op + \fi + \endgroup} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\arc} +% The \cmd{\arc} command generalizes (except that the radius instead of the +% diameter is used) the standard \cmd{\circle} adding as an +% obligatory first parameter comma separated pair of angles (initial and +% final). We start with \cmd{\pIIearc} to avoid conflicts with other +% packages. +% \begin{macrocode} + \newcommand*\pIIearc + {\@ifstar{\@tempswatrue\pIIe@arc@}{\@tempswafalse\pIIe@arc@}} + \newcommand*\pIIe@arc@[2][0,360]{\pIIe@arc@@(#1){#2}} + \def\pIIe@arc@@(#1,#2)#3{% + \if@tempswa + \pIIe@moveto\z@\z@ + \pIIe@arc{\z@}{\z@}{#3\unitlength}{#1}{#2}% + \pIIe@closepath\pIIe@fillGraph + \else + \pIIe@arc[1]{\z@}{\z@}{#3\unitlength}{#1}{#2}% + \pIIe@strokeGraph + \fi} + \ifx\undefined\arc + \else + \PackageWarning{pict2e}{\protect\arc\space redefined}% + \fi + \let\arc\pIIearc +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Lines and polygons} +% \label{sec:implementation:lines-polygons} +% +% \begin{macro}{\Line} +% \begin{macro}{\polyline} +% \begin{macro}{\polygon} +% We use recursive macros for \cmd{\polyline} and \cmd{\polygon}. +% \begin{macrocode} + \let\lp@r( \let\rp@r) + \def\Line(#1,#2)(#3,#4){\polyline(#1,#2)(#3,#4)} + \def\polyline(#1,#2){% + \@killglue + \pIIe@moveto{#1\unitlength}{#2\unitlength}% + \@ifnextchar\lp@r{\@polyline}{\PackageWarning{pict2e}% + {Polygonal lines require at least two vertices!}% + \ignorespaces}} + \def\@polyline(#1,#2){% + \pIIe@lineto{#1\unitlength}{#2\unitlength}% + \@ifnextchar\lp@r{\@polyline}{\pIIe@strokeGraph\ignorespaces}} + \def\polygon{% + \@killglue + \@ifstar{\begingroup\@tempswatrue\@polygon}% + {\begingroup\@tempswafalse\@polygon}} + \def\@polygon(#1,#2){% + \pIIe@moveto{#1\unitlength}{#2\unitlength}% + \@ifnextchar\lp@r{\@@polygon}{\PackageWarning{pict2e}% + {Polygons require at least two vertices!}% + \ignorespaces}} + \def\@@polygon(#1,#2){\pIIe@lineto{#1\unitlength}{#2\unitlength}% + \@ifnextchar\lp@r{\@@polygon}{\pIIe@closepath + \if@tempswa\pIIe@fillGraph\else\pIIe@strokeGraph\fi + \endgroup + \ignorespaces}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsubsection{Path commands} +% \label{sec:implementation:path-commands} +% +% \begin{macro}{\moveto} +% \begin{macro}{\lineto} +% \begin{macro}{\curveto} +% \begin{macro}{\circlearc} +% \begin{macro}{\closepath} +% \begin{macro}{\strokepath} +% \begin{macro}{\fillpath} +% Direct access to path constructions in \PS\ and \PDF. +% \begin{macrocode} + \def\moveto(#1,#2){% + \@killglue + \pIIe@moveto{#1\unitlength}{#2\unitlength}% + \ignorespaces} + \def\lineto(#1,#2){% + \@killglue + \pIIe@lineto{#1\unitlength}{#2\unitlength}% + \ignorespaces} + \def\curveto(#1,#2)(#3,#4)(#5,#6){% + \@killglue + \pIIe@curveto{#1\unitlength}{#2\unitlength}{#3\unitlength}{#4\unitlength}% + {#5\unitlength}{#6\unitlength}% + \ignorespaces} + \newcommand*\circlearc[6][0]{% + \@killglue + \pIIe@arc[#1]{#2\unitlength}{#3\unitlength}{#4\unitlength}{#5}{#6}% + \ignorespaces} + \def\closepath{\pIIe@closepath} + \def\strokepath{\pIIe@strokeGraph} + \def\fillpath{\pIIe@fillGraph} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsubsection{Ends of paths, joins of subpaths} +% \label{sec:implementation:ends-joins} +% +% \begin{macro}{\buttcap} +% \begin{macro}{\roundcap} +% \begin{macro}{\squarecap} +% \begin{macro}{\miterjoin} +% \begin{macro}{\roundjoin} +% \begin{macro}{\beveljoin} +% Ends of paths and joins of subpaths in \PS\ and \PDF. +% \begin{macrocode} + \ifcase\pIIe@mode\relax + \or + \newcommand*\pIIe@linecap@op{setlinecap} + \newcommand*\pIIe@linejoin@op{setlinejoin} + \or + \newcommand*\pIIe@linecap@op{J} + \newcommand*\pIIe@linejoin@op{j} + \fi + \def\pIIe@linecap{} + \def\pIIe@linejoin{} + \def\buttcap{\edef\pIIe@linecap{ 0 \pIIe@linecap@op}} + \def\roundcap{\edef\pIIe@linecap{ 1 \pIIe@linecap@op}} + \def\squarecap{\edef\pIIe@linecap{ 2 \pIIe@linecap@op}} + \def\miterjoin{\edef\pIIe@linejoin{ 0 \pIIe@linejoin@op}} + \def\roundjoin{\edef\pIIe@linejoin{ 1 \pIIe@linejoin@op}} + \def\beveljoin{\edef\pIIe@linejoin{ 2 \pIIe@linejoin@op}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Commands from other packages} +% +% \subsubsection{Package \textsf{ebezier}} +% \label{sec:implementation:ebezier} +% +% One feature from~\cite{EBEZIER}. +% +% \begin{macro}{\cbezier} +% \begin{macro}{\@cbezier} +% \changes{v0.2o}{2004/06/25} +% {Supply \cmd{\ignorespaces} to match kernel version (HjG)} +% \changes{v0.2p}{2004/07/27}{\cmd{\@killglue} added. (RN)} +% \begin{macro}{\pIIe@@cbezier} +% \#1, the maximum number of points to use, is simply ignored, +% as well as \cmd{\qbeziermax}. +% +% Like the kernel version of \cmd{\@bezier}, +% the original version of \cmd{\@cbezier} uses \cmd{\put} internally, +% which features \cmd{\@killglue} and \cmd{\ignorespaces} commands +% in turn (at the beginning and end, respectively). +% Since we don't use \cmd{\put}, we have to add the latter commands +% by hand. +% +% ^^A (What about |\lbezier|?) +% +% \noindent +% Original head of the macro:\par +% \verb|\def\cbezier{\@ifnextchar [{\@cbezier}{\@cbezier[0]}}|\par +% \noindent Changed analogous to the \LaTeX\ kernel's \cmd{\qbezier} and +% \cmd{\bezier}: +% \begin{macrocode} + \AtBeginDocument{\@ifundefined{cbezier}{\newcommand}{\renewcommand}*% + \cbezier[2][0]{\pIIe@@cbezier[#1]#2}% + \@ifdefinable\pIIe@@cbezier{}% + \def\pIIe@@cbezier#1)#2(#3)#4(#5)#6({\@cbezier#1)(#3)(#5)(}% + \def\@cbezier[#1](#2,#3)(#4,#5)(#6,#7)(#8,#9){% + \@killglue + \pIIe@moveto{#2\unitlength}{#3\unitlength}% + \pIIe@curveto{#4\unitlength}{#5\unitlength}% + {#6\unitlength}{#7\unitlength}{#8\unitlength}{#9\unitlength}% + \pIIe@strokeGraph + \ignorespaces}% + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsubsection{Other packages} +% \label{sec:implementation:others} +% +% Other macros from various packages may be included in future +% versions of this package. +% ^^A (Or in a sibling package \textsf{pict2x} or \textsf{pict2ext}.) +% +% \subsection{Mode `original'} +% +% ^^A Necessary? Useful? +% ^^A \bigskip +% +% \noindent +% Other branch of the big switch,\label{big-switch-end} +% started near the beginning of the code +% (see page~\pageref{big-switch-begin}). +% \begin{macrocode} +\else +% \end{macrocode} +% +% \begin{macro}{\oval} +% \begin{macro}{\maxovalrad} +% \begin{macro}{\OriginalPictureCmds} +% Gobble the new optional argument and continue with saved version. +% \cmd{\maxovalrad} is there to avoid error messages in case the +% user's document redefines it with \cmd{\renewcommand*}. +% Likewise, \cmd{\OriginalPictureCmds} is only needed for test +% documents. +% \begin{macrocode} + \renewcommand*\oval[1][]{\pIIe@oldoval} + \newcommand*\maxovalrad{20pt} + \newcommand*\OriginalPictureCmds{} +\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Final clean-up} +% +% Restore Catcodes. +% \begin{macrocode} +\Gin@codes +\let\Gin@codes\relax +% \end{macrocode} +% +% \begin{macrocode} +% +% \end{macrocode} +% +% +% \ifdeveloping +% +% \section{Bugs} +% +% Das muss hier besser werden! Wie? longtable!? +% +% \bigskip +% \noindent +% \begin{tabular}{@{}rlccclp{30mm}@{}} +% \hline +% No. & Submitted by & Reported & V.no. & Fixed & Fixed by +% & Remark \\ +% \hline +% \hline +% 1 & Volker Kiefel & 2004/05/29 & v0.2o & 2004/06/25 & HjG +% & Trouble with language support; e.g., \texttt{german.sty}. +% ($\mapsto$ Save and restore catcodes.) \\ +% \hline +% 2 & Dwight Aplevich & 2004/06/04 & v0.2o & 2004/06/25 & HjG +% & Cannot connect two |\cbezier| curves (second one displaced). +% ($\mapsto$ Supply |\ignorespaces| in definition of bezier +% commands.) \\ +% \hline +% 3 & Alan G. Isaac & 2004/06/23 & v0.2o & 2004/06/25 & HjG +% & Like \#2. \\ +% \hline +% \end{tabular} +% +% \iffalse +% \newenvironment{erratalist} +% {\begin{longtable}{r>{\raggedright}p{2cm}l>{\raggedright}p{10cm}l}} +% {\endgobble\end{longtable}} +% \fi +% +% \bigskip +% \noindent +% \begin{longtable}{@{}r^^A No. +% >{\raggedright}p{2cm}^^A Submitted +% >{\raggedright}p{2cm}^^A Fixed +% >{\raggedright}p{8.5cm}^^A Remark +% @{}} +% \hline +% No. & Submitted & Fixed & Remark (Synopsis and Fix) +% \tabularnewline \hline \hline +% 1 & v0.2n? 2004/05/29 Volker Kiefel +% & v0.2o 2004/06/25 HjG +% & Trouble with language support; e.g., \texttt{german.sty}. +% \\ ($\mapsto$ Save and restore catcodes.) +% \tabularnewline \hline +% 2 & v0.2n? 2004/06/04 Dwight Aplevich +% & v0.2o 2004/06/25 HjG +% & Cannot connect two |\cbezier| curves (second one displaced). +% \\ ($\mapsto$ Supply |\ignorespaces| in definition of bezier +% commands.) +% \tabularnewline \hline +% 3 & v0.2n? 2004/06/23 Alan G. Isaac +% & v0.2o 2004/06/25 HjG +% & Like \#2. +% \tabularnewline \hline +% \end{longtable} +% +% \bigskip +% \noindent +% \begin{tabular}{@{}r>{\raggedright}p{.6\textwidth}@{}}^^A tabularx? RN +% \hline +% \begin{tabular}[t]{@{}>{\bfseries}rl@{}} +% No. & 1 \\ +% Submitted by & Volker Kiefel \\ +% Reported & 2004/05/29 \\ +% Version & v0.2o \\ +% Fixed & 2004/06/25 \\ +% Fixed by & HjG +% \end{tabular} & +% Trouble with language support; e.g., \texttt{german.sty}. +% ($\mapsto$\,Save and restore catcodes.) +% \tabularnewline \hline +% \begin{tabular}[t]{@{}>{\bfseries}rl@{}} +% No. & 2 \\ +% Submitted by & Dwight Aplevich \\ +% Reported & 2004/06/04 \\ +% Version & v0.2o \\ +% Fixed & 2004/06/25 \\ +% Fixed by & HjG +% \end{tabular} & +% Cannot connect two |\cbezier| curves (second one displaced). +% ($\mapsto$ Supply |\ignorespaces| in definition of bezier +% commands.) +% \tabularnewline \hline +% \begin{tabular}[t]{@{}>{\bfseries}rl@{}} +% No. & 3 \\ +% Submitted by & Alan G. Isaac \\ +% Reported & 2004/06/23 \\ +% Version & v0.2o \\ +% Fixed & 2004/06/25 \\ +% Fixed by & HjG +% \end{tabular} & +% Like \#2. +% \tabularnewline \hline +% \end{tabular} +% +% \bigskip +% \noindent +% \begin{longtable}{@{}rp{.6\textwidth}@{}} +% \hline +% \begin{tabular}[t]{@{}>{\bfseries}rl@{}} +% No. & 1 \\ +% Submitted by & Volker Kiefel \\ +% Reported & 2004/05/29 \\ +% Version & v0.2o \\ +% Fixed & 2004/06/25 \\ +% Fixed by & HjG +% \end{tabular} & +% Trouble with language support; e.g., \texttt{german.sty}. +% ($\mapsto$\,Save and restore catcodes.) +% \tabularnewline \hline +% \begin{tabular}[t]{@{}>{\bfseries}rl@{}} +% No. & 2 \\ +% Submitted by & Dwight Aplevich \\ +% Reported & 2004/06/04 \\ +% Version & v0.2o \\ +% Fixed & 2004/06/25 \\ +% Fixed by & HjG +% \end{tabular} & +% Cannot connect two |\cbezier| curves (second one displaced). +% ($\mapsto$ Supply |\ignorespaces| in definition of bezier +% commands.) +% \tabularnewline \hline +% \begin{tabular}[t]{@{}>{\bfseries}rl@{}} +% No. & 3 \\ +% Submitted by & Alan G. Isaac \\ +% Reported & 2004/06/23 \\ +% Version & v0.2o \\ +% Fixed & 2004/06/25 \\ +% Fixed by & HjG +% \end{tabular} & +% Like \#2. +% \tabularnewline \hline +% \end{longtable} +% +% \fi +% +% +% \Finale +\endinput diff --git a/macros/latex/contrib/pict2e/pict2e.ins b/macros/latex/contrib/pict2e/pict2e.ins new file mode 100644 index 0000000000..eca122a616 --- /dev/null +++ b/macros/latex/contrib/pict2e/pict2e.ins @@ -0,0 +1,109 @@ +%% +%% Copyright (C) 2003-2016 +%% Rolf Niepraschk, Rolf.Niepraschk@gmx.de +%% Hubert Gaesslein, hubertjg@gmx.de +%% Josef Tkadlec, j.tkadlec@email.cz +%% +%% This file is part of the LaTeX `pict2e' package. +%% ------------------------------------------------ +%% +%% 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 2003/12/01 or later. +%% +%% This work has the LPPL maintenance status "author-maintained". +%% +%% In particular, NO PERMISSION is granted to modify the contents of this +%% file since it contains the legal notices that are placed in the files +%% it generates. +%% +%% This work consists of all files listed in manifest.txt. +%% +%% +%% --------------- start of docstrip commands ------------------ +%% + +\input docstrip + +\preamble + +Copyright (C) 2003-2016 +Rolf Niepraschk, Rolf.Niepraschk@gmx.de +Hubert Gaesslein, +Josef Tkadlec, j.tkadlec@email.cz + +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 2003/12/01 or later. + +This work has the LPPL maintenance status "author-maintained". + +This work consists of all files listed in `manifest.txt'. + +\endpreamble + +\keepsilent +\askforoverwritefalse + +\usedir{tex/latex/pict2e} + +\generate{\file{pict2e.sty}{\from{pict2e.dtx}{package}}} + +%% Generate a `template' .def file as an example for a new driver. +%% (This is not set up yet.) +%% \generate{\file{p2e-template.def}{% +%% \from{p2e-drivers.dtx}{template}}} + +\generate{ + \file{p2e-dvips.def}{% + \from{p2e-drivers.dtx}{dvips}} +% \file{p2e-xdvi.def}{% +% \from{p2e-drivers.dtx}{xdvi}} + \file{p2e-pdftex.def}{% + \from{p2e-drivers.dtx}{pdftex}} + \file{p2e-vtex.def}{% + \from{p2e-drivers.dtx}{vtex}} + \file{p2e-dvipdfm.def}{% + \from{p2e-drivers.dtx}{dvipdfm}} + \file{p2e-dvipdfmx.def}{% + \from{p2e-drivers.dtx}{dvipdfmx}} + \file{p2e-xetex.def}{% + \from{p2e-drivers.dtx}{xetex}} + \file{p2e-textures.def}{% + \from{p2e-drivers.dtx}{textures}} + \file{p2e-pctexps.def}{% + \from{p2e-drivers.dtx}{pctexps}} + \file{p2e-pctex32.def}{% + \from{p2e-drivers.dtx}{pctex32}} + \file{p2e-luatex.def}{% + \from{p2e-drivers.dtx}{luatex}} +} + + +%\usepreamble\empty +%\usepostamble\empty +\generate{\file{pict2e-example.cfg}{\from{p2e-drivers.dtx}{cfg}}} + + +\Msg{***********************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* files into a directory searched by TeX:} +\Msg{*} +\Msg{* All the files with extension `.sty' and `.def'} +\Msg{*} +\Msg{* To produce the documentation run the .dtx files through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing} +\Msg{***********************************************************} + + +\endbatchfile diff --git a/macros/latex/contrib/pict2e/pict2e.pdf b/macros/latex/contrib/pict2e/pict2e.pdf new file mode 100644 index 0000000000..df33032e04 Binary files /dev/null and b/macros/latex/contrib/pict2e/pict2e.pdf differ -- cgit v1.2.3