% \def\InternetAddress{imaclain@gmail.com} % \iffalse meta-comment % % Program curves % Copyright (C) 1991 - 2017 Ian Maclaine-Cross % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. % The latest version of this license is in % http://www.latex-project.org/lppl.txt % and version 1.3 or later is part of all distributions of LaTeX % version 2005/12/01 or later. % % This work has the LPPL maintenance status `maintained'. % % The Current Maintainer of this work is Ian Maclaine-Cross % . % % This work consists of the files README and curves.dtx, curves.ins % and the derived files curves.sty and curvesls.sty. % % Curves.sty provides curve and polygon drawing commands for % the standard LaTeX picture environment. % % When LaTeX is run with input file curves.ins, the docstrip % utility generates curves.sty and curvesls.sty and when run % with file curves.dtx the users manual. % % \fi % % \CheckSum{2060} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % % \iffalse %<*dtx> \ProvidesFile{curves.dtx} % %\NeedsTeXFormat{LaTeX2e} %\ProvidesPackage{curves} %\ProvidesFile{curves.drv} %<*package,driver> % \fi % \ProvidesFile{curves.dtx} [2017/08/25 1.55 Curves for LaTeX picture environment] % % \iffalse % %<*driver> \documentclass{ltxdoc} \usepackage{curves} %% \usepackage[dvips]{curves} \usepackage{hyperref} %% Insert % at the start of the \OnlyDescription line below to %% add commented listings of curves.sty and curvesls.sty to print out. \OnlyDescription \begin{document} \DocInput{curves.dtx} \end{document} % % \fi % % \GetFileInfo{curves.dtx} % % \changes{1.42}{2000/08/12}{Last compatible with LaTeX 2.09} % \changes{1.50}{2000/08/22}{Files merged, docstrip, LPPL and PostScript added} % \changes{1.51}{2008/04/24}{New email address and corrections in doc} % \changes{1.52}{2008/08/29}{Upstream website in doc, straight segment switch} % \changes{1.53}{2008/09/29}{Hyperref in doc} % \changes{1.55}{2017/08/25}{Error figures p.4 Thomas Bucaioni} % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \title{\bf The \textsf{curves} Package\thanks{This file % has version number \fileversion, last % revised \filedate.}} % % \author{Ian Maclaine-Cross\\ % \small Internet: \texttt{\InternetAddress}} % \date{25 August 2017} % \maketitle % % \begin{abstract} % Draws curves in the \LaTeXe\ |picture| environment using % parabolic arcs between data points with continuous slope at % joins. For circles and circular arcs uses up to 16 parabolic % arcs. Also draws symbols or dash patterns along curves. A % straight side switch changes curves to polygons. Extends % |picture| capability without extra programs and data files. % Parabolic arcs consist of short chords drawn by overlapping disks % or line drawing |\special|s selected by package options. % \end{abstract} % \thispagestyle{empty} % \tableofcontents % \section{Introduction} % % The |picture| environment in the \LaTeXe \footnote{Leslie Lamport, % {\sl \LaTeX\ A Document Preparation System 2nd ed.,} % Addison-Wesley, 1994.} macro package for \TeX \footnote{Donald % E. Knuth, {\sl The \TeX book,} Addison-Wesley, 1984.} allows % simple line drawing using characters. These characters include % quadrant circular arcs, solid disks with diameters from 1 to % 15pt\footnote{A printer's point, abbreviated pt, is approximately % 0.351460 mm.} and short lines with a limited range of slopes in % two thicknesses. A |\begin{picture}| command defines an area where % following commands place these characters to draw a \LaTeX\ picture. % % \LaTeX\ \textsf{picture}s save disk space for source descriptions and % computer time in producing documents compared with printer commands or % bit mapped graphics. From initial pencil sketch on squared graph % paper to final printout, they take half the time for manual pen % drawings. The labor savings are higher for revisions and rewrites. % Unfortunately standard \LaTeX\ cannot yet draw curves like a % pen, compass and French curves can. Fortunately there are many macro % packages which supplement \LaTeXe's capabilities and do % marvellous graphical things for any printing need\footnote{Michel % Goossens, Sebastian Rahtz and Frank Mittelbach, % \textsl{The LaTeX Graphics Companion,} Addison-Wesley, 1997.}. % \textsf{Curves} just adds curve and polygon drawing % to \LaTeX\ \texttt{picture}s. With \textsf{curves} most line drawings % require no additional source or binary files or programs. % % Brief descriptions, simple examples and a command summary follow. They % presume familiarity with relevant chapters of the \LaTeX\ % manual\footnotemark[1]. % % \section{Installation} % % \DescribeMacro{curves.sty} % To create the file \texttt{curves.sty} you need \LaTeXe\ and a command like: % \begin{verbatim} % $ latex curves.ins % \end{verbatim} % Put \texttt{curves.sty} and \texttt{curvesls.sty} in your default or a % \texttt{texinput} directory. The package \textsf{curvesls} provides % compatibility for old documents. Comprehensive \TeX\ distributions % preinstall \textsf{curves} so for most users the above step is unnecessary. % % Put \texttt{curves} in a |\usepackage| command at the top of your % main {\tt .tex} file for any document where you wish to use % \textsf{curves} {\it e.g.\/,} % \begin{verbatim} % \documentclass[11pt]{article} % \usepackage{curves} % \end{verbatim} % Do not combine {\tt curves} with {\tt bezier} in this command. % \textsf{Curves} contains a fast powerful replacement for the |\bezier| % command. Drawings using the |\bezier| command should not change % their appearance. % % \DescribeMacro{dvips} \DescribeMacro{emtex} \DescribeMacro{xdvi} % \DescribeMacro{WML} % The \textsf{curves} package has options to save \TeX\ memory and runtime % using |\special| commands to draw the straight lines which approximate % curves. Select an option only if your program for % viewing or printing \TeX's |dvi| files recognizes and uses the % corresponding |\special|s. Otherwise the curves or polygons on % your drawings will be invisible. The \texttt{dvips} option uses the % em\TeX\ |\special|s of |dvips| which draw lines with rounded ends. % The \texttt{emtex} option uses the original |\special|s of % em\TeX\ by Eberhard Mattes with disks added to hide their square ends. % The \texttt{xdvi} option uses the PostScript |\special|s of Tomas % Rokicki's |dvips| to draw lines which the \texttt{xdvi} viewer now % implements. |WML| are new versions of the em\TeX\ |\special|s in % |dvips| with compact names. No options draws lines using % disks from standard \LaTeX\ fonts. % No options or |dvips| work with the \textsf{color} package % but other drivers may or may not. Select package options when required by % modifying |\usepackage| like: % \begin{verbatim} % \usepackage[dvips]{curves} % \end{verbatim} % % \DescribeMacro{PDF} % Use no option with single pass pdf\TeX\footnote{\label{fn:MG}Frank % Mittelbach and Michel Goossens, {\sl The \LaTeX\ Companion 2nd ed.,} % Addison-Wesley, 2004.} or pdf\LaTeX. % With \textsf{curves} the \texttt{dvips} option with \LaTeX\ % followed by \texttt{dvips} and \texttt{ps2pdf}\footnote{A script % which converts PostScript to PDF using % \textsf{ghostscript}.} usually produces the smallest Portable Document % Format file. % % \DescribeMacro{BOX} % A drawing frequently uses auxiliary commands to size, place, label and % caption it. The following commands draw the box in Figure~\ref{box} on % page~\pageref{box}: % % \begin{figure} % \begin{center} % \setlength{\unitlength}{1mm} % \begin{picture}(100,50) \large\sf % \linethickness{1mm} % \put(20,5){\framebox(60,40){BOX}} % \end{picture} % \end{center} % \caption{This is a box.} % \label{box} % \end{figure} % % \begin{verbatim} % \begin{figure} % \begin{center} % \setlength{\unitlength}{1mm} % \begin{picture}(100,50) \large\sf % \linethickness{1mm} % \put(20,5){\framebox(60,40){BOX}} % \end{picture} % \end{center} % \caption{This is a box.} % \label{box} % \end{figure} % \end{verbatim} % Lamport\footnotemark[1] explains these commands. This example is for those % unfamiliar with the \LaTeX\ picture environment. The following examples % avoid the \textsf{figure} environment but it is often essential. % % \section{Curves and Polygons} % \label{curves} % % \DescribeMacro{\curve} \DescribeMacro{\closecurve} \DescribeMacro{\tagcurve} % The commands, |\curve|, |\closecurve| and % |\tagcurve|, draw parabolic arcs between coordinate points in the % argument\footnote{Please see Section~\ref{summary} for full % descriptions of \textsf{curves} commands.}. % The segments' tangents at these points are parallel to each other % and to straight lines through the points either side. Segments at % |\curve| ends are parabolic arcs with the point second from the end a % vertex. |\closecurve| adds a % parabolic arc between end points to close the curve. |\tagcurve| omits the % first and last segments drawing curves with end tangents specified. % When only three points are specified |\tagcurve| draws the last segment. The % table following shows these features. % % \DescribeMacro{\straightfalse} \DescribeMacro{\straighttrue} % The command |\straighttrue| causes all following \textsf{curves} % to use straight lines between coordinate points giving polygons % as in the following table. % The default or after the command |\straightfalse| is to draw the % curves described in the preceding paragraph. % % \begin{flushright} % \setlength\unitlength{0.4pt} % \linethickness{0.7mm} % \makebox[0pt][r]{ % \begin{tabular}{lcc} % Example & Curve & Polygon\\ % & \makebox[6em][r]{\tt\char92 straightfalse} % & \makebox[6em][l]{\tt\char92 straighttrue}\\ % \hline % \raisebox{60\unitlength}{\tt\char92 curve(0,0, 50,100, 100,0)} & % \straighttrue % \begin{picture}(100,120)(0,-10) % \straightfalse % \curve(0,0, 50,100, 100,0) % \end{picture} & % \straighttrue % \begin{picture}(100,120)(0,-10) % \straighttrue % \curve(0,0, 50,100, 100,0) % \end{picture}\\ % \raisebox{80\unitlength}{\tt\char92 closecurve(0,0, 50,100, 100,0)} & % \begin{picture}(100,170)(0,-60) % \straightfalse % \closecurve(0,0, 50,100, 100,0) % \end{picture} & % \begin{picture}(100,170)(0,-60) % \straighttrue % \closecurve(0,0, 50,100, 100,0) % \end{picture} \\ % \raisebox{60\unitlength}{% % \tt\char92 tagcurve(100,0, 0,0, 50,100, 100,0, 0,0)} & % \begin{picture}(120,120)(-10,-10) % \straightfalse % \tagcurve(100,0, 0,0, 50,100, 100,0, 0,0) % \end{picture} & % \begin{picture}(120,120)(-10,-10) % \straighttrue % \tagcurve(100,0, 0,0, 50,100, 100,0, 0,0) % \end{picture} \\ % \hline % \end{tabular}}\\ % \end{flushright} % % \DescribeMacro{\arc} \DescribeMacro{\curve} % Axial flow fans often use the RAF 6E aerofoil section. The section % coordinates in the following macro come directly from aerodynamic % tables\footnote{R.A. Wallis, {\sl Axial Flow Fans,} Academic Press, 1961, % p.335}. The |\arc| commands draw the leading and trailing radii and the % two coordinate |\curve| the flat chord. % \begin{verbatim} % \newcommand{\RAFsixE}{ % \scaleput(1.25,1.25){\arc(0,-1.25){-135}} % \scaleput(0,0){\curve(0.366,2.133, 1.25,3.19, 2.5,4.42, % 5.0,6.10, 7.5,7.24, 10,8.09, 15,9.28, 20,9.90, 30,10.3, % 40,10.22, 50,9.80, 60,8.98, 70,7.70, 80,5.91, 90,3.79, % 95,2.58, 99.24,1.52)} % \scaleput(99.24,0.76){\arc(0,-0.76){180}} % \scaleput(0,0){\curve(1.25,0, 99.24,0)} % } % \end{verbatim} % \newcommand{\RAFsixE}{% % \scaleput(1.25,1.25){\arc(0,-1.25){-135}} % \scaleput(0,0){\curve(0.366,2.133, 1.25,3.19, 2.5,4.42, % 5.0,6.10, 7.5,7.24, 10,8.09, 15,9.28, 20,9.90, 30,10.3, % 40,10.22, 50,9.80, 60,8.98, 70,7.70, 80,5.91, 90,3.79, % 95,2.58, 99.24,1.52)} % \scaleput(99.24,0.76){\arc(0,-0.76){180}} % \scaleput(0,0){\curve(1.25,0, 99.24,0)} % } % In a picture environment like: % \begin{verbatim} % \begin{picture}(100,20) % \RAFsixE % \end{picture} % \end{verbatim} % this macro draws: % \linethickness{0.7mm} % \setlength\unitlength{0.5mm} % \begin{center} % \begin{picture}(100,20) % \RAFsixE % \end{picture}\\ % The RAF 6E has a flat undersurface. % \end{center} % % \DescribeMacro{\bigcircle} % The drawing command |\bigcircle| works similarly to |\circle| % except there is no |\circle*| equivalent. The following section scales it % to an ellipse. % % \section{Scaling} % \DescribeMacro{\unitlength} \DescribeMacro{\put} % The size of \LaTeX\ picture objects may be uniformly scaled by preceding % them with: % \begin{verbatim} % \setlength{\unitlength}{\scale\unitlength} % \end{verbatim} % the desired scale factor |\scale| % is previously defined perhaps with % |\newcommand| % as a decimal number. The new coordinates of a point \((x',y')\) % relative to the current origin are related to the old % coordinates \((x,y)\) relative to the same origin by % \begin{eqnarray*} % x' &=& x \times |\scale| \\ % y' &=& y \times |\scale| % \end{eqnarray*} % If a |\put(|$x,y$|){...}| followed the change in |\unitlength| it would % actually put the objects |{...}| at \((x',y')\). % Objects defined by |\unitlength| in |{...}| would also be larger by % |\scale|. Lamport\footnotemark[1] describes these commands. % % \DescribeMacro{\scaleput} \DescribeMacro{\xscale} % \DescribeMacro{\xscaley} % \DescribeMacro{\yscale} \DescribeMacro{\yscalex} % The scale factors |\xscale|, |\xscaley|, |\yscale| and |\yscalex| % are initially defined to be 1, 0, 1 and 0 respectively but may be % redefined to any decimal number using |\renewcommand|. After they % are redefined the new coordinates of a point \((x',y')\) % relative to the current origin are related to the old % coordinates \((x,y)\) relative to the same origin by % \begin{eqnarray*} % x' &=& x \times |\xscale| + y \times |\xscaley|\\ % y' &=& x \times |\yscalex| + y \times |\yscale| % \end{eqnarray*} % If a |\scaleput(|$x,y$|){...}| followed the change in these factors it would % actual put the objects |{...}| at \((x',y')\). All the drawing % commands in \textsf{curves} use the current values of these four scale % factors in placing disks and chords. % % These factors can rotate pictures which like |\RAFsixE| are made solely % with \textsf{curves} commands. The % factors following rotate the RAF~6E through 12$^\circ$ clockwise about its % {\tt (0,0)} co-ordinate: % \begin{verbatim} % \renewcommand{\xscale}{0.9781} % \renewcommand{\xscaley}{0.2079} % \renewcommand{\yscale}{0.9781} % \renewcommand{\yscalex}{-0.2079} % \put(0,20){\RAFsixE} % \end{verbatim} % This draws: % \begin{center} % \begin{picture}(120,30)(-20,0) % \renewcommand{\xscale}{0.9781} % \renewcommand{\xscaley}{0.2079} % \renewcommand{\yscale}{0.9781} % \renewcommand{\yscalex}{-0.2079} % \put(0,20){\RAFsixE} % \thicklines % \put(-20,5){\vector(1,0){20}} % \end{picture} % % The RAF 6E has maximum lift at angles of attack over 12$^\circ$. % \end{center} % Note that \(\cos12^\circ\approx0.9781\) and \(\sin12^\circ\approx0.2079\) % \let\RAFsixE\relax % % \DescribeMacro{\arc} \DescribeMacro{\bigcircle} % Axonometric projection is another scaling application. Circles become % ellipses and circular arcs become elliptical arcs. The commands drawing the % ellipse and arc in the following washer are: % \begin{verbatim} % \put(20,5){ % \renewcommand{\xscale}{1} % \renewcommand{\xscaley}{-1} % \renewcommand{\yscale}{0.6} % \renewcommand{\yscalex}{0.6} % \scaleput(10,10){\bigcircle{10}} % \put(0,-2){ % \scaleput(10,10){\arc(5,0){121}} % \scaleput(10,10){\arc(5,0){-31}} % } % } % \end{verbatim} % {\tt (20,5)} are the drawing coordinates of the upper vertex of the washer % closest to the reader. The angles for the |\arc|s were found by trial and % error. % \begin{center} % \setlength\unitlength{1mm} % \begin{picture}(40,30) % \thicklines % \multiput(20,5)(20,12){2}{\line(0,-1){2}\line(-5,3){20}} % \multiput(20,5)(-20,12){2}{\line(5,3){20}} % \put(20,3){\line(5,3){20}} % \put(20,3){\line(-5,3){20}} % \put(0,15){\line(0,1){2}} % \linethickness{1pt} % \put(20,5){ % \renewcommand{\xscale}{1} % \renewcommand{\xscaley}{-1} % \renewcommand{\yscale}{0.6} % \renewcommand{\yscalex}{0.6} % \scaleput(10,10){\bigcircle{10}} % \put(0,-2){ % \scaleput(10,10){\arc(5,0){121}} % \scaleput(10,10){\arc(5,0){-31}} % } % } % \end{picture} % % Square washers are sometimes preferred for soft materials. % \end{center} % % \section{Symbols} % \label{symbols} % % \DescribeMacro{\curvesymbol} \DescribeMacro{\curve} % \textsf{Curves} can also place symbols. |\curvesymbol| must first define % the symbol as anything a |\put| or |\multiput| may draw. A negative % symbol count between drawing command and coordinates {\it e.g.,} % |\tagcurve[-3](0,100,...)| fixes the number of symbols per curve segment. % % These commands draw flight times and successive positions in the following % drawing: % \begin{verbatim} % \newcounter{time} % \curvesymbol{\thetime\,s\addtocounter{time}{1}} % \put(5,4){\curve[-2](0,0, 9.8,19.6, 19.6,0)} % \curvesymbol{\phantom{\circle*{1}}\circle*{1}} % \put(5,2){\curve[-2](0,0, 9.8,19.6, 19.6,0)} % \end{verbatim} % where |\phantom| is a plain \TeX\ command from the \TeX % book\footnotemark[2]. The \LaTeX\ |\circle| characters have centres % on the left side of their \TeX\ boxes. The invisible |\phantom{\circle*{1}}| % increases the width of the box on the left so the visible |\circle*{1}| is % at the centre of the box formed by the two characters. % \begin{center} % \setlength\unitlength{2mm} % \begin{picture}(40,35)(-5,-5) \sf % \thicklines % \newcounter{time} % \curvesymbol{\thetime\,s\addtocounter{time}{1}} % \put(5,4){\curve[-2](0,0, 9.8,19.6, 19.6,0)} % \curvesymbol{\phantom{\circle*{1}}\circle*{1}} % \put(5,2){\curve[-2](0,0, 9.8,19.6, 19.6,0)} % \put(0,0){\vector(0,1){28}} % \put(0,0){\vector(1,0){30}} % \multiput(5,0)(5,0){5}{\line(0,1){1}} % \multiput(0,5)(0,5){5}{\line(1,0){1}} % \setcounter{time}{0} % \multiput(0,-1)(5,0){6}{\makebox(0,0)[t]{\thetime}\addtocounter{time}{5}} % \put(28,-1){\makebox(0,0)[tl]{$x$ (m)}} % \setcounter{time}{0} % \multiput(-1,0)(0,5){6}{\makebox(0,0)[r]{\thetime}\addtocounter{time}{5}} % \put(-1,27){\makebox(0,0)[rb]{$y$ (m)}} % \end{picture} \\ % Successive positions of a sphere with initial position $(5,2)$ m,\\ initial % velocity $(4.9,19.6)$ m/s, and acceleration $(0,-9.8)$ m/s$^2$. \\ % The flight time is recorded above each sphere position. % \end{center} % % \DescribeMacro{\curvedashes} \DescribeMacro{\curvelength} % \DescribeMacro{\curvesymbol} % Fixed spacing of symbols at lengths other than the segment's requires more % commands. Empty |\curvedashes|, empty |\curvesymbol| and negative % symbol count stops drawing so a drawing command will calculate % |\curvelength| only. |\curvesymbol| then resets the symbol and % |\curvedashes| sets the spacing to its pattern length. If there are no % symbols at the ends, |\overhang| pulls symbols along the curve. The last % command with no symbol count draws the symbols. % % \DescribeMacro{\arc} \DescribeMacro{\bigcircle} % |\arc| and |\bigcircle| use sixteen segments for a circle so if % eight symbols are required the fixed spacing technique is necessary. The % following commands draw the pin numbers on a relay base: % % \begin{verbatim} % \newcounter{pin} % \curvedashes{} % \curvesymbol{} % \put(60,60){\arc[-1](40,0){-360}} % \setlength{\curvelength}{0.125\curvelength} % \curvedashes[\curvelength]{1} % \setlength{\overhang}{0.5\curvelength} % \curvesymbol{\addtocounter{pin}{1}\thepin} % \put(60,60){\arc(40,0){-360}} % \end{verbatim} % % \begin{center} % \setlength\unitlength{0.3mm} % \begin{picture}(120,120) \sf % \thicklines % \linethickness{1pt} % \curvedashes{} % \curvesymbol{} % ^^A base % \put(60,60){\bigcircle{100}} % ^^A spigot % \put(60,60){\arc(10,3){325}\put(10,0){\arc(0,3){-180}}} % ^^A pins % \put(60,60){\bigcircle[-1]{60}} % \setlength{\curvelength}{0.125\curvelength} % \curvedashes[\curvelength]{1} % \overhang0.5\curvelength % \curvesymbol{\phantom{\circle{5}}\circle{5}} % \put(60,60){\bigcircle{60}} % ^^A pin numbers % \newcounter{pin} % \curvedashes{} % \curvesymbol{} % \put(60,60){\arc[-1](40,0){-360}} % \divide\curvelength8 % \curvedashes[\curvelength]{1} % \setlength{\overhang}{0.5\curvelength} % \curvesymbol{\addtocounter{pin}{1}\thepin} % \put(60,60){\arc(40,0){-360}} % \end{picture} \\ \nobreak % The pin numbering of plug-in relays is clockwise \\ % from the spigot key when viewed from below. % \end{center} % % \DescribeMacro{\patternresolution} \DescribeMacro{\overhang} % If symbols and dash pattern exist and |\overhang| is 0pt, \textsf{curves} % draw the first position blank. For equal spacing they draw the last position % blank if rounding error causes the last pattern to be slightly short. If % |\renewcommand| changes |\patternresolution|, rounding error changes % and the final symbol may reappear. To avoid fiddling with % |\patternresolution| for closed curves with symbols equally spaced, use an % |\overhang| which is a fraction of a pattern length as in the previous % example. % % \section{Dashes} % % \DescribeMacro{\curvedashes} % |\curvedashes| must first define a dash pattern with length greater % than 0pt. Many symbol and pattern combinations are possible. The fixed number % and fixed spacing methods of symbol drawing described in % Section~\ref{symbols} % work with three methods of drawing dashes which are: % \begin{enumerate} % \item if there is no symbol count and no symbol, a dash pattern with its % length reduced by |\csdiameter| is drawn between symbols spaces of width % close to |\csdiameter| to give an overall spacing equal to the pattern % length specified by the |\curvedashes| command; % \item if there is a symbol count but no symbol, the dash patterns drawn have % their length equal to that defined by |\curvedashes| with % |\csdiameter| gaps at symbol positions; % \item if there is a symbol count and a symbol, the dash patterns drawn have % their length adjusted slightly so an integral number of patterns fit between % symbol positions. % \end{enumerate} % % Dash pattern commands for centrelines\footnote{R.N. Roth and I.A. van % Haeringen, {\sl The Australian Engineering Drawing Handbook, Part~1 Basic % Principles and Techniques,} The Institution of Engineers, Australia, % Canberra, 1986.} follow for the three techniques above in order: % \begin{verbatim} % \linethickness{0.25mm} % \curvedashes[1.2mm]{0,8,1,3,1,8} % \settowidth{\csdiameter}{00} % \put(0,20){\curve(0,0, 30,5, 60,0)} % \put(0,10){\curve[1](0,0, 30,5, 60,0)} % \curvesymbol{\thepin\addtocounter{pin}{1}} % \setlength{\csdiameter}{2\csdiameter} % \put(0,0){\curve[1](0,0, 30,5, 60,0)} % \end{verbatim} % % The following figure shows the resulting dash patterns. The upper line has % first position blank because the |\overhang| is 0pt. It has patterns % shrunk to scale between symbol spaces {\it e.g.,}~1 to~2, and symbol space % centres one pattern length apart. The middle line has patterns close to % defined length but with the first dash part blanked by half of symbol space~3 % and the second pattern broken in its first dash by symbol space~4. The lower % line patterns are stretched between symbol spaces. Which pattern is % appropriate depends on picture meaning and function. % % \begin{center} % \setlength\unitlength{1mm} % \begin{picture}(60,25) \sf % \setcounter{pin}{1} % \linethickness{0.25mm} % \curvedashes[1.2mm]{0,8,1,3,1,8} % \settowidth{\csdiameter}{00} % \put(0,20){\curve(0,0, 30,5, 60,0)} % \put(0,10){\curve[1](0,0, 30,5, 60,0)} % \curvesymbol{\thepin\addtocounter{pin}{1}} % \setlength{\csdiameter}{2\csdiameter} % \put(0,0){\bezier{-2}(0,0)(30,10)(60,0)} % \put(0,20){\curve(0,0, 30,5, 60,0)} % \curvedashes{} % \put(0,10){\curve[-1](0,0, 30,5, 60,0)} % \put(0,0){\bezier{-2}(0,0)(30,10)(60,0)} % \end{picture} \\ % Centrelines and Symbols % \end{center} % % \section{Errors} % Syntax errors like incorrect or missing punctuation while % using \textsf{curves} % will result in \TeX\ or \LaTeX\ error messages. The \TeX book\footnotemark[2] % and \LaTeX\ manual\footnotemark[1] explain the meaning and % correction of these % errors. The previous examples and Section~\ref{summary} should make the % correct syntax for \textsf{curves} commands clear. % % \textsf{Curves} will write a {\tt Package curves Error:\ldots} message % to the screen and {\tt % log} file if you supply an incorrect number of coordinates. % % If four sequential points in a drawing command argument have the line % through the first and third parallel to the line through the second and % fourth: % \begin{itemize} % \item exactly or closely, \textsf{curves} knows % it cannot draw a parabolic arc % tangent to two parallel lines, issues to the screen and log file:\\ % {\tt Package curve Warning: \string\curve\ straight from \ldots}\\ % and draws a straight line; % \item or approximately, \textsf{curves} may draw an unexpected curve with no % warning. % \end{itemize} % If four sequential points in a drawing command argument have the line % through the first and second parallel to the line through the third and % fourth: % \begin{itemize} % \item \textsf{curves} draws a parabolic arc which may be nowhere % near the curve. % \end{itemize} % % \DescribeMacro{\curvewarnfalse} % If the four points were on a straight line, removing one or more points is % a remedy. If they are not on a straight line, adding points may help. % Specifying many points will give you a satisfactory curve with perhaps an % annoying number of |\curve straight| warnings. After a % |\curvewarnfalse|, \textsf{curves} still uses the straight lines but does % not tell you. % % \DescribeMacro{\tagcurve} % Curvature changes sign on curves like \(y=\sin x\). Specifying inflection % points as {\tt curve} coordinates will reduce error and specifying % sufficient % coordinates will then give satisfactory results. For discontinuous tangents % splitting a curve into pieces is unavoidable. Splitting a curve into pieces % with curvature the same sign can give satisfactory results with fewer % coordinates. |\tagcurve| can prevent tangent discontinuities. If an % inflexion point's exact location is unknown, try the midpoint of the straight % line through the ends of its segment. % % \DescribeMacro{\diskpitchstretch} % Curves appear rougher than horizontal and vertical lines. Picture % digitization causes this not inaccuracy in \TeX\ or {\tt curves.sty}. % Setting |\diskpitchstretch| to a value less than one with % |\renewcommand| may smooth an unusually rough curve without package options. % % \DescribeMacro{\patternresolution} % Symbols and symbol spaces misaligned are usually due to rounding error. % Adjusting |\patternresolution| below one can reduce rounding error and % increase alignment accuracy. This should be limited to the misaligned curve % with {\tt \{\ \}}\footnotemark[1]. % % The replacement |\bezier| does not give exactly the same results as the % original in {\tt bezier.sty} or in {\tt LaTeX2e}. The difference is % extremely % small but if it is important to you comment out the five lines of code for % |\bezier| and |\@bezier| near the start of {\tt curves.sty}. % You now have a |\bezier| which is slower and needs more % memory but has only its original capabilities and gives only its original % results. % % Please email \texttt{\InternetAddress} examples of any errors not covered % above. You may have found a % bug in the code or documentation. % % % \section{Curves Summary} % \label{summary} % % The commands following are for the picture environment in the \LaTeXe\ % manual\footnotemark[1]. % % \subsection{Loading \textsf{curves}} % % \DescribeMacro{\usepackage} % A |\usepackage{curves}| % between |\documentclass| and |\begin{document}| commands loads % \textsf{curves}. If you have a \TeX\ printing or viewing program which % accepts the following |\special| commands you may optionally use % them to allow larger |picture|s faster. Support for \textsf{color} may % be lost. % % You use |\usepackage[|\meta{option}|]{curves}| to load a |\special| option % for drawing the straight line chords which make curves % where \meta{option} is one of: % % { \setlength\parindent{0pt} % % \DescribeEnv{dvips} % uses the em\TeX\ |\special|s with rounded % line ends supported by |dvips|. Works with \textsf{color}. % % \DescribeEnv{emtex} % uses the original em\TeX\ |\special|s with rectangular % line ends. Curves adds a disk to round them. % % \DescribeEnv{xdvi} % uses the PostScript |\special|s of |dvips|. % % \DescribeEnv{WML} % the same as |dvips| but with single character names |W|, |M| and % |L| to minimize % \TeX\ memory with large |picture|s. % % \subsection{Arguments of Commands} % % \DescribeEnv{\meta{blank length}} decimal number of % \meta{unit len} blanks. Not negative. % % \DescribeEnv{\meta{character or symbol}} is anything which a |\put| or % |\multiput| may draw. % % \DescribeEnv{\meta{coordinates}} are decimal numbers giving % alternate $x$ and $y$ % coordinates of the curve as multiples of |\unitlength|, comma % separated. % % \DescribeEnv{\meta{[,dash...]}} optional continuation of alternating % dash % and blank numbers % of unit lengths, comma separated. Not negative. Allows decimal points. % % \DescribeEnv{\meta{diameter}} is a decimal number giving the diameter in % |\unitlength|s. % % \DescribeEnv{\meta{symbol count}} is the number of symbols or % patterns to be drawn, default 0. % % \DescribeEnv{\meta{unit len}} unit length dimension {\it e.g.\/,} % 2.5mm, 10pt, used in measuring blanks and dashes. Not negative. % Default value is |\unitlength|. % % \subsection{Lengths used by Commands} % % \DescribeMacro{\csdiameter} is the size of the space left for a % symbol and can be increased or set with % |\settowidth{\csdiameter}{|\meta{character or symbol}|}|. % % \DescribeMacro{\curvelength} is the total length of the curve % calculated before % drawing by using Simpson's rule once between each pair of coordinate points. % % \DescribeMacro{\overhang} length of as drawn dash pattern % overlapping start of % patterns. % % \subsection{Control Commands} % % \DescribeMacro{\curvewarntrue} turns warning of parabolic arc % replacement by straight lines on (default). % % \DescribeMacro{\curvewarnfalse} turns warning of parabolic arc % replacement by straight lines off. % % \DescribeMacro{\straighttrue} replaces parabolic arcs % between \meta{coordinates} % by straight lines replacing curves by polygons. % % \DescribeMacro{\straightfalse} draw parabolic arcs between \meta{coordinates} % (default). % % \subsection{Parameter Setting Commands} % % \DescribeMacro{\curvesymbol} |{|\meta{character or % symbol}|}| sets symbol and |\csdiameter|. % % \DescribeMacro{\curvedashes} % |[|\meta{unit len}|]{|\meta{blank length}\meta{[,dash...]}|}| A drawing % command not following a |\curvedashes| or following one with % an empty or zero length pattern will draw: % % \makeatletter % ^^A Hanging indentation with paragraph separation for author-date, etc. % \newenvironment{hanging}{\list{}{\topsep\itemsep \advance\topsep-\parskip % \parsep\itemsep \itemsep\z@skip \partopsep\parskip % \ifdim\parindent>\z@ \@tempdimb\parindent \else \@tempdimb1.5 em\fi % \leftmargin\@tempdimb \listparindent-\@tempdimb \itemindent-\@tempdimb % \rightmargin\z@ \labelsep\z@ \labelwidth\z@ }\item[]}% % {\endlist \addvspace\parsep} % \makeatother % % \begin{hanging} % if \meta{symbol count} is zero or missing, a continuous curve; % % else if \meta{symbol count} is positive, \meta{symbol count}-1 squares of % line thickness size between and additional squares at coordinates or |\bezier| % end points; % % else if no \meta{character or symbol} exists, nothing; % % else, -\meta{symbol count}-1 characters or symbols between coordinates and % additional ones at coordinates or |\bezier| end points. % % \end{hanging} % After a |\curvedashes| command defining a pattern whose length exceeds % zero, commands draw: % % % \begin{hanging} % % if \meta{symbol count} is zero or missing then at a spacing equal to the % specified pattern length, % % \begin{hanging} % % if no \meta{character or symbol} exists, a dash pattern reduced in length % by |\csdiameter| to fit between symbol spaces of |\csdiameter|, % % else if |\overhang| is not 0pt, a \meta{character or symbol} at all % positions, % % else a \meta{character or symbol} with the first position blank; % % \end{hanging} % % else, |\csdiameter| wide symbol spaces, one at and % \meta{symbol count}-1 between coordinate points with dash pattern % lengths, % % \begin{hanging} % if no \meta{character or symbol} exists, exact but broken by the spaces, % % else, adjusted to give a whole number of patterns between spaces. % % \end{hanging} % \end{hanging} % % \DescribeMacro{\diskpitchstretch} is initially 1 but |\renewcommand| can % change it to a higher value like 5 to save memory in drafts of complex % documents or a lower local value like 0.5 to smooth curve digitization. % % \DescribeMacro{\linethickness} |{|\meta{len}|}| sets line or dash % thicknesses to \meta{len} from 0.5pt up to 15pt (0.17mm to 5mm). % |\thicklines| and |\thinlines| also set thickness. % % \DescribeMacro{\patternresolution} is initially 1 but |\renewcommand| can % change it to a higher value like 5 to save memory in drafts of complex % documents or a lower local value like 0.5 for greater dash % pattern accuracy. % % \DescribeMacro{\xscale} \DescribeMacro{\xscaley} % \DescribeMacro{\yscale} \DescribeMacro{\yscalex} are % scale factors initially set to 1, 0, 1 and 0 respectively which % |\renewcommand| can reset. % % \subsection{Curve Drawing Commands} % Curves commands draw straight lines between coordinate points % or parabolic arcs with % tangents at each point parallel to the straight line through adjacent points. % % \DescribeMacro{\arc} |[|\meta{symbol count}|](X1,Y1){|\meta{angle}|}| % draws a circular arc centred % on current position, starting from {\tt (X1,Y1)} and proceeding % counterclockwise for \meta{angle} degrees. % % \DescribeMacro{\bezier} |{|\meta{symbol count}|}(X1,Y1)(X2,Y2)(X3,Y3)| % draws a curve through % the end points {\tt (X1,Y1)} and {\tt (X3,Y3)} tangent to the straight lines % joining each of them to {\tt (X2,Y2)}. Extended faster replacement for {\tt % bezier.sty} version. % % \DescribeMacro{\bigcircle} |[|\meta{symbol count}|]{|\meta{diameter}|}| % draws a circle of diameter % equal to \meta{diameter} times |\unitlength|. % % \DescribeMacro{\closecurve}|[|\meta{symbol count}|](|\meta{coordinates}|)| % draws a closed curve % with continuous tangents at all points. At least 6 coordinates required. % % \DescribeMacro{\curve}|[|\meta{symbol count}|](|\meta{coordinates}|)| % draws a curve through the \meta{coordinates} % specified. For 4 coordinates this is a straight line. % % \DescribeMacro{\scaleput}|(X1,Y1){|\meta{picture object}|}| % places a picture object in a % position scaled by |\xscale|, |\xscaley|, |\yscale| and % |\yscalex| for axonometric projection or rotations. % % \DescribeMacro{\tagcurve} |[|\meta{symbol count}|](|\meta{coordinates}|)| % draws a curve without its % first and last segments but if only 6 coordinates draws the last segment % only. % % } % % \typeout{} % {\catcode`\%=12 \typeout{Please place a `%' at the start of the line near}} % \typeout{the start of curves.dtx containing just} % \typeout{`\string\OnlyDescription' if you also wish to print out long} % \typeout{commented LaTeXed listings of curves.sty and curvesls.sty.} % \typeout{} % % \StopEventually{} ^^A % % \section{How \textsf{curves} Works} % % Superimposing characters closely can draw any curve. Disks give % directional independence of line thickness and visual smoothness at % large pitch. Smoothness increases with output resolution but is % almost independent of disk pitch below a critical maximum. The % following table suggests this maximum varies from 0.34pt for an % 0.5pt thick curve to 3pt for a 15pt curve. % % \begin{center} % \setlength{\unitlength}{1pt} % \begin{tabular}{cccc} % Thickness & \makebox[3em][l]{Magnified} & Comments & Line at 1/6 slope \\ % \hline % 15pt & $\times1$ & 1pt pitch disks& % \begin{picture}(80,20)(0,15) \multiput(10,15)(1,0.1667){61}{\circle*{15}} % \end{picture} \\ % 15pt & $\times1$ & 3pt pitch disks& % \begin{picture}(80,20)(0,15) \multiput(10,15)(3,0.5){21}{\circle*{15}} % \end{picture} \\ % $\approx$0.5pt & $\times1$ & \LaTeX\ |\line(6,1)| & % \begin{picture}(80,20)(0,15) \thinlines \put(10,15){\line(6,1){60}} % \end{picture} \\ % $\approx$0.5pt & $\times1$ & 0.34pt pitch disks & % \begin{picture}(80,20)(0,15) % \multiput(10,15)(0.3333,0.05556){181}{\tiny .} % \end{picture} \\ % $\approx$0.5pt & $\times30$ \rule[-10pt]{0pt}{10pt} & % \parbox{8em}{\centering 0.34pt pitch disks\\ resolution $\times30$ } & % \begin{picture}(80,20)(0,15) \multiput(10,15)(10.0,1.667){7}{\circle*{15}} % \end{picture} \\ % \hline % \end{tabular} % \end{center} % % \LaTeX\ |\line|\footnotemark[1] or line drawing |\special| commands % require a tenth the \TeX\ memory so are preferable to disks if % available. \LaTeX\ can load \TeX\footnote{Donald E. Knuth, {\sl % The \TeX book,} Addison-Wesley, 1984, Chapter 20.} macros from % package files with a |.sty| extension. These macros can calculate % the disk or line positions for a curve. % % Parabolic arcs are also quadratic B\'ezier curves which can be % generated from first and second differences without multiplication. % The accuracy at a given fixed point is greater if the differences % are larger. Straight lines generated by just first differences can % be used to interpolate between these points. \TeX's integer % arithmetic allows this to be done precisely. % % The difference in the changes in position between successive pairs % of disks may be so small that \TeX\ rounding causes visible curve % error. The difference between a curve and straight chords joining % points many disks apart can be invisible with invisible \TeX\ % rounding also. \TeX\ can efficiently draw visibly accurate curves % as a sequence of straight chords. Straight line drawing |\special|s % are often incompatible so multiple line options are desirable in % macros. A smooth curve may require thousands of disks but only % hundreds of chords so line |\special|s may prevent a complex % drawing from overflowing \TeX\ memory. % % {\tt curves.sty} provides macro commands for drawing curves as % chords. Version \fileversion\ loads in less than 2000 % words\footnote{A character or token takes a \TeX\ word, 32 bits or % larger.} of \TeX's main memory, which allows a small \TeX. % Complex or numerous floating drawings still require a big \TeX\ % with {\tt curves.sty}. Current options for line |\special|s are % |dvips|, |emtex|, |xdvi|, and |WML|. % % The capabilities of these macros are:--- % \begin{itemize} % \item A compatible replacement for |\bezier|\footnote{See your Local % Guide. Try the system command {\tt latex local} to get a \LaTeX ed Guide.} % from {\tt bezier.sty} or \LaTeXe. % \item Work with |slides| class % for overhead transparencies with \LaTeXe\footnotemark[5]. % \item Curves have the minimum number of disks or chords for visual % smoothness. % \item Curve thickness adjustable from 0.5 to 15pt (0.17 to 5mm). % \item Curves have continuous slope. % \item Curves for any number of points greater than one using |\curve|. % \item Control of end slopes using |\tagcurve|. % \item Closed curves with continuous slope using |\closecurve|. % \item Polygons replace curves after |\straighttrue|. % \item Large circles |\bigcircle| and circular arcs |\arc|. % \item Independent scaling of curve abscissa and ordinates to fit graphs. % \item Affine scaling for making arcs or circles elliptical. % \item Symbols and dash patterns combined without interference. % \item Any dash length or spacing. % \item Three methods for fitting dash patterns to curves. % \end{itemize} % % Parabolic arcs approximate the curve segments between the specified % coordinate points. At an internal curve point, the slope of the % two parabolic arcs which join is the slope of the straight line % joining the adjacent points. For an end segment, the inside point % of the arc is made a vertex which determines the slope of the end % point. |\tagcurve| has hidden end segments which allows complete % control of slope at the visible end point when desired. This % scheme makes the curves and slopes continuous and the discontinuity % in curvature is small with sufficient data points. % % Usually four points determine the parabolic arc between the two % inside points. The four points could be close to a straight line or % consistent with an inflexion point. A straight line then replaces % the parabolic arc between the inside points and optionally a % warning is issued. % % Each parabolic arc is drawn as a series of short chords. % For line |\special|s, the dvi driver draws the straight lines. % Otherwise, the chords are drawn as overlapping disks at high speed % using a simple tail chasing macro. This macro's arithmetic % calculations are two fixed point additions per disk drawn. % % For circles and circular arcs, a parabolic arc approximates a % circular arc subtending no more than 23$^\circ$ giving a radius % increase between segment ends less than 0.02\%. A full circle uses % 16 parabolic arcs. The error in computing and multiplying by sine % and cosine is usually less than 0.01\% of the radius at the far end % of an arc. % % \section{Pleas for the Future} % % \textsf{Curves} will never work with plain \TeX\ and it will never be as % powerful as {\sf METAPOST} or importing encapsulated PostScript % files. Suggestions or criticisms by email are % welcome. Version \fileversion\ has benefitted greatly from previous % help. The latest versions are first available at URL: % \begin{verbatim} % http://patch.bpa.nu/pub/archive/latex/macros/curves/ % \end{verbatim} % At your local CTAN mirror the latest version should be near the % directory for the latest version of \LaTeX. Please use % CTAN to reduce Internet load. % % \DescribeMacro{WML} % A {\tt .dvi} file containing curves produced with the |emtex| option % has many occurrences of the text strings {\tt em:lineto}, {\tt % em:moveto} and {\tt em:linewidth XXXXpt} placed by the em\TeX\ % |\special|s. These strings would have earlier occupied \TeX\ % memory. Extra memory is also taken by the disks used to % cover the cracks between square line ends at a slight angle. Renaming % these |\special|s to {\tt L}, {\tt M} and {\tt W XXXXpt} % respectively would save \TeX\ memory. Even better, {\tt W XXXXpt} % could calculate and store the bitmap of a disk which {\tt L} % would add to its line ends to round them so {\tt curves} need not add % disks\footnote{\texttt{dvips}'s em\TeX\ \texttt{\bslash special}s % round line ends but not all em\TeX\ \texttt{\bslash special}s do.}. % If you write dvi drivers, please add % these three proposed |\special|s. % % \section{\texttt{curves.sty}} % % The description of the algorithms following is minimal. % Future releases will add more. % \begin{macrocode} %<*package> % \end{macrocode} % \noindent Make `;' appear like a letter so control sequences can use % it and they % will not be accidently used by other macro packages. % \begin{macrocode} \catcode`\;=11 % \end{macrocode} % \subsection{Registers} % Counts % % \noindent number of symbols on parabolic arc % \begin{macrocode} \newcount\;sc \newcount\;scp \newcount\;t % \end{macrocode} % coordinate count % \begin{macrocode} \newcount\;cc % \end{macrocode} % actual point count to next dot % \begin{macrocode} \newcount\;cnd % \end{macrocode} % maximum point count to next dot % \begin{macrocode} \newcount\;mcnd \newcount\;np \newcount\;overhang \newcount\;pbs \newcount\;pns % \end{macrocode} % maximum dot spacing on line in sp. % \begin{macrocode} \newcount\;psc \newcount\;rc \newcount\;rtc \newcount\;tc \let\;tca=\@tempcnta \let\;tcb=\@tempcntb % \end{macrocode} % Dimens % \begin{macrocode} \newlength\csdiameter \newlength\curvelength \newlength\overhang \newlength\;x \newlength\;dx \newlength\;ddx \newlength\;y \newlength\;dy \newlength\;ddy \newlength\;pl \newlength\;ucd \let\;td=\@tempdima \let\;ytd=\@tempdimb % \end{macrocode} % Boxes % \begin{macrocode} \newsavebox{\;csbox} \newsavebox{\;pt} % \end{macrocode} % \subsection{Boolean} % % has an option been selected % \begin{macrocode} \newif\if;noopt \;noopttrue % \end{macrocode} % Warn about curve problems % \begin{macrocode} \newif\ifcurvewarn \curvewarntrue % \end{macrocode} % Plot straightline segments instead of curves. % \begin{macrocode} \newif\ifstraight % \end{macrocode} % coordinate number correct % \begin{macrocode} \newif\if;ccn % \end{macrocode} % plot points if true % \begin{macrocode} \newif\if;pt % \end{macrocode} % curve symbol defined % \begin{macrocode} \newif\if;csym % \end{macrocode} % symbol or pattern count % \begin{macrocode} \newif\if;scnt % \end{macrocode} % help strings % \begin{macrocode} \newhelp\;strline{curve straight from} \newhelp\m;ssingcoord{curve needs more points, add them.} \newhelp\;negdash{curvedashes needs the same sign for all arguments.} \newhelp\;oddcoord{curve requires two co-ordinates for each point, count them.} % \end{macrocode} % % \subsection{Driver Options} % % The following three commands may be reset % by \textsf{curves} options to contain straight % line drawing |\special|s which some |dvi| drivers % may have. The usual default for unimplemented % |\special|s is the driver % draws nothing. If no option is specified \LaTeX\ period and circle % fonts are used to plot straight lines segments efficiently. % This should always work with \LaTeXe. % The resulting curves differ % in run time, \TeX\ memory use, % |.dvi| and printer file size but not in output |picture|s. % % % \noindent Sets the line width % \begin{macrocode} \newcommand\;linewidth[1]{} % \end{macrocode} % Sets the start of the line % \begin{macrocode} \newcommand\;startline{} % \end{macrocode} % Draws the line and sets next start. % \begin{macrocode} \newcommand\;stopl;ne{} \newcommand\;optioncheck[2]{% \DeclareOption{#1}{% \if;noopt #2\;nooptfalse \else \PackageError{curves}{Option \CurrentOption\space ignored}{curves uses only one dvi option}% \fi }% } % \end{macrocode} % Sets thickness and no disk character for rounded line ends. % \begin{macrocode} \newcommand\;setdisk{\@killglue \;linewidth\@wholewidth \set;pt{}\let\;stopline\;stopl;ne} \newcommand\s;tpitch{\;td\patternresolution\p@ \;psc\;td} \;optioncheck{dvips}{ % \end{macrocode} % Works with the \textsf{color} package. % \begin{macrocode} \renewcommand\;linewidth[1]{\special{em:linewidth \the#1}}% \renewcommand\;startline{\special{em:moveto}}% \renewcommand\;stopl;ne{\special{em:lineto}}% } \;optioncheck{emtex}{ \renewcommand\;linewidth[1]{\special{em:linewidth \the#1}}% \renewcommand\;startline{\special{em:moveto}}% \renewcommand\;stopl;ne{\special{em:lineto}}% \renewcommand\;setdisk{\@killglue \ifdim\@halfwidth>\p@ \set;pt{\@circ\@wholewidth{112}}\;linewidth{\wd\;pt}% \s;tcirc{\unhbox\;pt}% \else \;linewidth\@wholewidth \set;pt{}\fi \let\;stopline\;stopl;ne} } \;optioncheck{xdvi}{ % \end{macrocode} % Works with |xdvi| and |dvips| but not \textsf{color}. % % Divide the excess precision of scaled points by 256 to save % \TeX\ memory and |dvi| file size. Device independent for % resolutions smaller than 18501 dots per inch. % Note: \(72.27\times256/72=256.96\) exactly so errors occur only after the % |\divide|s in the |\;stopl;ne|. % \begin{macrocode} \special{!/;L{1 256.96 div dup scale 1 setlinecap setlinewidth newpath 0 0 moveto lineto stroke}def}% \newcount\;wc \newlength\;X \newlength\;Y \renewcommand\;linewidth[1]{\;wc#1}% \renewcommand\;startline{\global\;X\;x \global\;Y\;y}% \renewcommand\;stopl;ne{% \;tca\;X \advance\;tca-\;x \;tcb\;Y \advance\;tcb-\;y \divide\;tca\@cclvi \divide\;tcb\@cclvi \divide\;wc\@cclvi \special{"\the\;tca\space \the\;tcb\space \the\;wc\space ;L}% \;startline }% } \;optioncheck{WML}{ \renewcommand\;linewidth[1]{\special{W \the#1}}% \renewcommand\;startline{\special{M}}% \renewcommand\;stopl;ne{\special{L}}% \;nooptfalse } \let\;optioncheck\relax \ProcessOptions\relax \if;noopt \newcount\;wc \newlength\;X \newlength\;Y \newcommand\;setperiod{\;tcb \ifdim\@halfwidth>.6\p@ 17\;td.7 \else \ifdim\@wholewidth>.85\p@ 12\;td.48 \else \ifdim\@wholewidth>.6\p@ 8\else 5\fi \;td.34 \fi \fi \p@ \s;tcirc{\rm \fontseries m\fontshape n\fontsize{\the\;tcb}\p@ \selectfont \hss.}}% % \end{macrocode} % Sets LaTeX disk character and calculates maximum spacing or selects period. % \begin{macrocode} \renewcommand\;setdisk{\@killglue \ifdim\@halfwidth>.85\p@ \s;tcirc{\@circ{\@wholewidth}{112}}\;td\@wholewidth \divide\;td 8\advance\;td.6\p@ \ifdim\;td>\thr@@\p@\;td\thr@@\p@\fi \else \;setperiod \fi \let\;stopline\;stopl;ne}% \renewcommand\s;tpitch{\;ytd\diskpitchstretch\;td \;wc\;ytd \;td\patternresolution\p@ \;psc\;td } \renewcommand\;startline{\global\;X\;x \global\;Y\;y} \renewcommand\;stopl;ne{% % \end{macrocode} % This plots just the intermediate disks of a straight line segment which % requires any. The end disks are plotted in the device independent code. % \begin{macrocode} \;td\;X \advance\;td-\;x \;ytd\;Y \advance\;ytd-\;y \;startline \;rxya\;td\;ytd \divide\;rc\;wc \ifnum\;rc>\z@ \advance\;rc\@ne \divide\;td\;rc \divide\;ytd\;rc \;y\z@ \advance\;rc\m@ne \;tca\;rc \let\n;xt\;ls \;ls \kern-\;rc\;td \fi} \newcommand\;ls{\advance\;y\;ytd \kern\;td \raise\;y\copy\;pt \advance\;tca\m@ne \ifnum\;tca=\z@ \let\n;xt\relax \fi \n;xt} \fi % \end{macrocode} % \subsection{User Command Definitions} % \begin{macrocode} \newcommand\arc[1][0]{\;arc[#1]} \newcommand\;arc{} \def\;arc[#1](#2,#3)#4{\;setpoint{#1}\scaleput(#2,#3){\;ddx -#3\unitlength \;ddy#2\unitlength \;firstpoint \;td#4\p@ \;drwarc}} % \end{macrocode} % Redefines version in LaTeX 2e of 1 June 1994. % \begin{macrocode} \def\bezier#1)#2(#3)#4({\@bezier#1)(#3)(} \def\@bezier#1(#2,#3)(#4,#5)(#6,#7){\;dx#4\unitlength \;ddx-\;dx \advance\;dx-#2\unitlength \advance\;ddx#6\unitlength \;dy#5\unitlength \;ddy-\;dy \advance\;dy-#3\unitlength \advance\;ddy#7\unitlength \;setpoint{#1}\scaleput(#2,#3){\;firstpoint \;bezier}} \newcommand\bigcircle[2][0]{\;setpoint{#1}\;dx\unitlength \global\divide\unitlength\tw@ \scaleput(#2,0){\;startline \;ddx\z@ \;ddy#2\unitlength \global\unitlength\;dx \;td360\p@ \;drwarc}} \newcommand\closecurve[1][0]{\;closecurve[#1]} \newcommand\;closecurve{} \def\;closecurve[#1](#2){\;coordn\closecurve\thr@@{#2}{#1}% \if;ccn\scaleput(\;xb,\;yb){\;startline \edef\;ci{\;xa,\;ya,#2,\;xb,\;yb,\;xc,\;yc}% \advance\;cc\thr@@ \;tagcurve\;ci}\fi} \newcommand\curve[1][0]{\;curve[#1]} \newcommand\;curve{} \def\;curve[#1](#2){\;coordn\curve\tw@{#2}{#1}% \if;ccn \scaleput(\;xa,\;ya){\;firstpoint \ifnum\;cc=\tw@ \;slbezd \;slbez \else \;scbezd\;dx\;ddx\;xa\;xb\;xc \;scbezd\;dy\;ddy\;ya\;yb\;yc \;bezier \;tagcurve{#2}\ifnum\;cc>6\;endcurve\fi \fi}\fi} % \end{macrocode} % \(|#1|= (|#4|-|#3|- (|#5|-|#3|)/4)|\unitlength|\), % \(|#2|=(|#5|-|#3|)|\unitlength|/4\). % \begin{macrocode} \newcommand\;scbezd[5]{\;slcd#2#3#5\divide#24\;slcd#1#3#4\advance#1-#2} \newcommand\;xa{} \newcommand\;xb{} \newcommand\;xc{} \newcommand\;ya{} \newcommand\;yb{} \newcommand\;yc{} \newcommand\;ci{} \newcommand\curvesymbol[1]{\def\;curvesymbol{#1}\ch;ckcs \global\sbox\;csbox{#1}\csdiameter\wd\;csbox} \newcommand\;curvesymbol{} \def\;curvesymbol{} \newcommand\curvedashes[2][\unitlength]{\;ucd#1\def\;icurvedashes{#2}% \;ccnfalse \;pl\z@ \@for \;ci:=#2\do{\ifdim\;ci\;ucd<\z@ \;ccntrue \PackageError{curves}{\string \curvedashes\space sign bad at \;ci\MessageBreak}{\the\;negdash}% \else \advance\;pl\;ci\;ucd \fi}\if;ccn\;pl\z@\fi} \newcommand\;icurvedashes{} \newcommand\tagcurve[1][0]{\;tgcrv[#1]} \newcommand\;tgcrv{} \def\;tgcrv[#1](#2){\;coordn\tagcurve\thr@@{#2}{#1}\if;ccn \scaleput(\;xb,\;yb){\;firstpoint \;tagcurve{#2}}\fi} \newcommand\scaleput{} \long\def\scaleput(#1,#2)#3{\@killglue \;td#2\unitlength \raise\yscale\;td \hbox to \z@{\kern\xscaley\;td \;td#1\unitlength \kern\xscale\;td \raise\yscalex\;td \hbox{#3}\hss}\ignorespaces} \newcommand\xscale{\@ne} \newcommand\xscaley{0} \newcommand\yscale{\@ne} \newcommand\yscalex{0} \newcommand\diskpitchstretch{\@ne} \newcommand\patternresolution{\@ne} % \end{macrocode} % % \subsection{Drawing Command Details} % % Plot first point if any. % \begin{macrocode} \newcommand\;firstpoint{\;startline \ifdim\;pl=\z@\;point\relax\fi} % \end{macrocode} % Calculates segment count, sine, cosine and differences then plots segments. % \begin{macrocode} \newcommand\;drwarc{\;cc\;td \;np\;td \;td23\p@ \divide\;cc\;td \;abs\;cc \advance\;cc\@ne \;pns\p@ \divide\;pns\tw@ \divide\;np\;cc \;rc\;np \divide\;rc\;pns \;abs\;rc \advance\;rc\@ne \divide\;np\;rc \multiply\;np\;pns \divide\;np14668 % \multiply\;np\;rc \divide\;np\@cclvi \;scp\p@ \multiply\;scp\@cclvi \;t\;pns \;csi\;csi\;csi\;csi \;rxya\;ddx\;ddy \divide\;rc\p@ \advance\;rc\@ne \;rtc\;rc \advance\;rc\;rc \;ndd\;ddx \;ndd\;ddy \;csi \;rxya\;ddx\;ddy \divide\;rc\;pns \advance\;rc\@ne \@whilenum\;cc>\z@ \do{\advance\;cc\m@ne \;dx\;ddx \;dy\;ddy \divide\;ddx\;rc \divide\;ddy\;rc \;td\;ddx \;ddx\;t\;td \advance\;ddx-\;np\;ddy \;ddy\;t\;ddy \advance\;ddy\;np\;td \divide\;ddx\;pns \divide\;ddy\;pns \;ddx\;rc\;ddx \;ddy\;rc\;ddy {\;bezier \global\;td\;x \global\;ytd\;y \global\;tca\;overhang}\;y\;ytd \;x\;td \;overhang\;tca}} \newcommand\;ndd[1]{\divide#1\;rc \multiply#1\;np \divide#1\;t #1\;rtc#1} % \end{macrocode} % Cosine and sine half angle iteration. % \begin{macrocode} \newcommand\;csi{\;tcb\;np \multiply\;np\;t \divide\;np\;pns \;t\;tcb \multiply\;t\;t \divide\;t-\;scp \advance\;t\;pns \divide\;scp4 } % \end{macrocode} % Count the number of coordinates specified and warn if incorrect. % \begin{macrocode} \newcommand\;coordn[4]{\;setpoint{#4}\ifx#1\closecurve\;cc\tw@ \else\;cc\z@\fi \@for\;ci:=#3\do{\advance\;cc\@ne \ifcase\;cc \or \;d;f\;xa \or \;d;f\;ya \or \;d;f\;xb \or \;d;f\;yb \or \;d;f\;xc \or \;d;f\;yc \fi \ifx#1\closecurve\ifodd\;cc \;d;f\;xa \else \;d;f\;ya \fi\fi}% \;ccnfalse \ifx#1\closecurve \advance\;cc-\tw@ \fi \ifodd\;cc \PackageError{curves}{\string #1\space points odd}{\the\;oddcoord}% \else \divide\;cc\tw@ \ifnum#2>\;cc \PackageError{curves}{\string #1\space needs \the#2 points\MessageBreak}{\the\m;ssingcoord}% \else \;ccntrue \fi\fi} % \end{macrocode} % Sets symbol, character or disk depending on how line is to be plotted. % Corrects overhang to be positive or zero but no greater than |\;pl|. % \begin{macrocode} \newcommand\;setpoint[1]{\curvelength\z@ \let\;stopline\relax \def\;point##1{\raise\;y\hbox{{\copy\;pt##1}}}\ch;ckcs \ifnum#1=\z@\;scntfalse\else\;scnttrue\fi \;sc#1\relax \;abs\;sc \;psc\;sc \ifdim\;pl>\z@ \;overhang\overhang \ifnum\;overhang=\z@\else \;np\;overhang \divide\;np\;pl \multiply\;np\;pl \ifnum\;overhang<\z@ \advance\;overhang\;pl \else \ifnum\;overhang=\;np\advance\;overhang\;pl\fi \fi \advance\;overhang-\;np \fi \if;csym \if;scnt\;setdisk\else\;setsymbol\fi \else \;setdisk \fi\s;tpitch \else\ifnum#1>\z@ \s;tcirc{\hss\vrule\@height\@wholewidth\@width\@wholewidth}% \else\ifnum#1<\z@ \if;csym\;setsymbol\else\set;pt{}\fi \else\;setdisk\s;tpitch \fi\fi\fi \;x\z@ \;y\dp\;pt \advance\;y-\ht\;pt \divide\;y\tw@} \newcommand\;setsymbol{\s;tcirc{\hss\unhcopy\;csbox}% \edef\;point{\;point\relax \s;tcirc{\hss\noexpand\;curvesymbol}\global\setbox\;csbox\copy\;pt}} \newcommand\;stopline{} \newcommand\;point{} % \end{macrocode} % Check if curvesymbol exists and set switch. % \begin{macrocode} \newcommand\ch;ckcs{\ifx\;curvesymbol\@empty\;csymfalse \else\;csymtrue\fi} % \end{macrocode} % Makes zero width box |\;pt| of point % \begin{macrocode} \newcommand\s;tcirc[1]{\set;pt to\z@{#1\hss}} % \end{macrocode} % Set global box |\;pt| % \begin{macrocode} \newcommand\set;pt{\global\setbox\;pt\hbox} % \end{macrocode} % Plots last segment of curve from coordinates already read. % \begin{macrocode} \newcommand\;endcurve{\;ecbezd\;dx\;ddx\;xa\;xb\;xc \;ecbezd\;dy\;ddy\;ya\;yb\;yc \;bezier} \newcommand\;ecbezd[5]{\;slcd#1#3#5\divide#14 #2-#1\advance#2#5\unitlength \advance#2-#4\unitlength} % \end{macrocode} % Reads coordinates of four points before going to difference calculation. % \begin{macrocode} \newcommand\;tagcurve[1]{\ifnum\;cc=\thr@@ \;endcurve \else \;cc\z@ \@for\;ci:=#1\do{\advance\;cc\@ne \ifnum\;cc>6 % \ifodd\;cc \;slcd\;dx\;xa\;xc \let\;xa\;xb \let\;xb\;xc \;d;f\;xc \else \t;gcrv \fi \fi}\fi} % \end{macrocode} % Calculates differences over whole segment from four points. % \begin{macrocode} \newcommand\t;gcrv{\;slcd\;dy\;ya\;yc \let\;ya\;yb \let\;yb\;yc \;d;f\;yc \;rxy\;dx\;dy \divide\;dx\;rtc \divide\;dy\;rtc \;ddx-\;ya\;dx \advance\;ddx\;xa\;dy \;ddy\;ddx \advance\;ddx\;yb\;dx \advance\;ddx-\;xb\;dy \advance\;ddy\;yc\;dx \advance\;ddy-\;xc\;dy \;slbezd \;td\;ddy \divide\;td\@m \ifdim\;td=\z@ \ifcurvewarn \PackageWarning{curves}{\the\;strline\MessageBreak \;xa,\;ya\space to \;xb,\;yb\MessageBreak}\fi \;slbez \else \;td\unitlength \;rtc\;td \advance\;rtc\;rtc \divide\;rtc\p@ \advance\;rtc\@ne \divide\;td\;rtc \;t\;ddx \;scp\;t \;abs\;t \advance\;t\;t \divide\;t\p@ \advance\;t\@ne \divide\;scp\;t \multiply\;td\;scp \divide\;td\;ddy \multiply\;td\;rtc \multiply\;td\;t \;ddx\;xc\;td \advance\;ddx-\;xa\;td \advance\;dx-\;ddx \;ddy\;yc\;td \advance\;ddy-\;ya\;td \advance\;dy-\;ddy \;bezier \fi} % \end{macrocode} % Avoid repeating |{\;ci}| % \begin{macrocode} \newcommand\;d;f[1]{\edef#1{\;ci}} \newcommand\;slbezd{\;slcd\;dx\;xa\;xb \;slcd\;dy\;ya\;yb} % \end{macrocode} % Calculates \(|#1| = (|#3|-|#2|)|\unitlength|\). % \begin{macrocode} \newcommand\;slcd[3]{#1#3\unitlength \advance#1-#2\unitlength} % \end{macrocode} % Calculates differences for |bezier| straight line. % \begin{macrocode} \newcommand\;slbez{\divide\;dx\tw@ \;ddx\;dx \divide\;dy\tw@ \;ddy\;dy \;bezier} % \end{macrocode} % \newcommand\bs{\symbol{'134}} % \subsubsection{\texttt{\bs ;bezier}} % |\;bezier| is called by all curve and polygon drawing commands. % If straight line between points |\;bezier| recalculates differences. % Scales segment differences, then calculates segment pattern and disk count, % and initial disk differences; selects line or dashes. Dash patterns % were originally measured out in multiples of the disk pitch and are currently % in points but can be adjusted with |\patternresolution|. This should % be reprogrammed in scaled points. % % \paragraph{ \texttt{\bs ;bezier} Inputs:} % \begin{center} % \setlength\unitlength{1pt} % \begin{picture}(200,100)\sf % \thicklines % \put(0,0){\vector(0,1){100}} % \put(0,0){\vector(1,0){200}} % \put(3,98){$y$} % \put(198,3){$x$} % \bezier{0}(20,60)(100,100)(180,30) % \thinlines % \curve(20,60, 100,100) % \curve(100,100, 180,30) % \put(20,60){\circle*{4}} % \put(100,100){\circle*{4}} % \put(180,30){\circle*{4}} % \put(12,51){$(x_a,y_a)$} % \put(103,100){$(x_b,y_b)$} % \put(183,28){$(x_c,y_c)$} % \end{picture}\\ % Coordinate points for drawing parabolic arc.\\ % \end{center} % % \noindent counts % % |\;psc| = maximum dot spacing on line % % |\;sc| = symbol count on parabolic arc % % \noindent dimens % % |\;dx| $=x_b-x_a$ % % |\;ddx| $=x_c-x_b$ % % |\;dy| $=y_b-y_a$ % % |\;ddy| $=y_c-y_b$ % % |\;pl| = dash pattern length % % |\curvelength| = curvelength up to start of parabolic arc % % \noindent boolean % % |\if;scnt| = true if a symbol count defined % % |\if;csym| = true if a curvesymbol defined % % |\ifstraight| = true if straight line replacing parabolic arc % % \paragraph{ \texttt{\bs ;bezier} Outputs:} \mbox{ } % % \noindent counts % % |\;mcnd| = number of pattern increments in straight segment (default 1) % % |\;np| = number of complete patterns or symbols in parabolic arc % % |\;t| = number of pattern increments in parabolic arc % % |\;rc| = length of parabolic arc in scaled points % % \noindent dimens % % |\;dx| = increment of |\;x| before line, blank, point or symbol plotted % % |\;ddx| = increment of |\;dx| after line, blank, point or symbol plotted % % |\;dy| = increment of |\;y| before line, blank, point or symbol plotted % % |\;ddy| = increment of |\;dy| after line, blank, point or symbol plotted % % \begin{macrocode} \newcommand\;bezier{\ifstraight \av;d\;dx\;ddx \av;d\;dy\;ddy \fi \;scale\;dx\;dy \;scp\;rc \;scale\;ddx\;ddy \advance\;scp\;rc \;bezc\;dx\;ddx \;bezc\;dy\;ddy \;rxy\;ddx\;ddy \divide\;rc\p@ \advance\;rc\thr@@ \;tc\;rc \ifnum\;rc>\sixt@@n\;rc\sixt@@n\fi \;rroot\;rroot\;rroot\;rroot \;t\;rc \;rxy\;dx\;dy \advance\;rc\;scp \divide\;rc\thr@@ \global\advance\curvelength\;rc sp\;mcnd\@ne % \end{macrocode} % Here % % |\;rc| = parabolic arc length in scaled points accurately % approximated using Simpson's Rule \textit{i.e.} % \[ |\;rc| = \frac13(\mid\mathbf r_b - \mathbf r_a \mid +\, % 2\mid\mathbf r_c - \mathbf r_a\mid + \mid\mathbf r_c -\mathbf % r_b\mid ) \] \indent which is exact for consecutive points a, b and % c on a straight line; % % \noindent and % % |\;t| = number of straight line segments (polygon sides) in % parabolic arc % \[ |\;t| = \sqrt{3 + \frac{\mid \mathbf r_a -2 \mathbf r_b + \mathbf % r_c\mid}{32768}}\] \indent which is rounded up for dash pattern % and gives a maximum deviation of polygon from arc about 0.25\,pt. % % \begin{macrocode} \ifdim\;pl>\z@ \;np\;rc \divide\;np\;psc \ifnum\;t<\;np \;mcnd\;np \divide\;mcnd\;t \divide\;np\;mcnd \multiply\;np\;mcnd \;t\;np \fi \fi \if;scnt \ifdim\;pl=\z@ \;t\;sc \else \;np \if;csym \;rc \divide\;np\;sc \advance\;np-\csdiameter \;td\;pl \divide\;td\tw@ \advance\;np\;td \divide\;np\;pl \ifnum\;np<\@ne\;np\@ne\fi \multiply\;np\;sc \else \;sc \fi \advance\;t\;np \divide\;t\;np \multiply\;t\;np \fi \fi % \end{macrocode} % Here |\;mcnd| is the number of pattern increments in a straight % segment and |\;t| in the parabolic arc. % |\;np| is the number of complete patterns when known. % % The calculation following ensures that the end point of the parabolic % arc is as accurate as possible. % % \begin{macrocode} \;rtc\;t \divide\;rtc\;mcnd \;tcb\;rtc \multiply\;tcb\;t \advance\;rtc\m@ne \multiply\;rtc\;t \;tc\;t \advance\;tc\;tc \;bezd\;dx\;ddx \;bezd\;dy\;ddy % \end{macrocode} % Here % \[ |\;ddx| = \frac{2(x_a-2x_b+x_c)}{ ({\tt\bs;t)^2 / \bs;mcnd }} \] % \[ |\;dx| = \frac{2(x_c-x_a)-{\tt\bs;t(\bs;t/\bs;mcnd}-1){\tt\bs;ddx}}{ % {2\tt\bs;t }} \] % \[ |\;ddy| = \frac{2(y_a-2y_b+y_c)}{ ({\tt\bs;t)^2 / \bs;mcnd }} \] % \[ |\;dy| = \frac{2(y_c-y_a)-{\tt\bs;t(\bs;t/\bs;mcnd}-1){\tt\bs;ddy}}{ % {2\tt\bs;t }} \] % \begin{macrocode} \ifdim\;pl>\z@ \;dashes \else \let\n;xt\;spoints \;spoints \fi} % \end{macrocode} % |\av;d| replaces each of |#1| and |#2| by \((|#1|+|#2|)/2\). % \begin{macrocode} \newcommand\av;d[2]{\advance#1#2\divide#1\tw@#2#1} % \end{macrocode} % |\;scale| replaces each of dimen parameters |#1| and |#2| by scaled % values and writes their scaled vector length to |\;rc|. % \begin{macrocode} \newcommand\;scale[2]{\;td\xscale#1\advance\;td\xscaley#2% #2\yscale#2\advance#2\yscalex#1#1\;td \;rxy#1#2} % \end{macrocode} % |\;bezc| replaces dimen parameters |#1| and |#2| by \(2(|#1|+|#2|)\) and % \(2(|#2|-|#1|)\) respectively. % \begin{macrocode} \newcommand\;bezc[2]{\advance#1#1\advance#2#2% \;td#2\advance#2-#1\advance#1\;td} % \end{macrocode} % |\;bezd| replaces dimen parameter |#1| by % \((|#1|-|\;rtc||#2|/|\;tcb|)/|\;tc|\) and |#2| by \(|#2|/|\;tcb|\). % \begin{macrocode} \newcommand\;bezd[2]{\divide#2\;tcb \;td#2\multiply\;td\;rtc \advance#1-\;td \divide#1\;tc} % \end{macrocode} % Plots a continuous line or equispaced squares or symbols along a segment. % \begin{macrocode} \newcommand\;spoints{\advance\;y\;dy \advance\;x\;dx \kern\;dx \;point\;stopline \advance\;t\m@ne \ifnum\;t>\z@ \advance\;dx\;ddx \advance\;dy\;ddy \else \let\n;xt\relax \fi \n;xt} % \end{macrocode} % Calculates length of vector |\;rc| from coordinates |#1|, |#2| % \begin{macrocode} \newcommand\;rxy[2]{\;rxya#1#2% \ifnum\;rc>\z@ \;rtc\;rc \advance\;rtc\;rtc \divide\;rtc\p@ \ifnum\;rtc>\z@ \advance\;rtc\@ne \divide\;tc\;rtc \divide\;tcb\;rtc \divide\;rc\;rtc \else \;rtc\@ne \fi \multiply\;tc\;tc \multiply\;tcb\;tcb \advance\;tc\;tcb \;rroot\;rroot \multiply\;rc\;rtc \fi} % \end{macrocode} % Estimate length of vector |\;rc| from coordinates |#1|, |#2|. % For \DeleteShortVerb{\|} \(1>|x|\ge|y|>0\), \(|x|+|y|/3\) is % \MakeShortVerb{\|} within 6\% of \(\sqrt{x^2+y^2}\). % \begin{macrocode} \newcommand\;rxya[2]{\;tc#1\;abs\;tc \;tcb#2\;abs\;tcb \ifnum\;tc>\;tcb \;rc\;tcb \;tcb\;tc \;tc\;rc \fi \;rc\;tc \divide\;rc\thr@@ \advance\;rc\;tcb } % \end{macrocode} % Replaces argument by magnitude % \begin{macrocode} \newcommand\;abs[1]{\ifnum#1<\z@ #1-#1\fi} % \end{macrocode} % One iteration of square root calculation by Newton's method. % \begin{macrocode} \newcommand\;rroot{\;tcb\;tc \divide\;tcb\;rc \advance\;rc\;tcb \divide\;rc\tw@} % \end{macrocode} % % \subsection{Dash Pattern Drawing} % % Variable uses in |\;dashes|, |\;scdashes|, |\;nscdashes|, |\;pdashes| % and |\;dash|. % % counts % % |\;scp| = distance between points. % % |\;rc| = length of parabolic arc. % % |\;rtc| = total points in parabolic arc. % % |\;np| = number of whole patterns in parabolic arc or scratch. % % |\;overhang| = of dash pattern past symbol or end of segment. % % |\;pbs| = total points between symbols % % |\;pns| = points to next symbol or dot. % % |\;tc| = number of points to blank for curve symbol. % % |\;tcb| = number of points along pattern. % % dimens % % |\;pl| = length of dash pattern. % % |\;ucd| = dash pattern unit length. % % Initializes dash plot for segment and selects symbol count alternative. % \begin{macrocode} \newcommand\;dashes{\let\;ticd\;icurvedashes \let\;tucd\;ucd \divide\;rc\;t \;rtc\;t \;tc\;rc \advance\;tc\csdiameter \divide\;tc\;rc \divide\;tc\tw@ \;t\;tc \multiply\;tc\tw@ \;ptfalse \;cnd\;mcnd \;pbs\;rc \divide\;pbs\tw@ \advance\;overhang\;pbs \divide\;overhang-\;rc \if;scnt \;scdashes \else \;nscdashes \fi \multiply\;overhang\;rc} % \end{macrocode} % Plots dash pattern when a nonzero symbol count is specified. % \begin{macrocode} \newcommand\;scdashes{\;pbs\;rtc \divide\;pbs\;sc \;ccss \;scp \if;csym \;pl \multiply\;scp\;np \divide\;scp\;sc \advance\;pbs-\;tc \else \;pbs \multiply\;scp\;rc \fi \;np\;overhang \;overhang\z@ \divide\;scp\;pbs \;tcb\z@ \;pns\;t \;dash \;overhang\;np \if;csym\else \advance\;overhang-\;tcb \advance\;rtc-\;tcb \advance\;pbs-\;tc \fi \;pns\;pbs \advance\;pns-\;np \if;csym\else\advance\;pns\;tcb\fi \@whilenum\;rtc>\z@\do{\;pdashes \;ptfalse \;t\;tc \;pns\;t \;dash \;pns\;pbs \;overhang\if;csym\;np\else-\;overhang\fi \advance\;pns-\;overhang}\;overhang-\if;csym\;np\else\;overhang \;ptfalse \;t\;tc \;tcb\;overhang \divide\;t\tw@ \;rtc\;t \;pns\;t \;dash \fi} % \end{macrocode} % Plots symbols at natural pattern length but shrinks pattern to fit between. % \begin{macrocode} \newcommand\;nscdashes{\advance\;pbs\;pl \divide\;pbs\;rc \if;csym \;bpdashes \fi \;ccss \;pns\;t \;dash \advance\;pbs-\;tc \;scp\;pl \divide\;scp\;pbs \;pns\;pbs \@whilenum\;rtc>\z@\do{\;pdashes \;ptfalse \;t\;tc \;pns\;t \;dash \;pns\;pbs}% \if;csym \else \divide\;tc\tw@ \advance\;overhang\;tc \fi} % \end{macrocode} % If large symbol spaces, blank curve. % \begin{macrocode} \newcommand\;ccss{\ifnum\;pbs>\;tc\else \;bpdashes \fi} % \end{macrocode} % A blank or symbol plotting dash pattern % \begin{macrocode} \newcommand\;bpdashes{\let\;tucd\;pl \let\;ticd\;ricd \;tc\z@ \;t\z@} \newcommand\;ricd{1,0} % \end{macrocode} % Reads dash pattern plotting dashes and spaces up to next symbol space. % \begin{macrocode} \newcommand\;pdashes{\ifnum\;pns>\z@ \;td\z@ \;tcb\z@ \;ptfalse \@for\;ci:=\;ticd \do{\advance\;td\;ci\;tucd \;t\;scp \divide\;t\tw@ \advance\;t\;td \divide\;t\;scp \advance\;t-\;tcb \;dash \if;pt\;ptfalse\else\;pttrue\fi}% \let\n;xt\;pdashes \else \let\n;xt\relax \fi \n;xt} % \end{macrocode} % Checks if dash or space occurs before or after curve, calculates fractions. % \begin{macrocode} \newcommand\;dash{\ifnum\;t=\z@ \if;csym \ifnum\;rtc>\z@ \if;pt\;point\;startline\fi \fi \fi \else \advance\;tcb\;t \advance\;pns-\;t \ifnum\;overhang<\z@ \advance\;overhang\;t \;t \ifnum\;overhang<\z@ \z@ \else \;overhang \;overhang\;tcb \fi \else \;overhang\;tcb \fi \ifnum\;pns<\z@ \advance\;overhang\;pns \advance\;tcb\;pns \advance\;t\;pns \;pns\z@ \fi \advance\;rtc-\;t \ifnum\;rtc<\z@ \advance\;overhang\;rtc \advance\;t\;rtc\fi \ifnum\;t>\z@ \if;pt\;point\;startline\fi \let\n;xt\;points \;points \fi\fi} % \end{macrocode} % Plots a single dash or space depending on |\if;pt|. % \begin{macrocode} \newcommand\;points{\ifnum\;t<\;cnd \;tca\;t \else \;tca\;cnd \fi \advance\;y\;tca\;dy \;ytd\;tca\;dx \advance\;x\;ytd \kern\;ytd \if;pt\;point\;stopline\fi \ifnum\;t<\;cnd \let\n;xt\relax \advance\;cnd-\;t \else \advance\;t-\;cnd \advance\;dx\;ddx \advance\;dy\;ddy \;cnd\;mcnd \fi \n;xt} % \end{macrocode} % Make `;' a punctuation mark again. % \begin{macrocode} \catcode`\;=12 % \end{macrocode} % % \begin{macrocode} % % \end{macrocode} % % \section{\texttt{curvesls.sty}} % % This package file is a \LaTeXe\ compatible replacement for % \texttt{curvesls.sty} % from versions 1.42 and earlier. It may one day be removed. % % \begin{macrocode} %<*ls> % \end{macrocode} % % \begin{macrocode} \ProvidesPackage{curvesls} [2000/08/22 Obsolete! Using option emtex in package curves.] \RequirePackage[emtex]{curves} % \end{macrocode} % % \begin{macrocode} % % \end{macrocode} % % \Finale % % \typeout{} % \typeout{Please uncomment the line containing % just \string\OnlyDescription\space } % \typeout{near the start of curves.dtx to prevent the curves.sty} % \typeout{and curvesls.sty listings printing out.} % \typeout{} % % \end{document} \endinput MODIFICATION HISTORY -------------------- curves.sty 1.0 26 June 1991 curves.sty 1.1 8 Jan 1992 large \diskpitchstretch and maximum integer=2^30 - 1. curvesls.sty 1.0 21 Mar 1993 draw lines using emTeX dvidriver \special's. 1.1 23 April, 1993 corrected for large \curves and 2nd differences. 1.14 29 April, 1993 Alignment of spaces improved in \@nscdashes, \overhang normalized. 1.15 1 May, 1993 Rounding errors in \nscdashes and \pdashes improved. 1.16 8 May, 1993 Reduced .dvi size and dots corrected. 1.2 23 May, 1993 Variable curve symbol introduced. 1.21 8 June, 1993 \unitlength corrected in \bigcircle. 1.22 15 June, 1993 \csb@x saves curve symbol, dash pattern selection rounded. 1.23 18 June, 1993 extra \@killglue and curve smoothing, test for bad point order tightened. 1st network release. 2517 words of TeX main memory. 1.30 9 July 1993 2nd network release. Bugs Fixed: Blank curve if \csdiameter too large; Transfer of \@y and \@overhang from inner loop of \@drwarc; Missing \pt@false in \@ncsdashes and \@pdashes; Check for zero \@np in \@bezier. Improvements (?): New internal macros to save tokens; Uses LaTeX error messages and warnings; Checks \curvedashes signs; Potential conflicts with other macros reduced with new \@y, \@tc; Warns more readily and replaces possible inflexions with straight line; Some internal variable names rationalized. 2489 words of TeX main memory. 1.32 14 June 1994 3rd network release tested with LaTeX 2e of February 1994. 1.33 28 June 1994 4th network release tested with LaTeX 2e of 1 June 1994. Redefines \bezier from June LaTeX 2e. \@bezier renamed to \@Vbezier to avoid conflict with June LaTeX 2e. 1.40 20 August 1995 5th network release tested with LaTeX 2e of 1 June 1995. Bug Fixed: Dashed curves use straight segments to reduce rounding error. Improvements: \curvewarnfalse stops warning of straight line use between points; ; catcoded to character to protect internal names; New internal macros save tokens and increase speed; 1772 nett extra words of TeX main memory (LaTeX 2e 1995/6/1 pl1). 1.41 28 November 1996 \;points for wrong \;dy in dash. 1.42 12 August 2000 6th Internet release last tested and working with LaTeX 2.09. 1.50 22 August 2000 6th Internet release tested with LaTeX2e <1998/12/01> patch level 1. Copyright licence now LPPL. Improvements: Curvesls.sty merged into curves.sty with options for dvips, emtex, xdvi and WML \specials; More documentation on scaling; LaTeX 2e style warnings and errors; Comments stripped from curves.sty; Tested with color package; All curves consist of short straight lines; Fewer disks per curve by constant pitch on straight lines; Greater accuracy and speed and less memory in use. 2047 nett extra words of TeX main memory to load with no option down to 1913 with WML option. 1.51 24 April 2008 7th Internet release Email address now 1.52 29 August 2008 8th Internet release Copyright licence now LPPL version 1.3. Correction: new upstream website http://patch.bpa.nu/pub/archive/latex/macros/curves/. Improvements: straight lines for parabolic arcs switch; more macro documentation; reworded instructions and README. 1.53 29 September 2008 Improvements: hyperref in curves.pdf.