summaryrefslogtreecommitdiff
path: root/macros/plain/graphics
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/plain/graphics
Initial commit
Diffstat (limited to 'macros/plain/graphics')
-rw-r--r--macros/plain/graphics/README.txt107
-rw-r--r--macros/plain/graphics/autopict.sty360
-rw-r--r--macros/plain/graphics/color.tex9
-rw-r--r--macros/plain/graphics/exmplcol.tex6
-rw-r--r--macros/plain/graphics/exmplgrf.tex10
-rw-r--r--macros/plain/graphics/exmplpfg.tex17
-rw-r--r--macros/plain/graphics/exmplpic.tex15
-rw-r--r--macros/plain/graphics/graphicx.tex18
-rw-r--r--macros/plain/graphics/miniltx.tex511
-rw-r--r--macros/plain/graphics/picture.tex51
-rw-r--r--macros/plain/graphics/psfrag.tex49
11 files changed, 1153 insertions, 0 deletions
diff --git a/macros/plain/graphics/README.txt b/macros/plain/graphics/README.txt
new file mode 100644
index 0000000000..fc65eaf69b
--- /dev/null
+++ b/macros/plain/graphics/README.txt
@@ -0,0 +1,107 @@
+
+Graphics code for non-LaTeX users.
+==================================
+
+This directory provides a small wrapper file such that users of
+formats based on plain TeX may make use of some of the parts of the
+standard LaTeX distribution.
+
+These files are *NOT* supported by the LaTeX3 project, and any
+problems with them should *NOT* be reported to the LaTeX bugs system.
+
+Problems should be reported as issues at
+https://github.com/davidcarlisle/dpctex/tree/master/graphics-pln
+
+
+David Carlisle 1995/01/29
+ 1996/11/13
+ 2016/08/17
+ 2017/06/01
+ 2018/01/16
+
+Copyright 1995 1996 2016 2017 2018 David Carlisle
+
+ All the files in this directory may be redistributed and/or modified
+ under the terms of the LaTeX Project Public License distributed from
+ CTAN archives in directory macros/latex/base/lppl.txt; either
+ version 1 of the License, or (at your option) any later version.
+
+
+
+This directory contains
+
+README.txt This file.
+
+exmplpic.tex
+ A plain TeX document using LaTeX' `picture mode': a portable
+ means of producing simple diagrams.
+
+exmplgrf.tex
+ A plain TeX document using the LaTeX graphicx package, for
+ rotating and scaling text, and include PostScript and other
+ graphics formats. (This will include the file a.ps available
+ in the LaTeX graphics distribution.)
+
+exmplcol.tex
+ A plain TeX document using the LaTeX color package, for
+ producing colour.
+
+exmplpfg.tex
+ A plain TeX document using the contributed LaTeX psfrag package,
+ for including PostScript documents, while replacing certain text
+ strings with TeX typeset replacements. This uses the example.eps
+ figure from the psfrag 3.0 distribution.
+
+miniltx.tex
+ A small `miniLaTeX' that defines fakes or otherwise hacks
+ sufficient bits of LaTeX internals so that the packages can load.
+
+picture.tex
+ The user interface to the picture environment.
+ \input picture.
+ Normally a plain-style syntax is used, viz
+ \picture(100,100)
+ ....
+ \endpicture
+
+ However if the command \LaTeXbegin is issued, then a LaTeX
+ syntax of
+ \begin{picture}(100,100)
+ ....
+ \end{picture}
+ May be used. this may be prefered if the picture is being copied
+ from a LaTeX document, or if it is produced automatically from
+ a drawing tool such as xfig or texcad.
+
+autopict.sty
+ This is a frozen copy of a file that used to be distributed with
+ LaTeX but is no longer needed in that context, it is basocally
+ the source of LaTeX Picture mode from LaTeX in 2014. The
+ original use for this package was to build a latex format in
+ which some environments such as picture and tabbing were not
+ defined by default, to save space if working with TeX on a
+ machine with 640K memory.
+
+
+graphicx.tex
+ The user interface to the graphicx package.
+ \input graphicx
+ See the documentation in grfguide.ps in the LaTeX graphics
+ distribution.
+ This file sets the driver to be dvips. If you
+ use another driver, edit accordingly.
+
+color.tex
+ The user interface to the color package.
+ \input color
+ See the documentation in grfguide.ps in the LaTeX graphics
+ distribution.
+ This file sets the driver to be dvips. If you
+ use another driver, edit accordingly.
+
+
+psfrag.tex
+ The user interface to the psfrag package.
+ \input psfrag
+ See the documentation in pfgguide.tex in the psfrag distribution,
+ and the example document pfgexmpl.tex included here.
diff --git a/macros/plain/graphics/autopict.sty b/macros/plain/graphics/autopict.sty
new file mode 100644
index 0000000000..fcb52adfc1
--- /dev/null
+++ b/macros/plain/graphics/autopict.sty
@@ -0,0 +1,360 @@
+%%
+%% This is file `autopict.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% ltpictur.dtx (with options: `def')
+%%
+%% This is a generated file.
+%%
+%% Copyright 1993 1994 1995 1996
+%% The LaTeX3 Project and any individual authors listed elsewhere
+%% in this file.
+%%
+%% Originally generated from the LaTeX sources by docstrip, but
+%% the relevant guards are no longer in the sources as the autoload
+%% variant of LaTeX is no longer supported (or needed).
+
+%%% This file may be distributed under the terms of the LPPL, see
+%%% README.txt for details.
+
+%%% From File: ltpictur.dtx
+\ProvidesFile{autopict.sty}
+ [2001/08/27 v1.1k Picture mode autoload file]
+\long\gdef\picture#1{\pictur@#1}
+\gdef\pictur@(#1){%
+ \@ifnextchar({\@picture(#1)}{\@picture(#1)(0,0)}}
+\gdef\@picture(#1,#2)(#3,#4){%
+ \@picht#2\unitlength
+ \setbox\@picbox\hb@xt@#1\unitlength\bgroup
+ \hskip -#3\unitlength
+ \lower #4\unitlength\hbox\bgroup
+ \ignorespaces}
+\gdef\endpicture{%
+ \egroup\hss\egroup
+ \ht\@picbox\@picht\dp\@picbox\z@
+ \mbox{\box\@picbox}}
+\long\gdef\put(#1,#2)#3{%
+ \@killglue\raise#2\unitlength
+ \hb@xt@\z@{\kern#1\unitlength #3\hss}%
+ \ignorespaces}
+\gdef\multiput(#1,#2)#3{%
+ \@xdim #1\unitlength
+ \@ydim #2\unitlength
+ \@multiput(}
+\long\gdef\@multiput(#1,#2)#3#4{%
+ \@killglue\@multicnt #3\relax
+ \@whilenum \@multicnt >\z@\do
+ {\raise\@ydim\hb@xt@\z@{\kern\@xdim #4\hss}%
+ \advance\@multicnt\m@ne
+ \advance\@xdim#1\unitlength\advance\@ydim#2\unitlength}%
+ \ignorespaces}
+\gdef\@killglue{\unskip\@whiledim \lastskip >\z@\do{\unskip}}
+\gdef\thinlines{\let\@linefnt\tenln \let\@circlefnt\tencirc
+ \@wholewidth\fontdimen8\tenln \@halfwidth .5\@wholewidth}
+\gdef\thicklines{\let\@linefnt\tenlnw \let\@circlefnt\tencircw
+ \@wholewidth\fontdimen8\tenlnw \@halfwidth .5\@wholewidth}
+\gdef\linethickness#1{\@wholewidth #1\relax \@halfwidth .5\@wholewidth}
+\gdef\shortstack{\@ifnextchar[\@shortstack{\@shortstack[c]}}
+\gdef\@shortstack[#1]{%
+ \leavevmode
+ \vbox\bgroup
+ \baselineskip-\p@\lineskip 3\p@
+ \let\mb@l\hss\let\mb@r\hss
+ \expandafter\let\csname mb@#1\endcsname\relax
+ \let\\\@stackcr
+ \@ishortstack}
+\gdef\@ishortstack#1{\ialign{\mb@l {##}\unskip\mb@r\cr #1\crcr}\egroup}
+\gdef\@stackcr{\@ifstar\@ixstackcr\@ixstackcr}
+\gdef\@ixstackcr{\@ifnextchar[\@istackcr{\cr\ignorespaces}}
+\gdef\@istackcr[#1]{\cr\noalign{\vskip #1}\ignorespaces}
+\newif\if@negarg
+\gdef\line(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax
+ \@linelen #3\unitlength
+ \ifdim\@linelen<\z@\@badlinearg\else
+ \ifnum\@xarg =\z@ \@vline
+ \else \ifnum\@yarg =\z@ \@hline \else \@sline\fi
+ \fi
+ \fi}
+\gdef\@sline{%
+ \ifnum\@xarg<\z@ \@negargtrue \@xarg -\@xarg \@yyarg -\@yarg
+ \else \@negargfalse \@yyarg \@yarg \fi
+\ifnum \@yyarg >\z@ \@tempcnta\@yyarg \else \@tempcnta -\@yyarg \fi
+\ifnum\@tempcnta>6 \@badlinearg\@tempcnta\z@ \fi
+\ifnum\@xarg>6 \@badlinearg\@xarg \@ne \fi
+\setbox\@linechar\hbox{\@linefnt\@getlinechar(\@xarg,\@yyarg)}%
+\ifdim\wd\@linechar=\z@
+ \setbox\@linechar\hbox{.}%
+ \@badlinearg
+\fi
+\ifnum \@yarg >\z@ \let\@upordown\raise \@clnht\z@
+ \else\let\@upordown\lower \@clnht \ht\@linechar\fi
+\@clnwd \wd\@linechar
+\if@negarg
+ \hskip -\wd\@linechar \def\reserved@a{\hskip -2\wd\@linechar}%
+\else
+ \let\reserved@a\relax
+\fi
+\@whiledim \@clnwd <\@linelen \do
+ {\@upordown\@clnht\copy\@linechar
+ \reserved@a
+ \advance\@clnht \ht\@linechar
+ \advance\@clnwd \wd\@linechar}%
+\advance\@clnht -\ht\@linechar
+\advance\@clnwd -\wd\@linechar
+\@tempdima\@linelen\advance\@tempdima -\@clnwd
+\@tempdimb\@tempdima\advance\@tempdimb -\wd\@linechar
+\if@negarg \hskip -\@tempdimb \else \hskip \@tempdimb \fi
+\multiply\@tempdima \@m
+\@tempcnta \@tempdima
+\@tempdima \wd\@linechar \divide\@tempcnta \@tempdima
+\@tempdima \ht\@linechar \multiply\@tempdima \@tempcnta
+\divide\@tempdima \@m
+\advance\@clnht \@tempdima
+\ifdim \@linelen <\wd\@linechar
+ \hskip \wd\@linechar
+ \ifdim \@linelen = \z@
+ \else
+ \@picture@warn
+ \fi
+ \else\@upordown\@clnht\copy\@linechar\fi}
+\gdef\@hline{\ifnum \@xarg <\z@ \hskip -\@linelen \fi
+\vrule \@height \@halfwidth \@depth \@halfwidth \@width \@linelen
+\ifnum \@xarg <\z@ \hskip -\@linelen \fi}
+\gdef\@getlinechar(#1,#2){\@tempcnta#1\relax\multiply\@tempcnta 8%
+ \advance\@tempcnta -9\ifnum #2>\z@ \advance\@tempcnta #2\relax\else
+ \advance\@tempcnta -#2\relax\advance\@tempcnta 64 \fi
+ \char\@tempcnta}
+\gdef\vector(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax
+ \@tempcnta \ifnum\@xarg<\z@ -\@xarg\else\@xarg\fi
+ \ifnum\@tempcnta<5\relax
+ \@linelen #3\unitlength
+ \ifdim\@linelen<\z@\@badlinearg\else
+ \ifnum\@xarg =\z@ \@vvector
+ \else \ifnum\@yarg =\z@ \@hvector \else \@svector\fi
+ \fi
+ \fi
+ \else\@badlinearg\fi}
+\gdef\@hvector{\@hline\hb@xt@\z@{\@linefnt
+ \ifnum \@xarg <\z@ \@getlarrow(1,0)\hss\else
+ \hss\@getrarrow(1,0)\fi}}
+\gdef\@vvector{\ifnum \@yarg <\z@ \@downvector \else \@upvector \fi}
+\gdef\@svector{\@sline
+ \@tempcnta\@yarg \ifnum\@tempcnta <\z@ \@tempcnta -\@tempcnta\fi
+ \ifnum\@tempcnta <5%
+ \hskip -\wd\@linechar
+ \@upordown\@clnht \hbox{\@linefnt \if@negarg
+ \@getlarrow(\@xarg,\@yyarg)\else \@getrarrow(\@xarg,\@yyarg)\fi}%
+ \else\@badlinearg\fi}
+\gdef\@getlarrow(#1,#2){\ifnum #2=\z@ \@tempcnta 27 % '33
+ \else
+ \@tempcnta #1\relax\multiply\@tempcnta \sixt@@n
+ \advance\@tempcnta -9 \@tempcntb #2\relax\multiply\@tempcntb \tw@
+ \ifnum \@tempcntb >\z@ \advance\@tempcnta \@tempcntb
+ \else\advance\@tempcnta -\@tempcntb\advance\@tempcnta 64
+ \fi\fi\char\@tempcnta}
+\gdef\@getrarrow(#1,#2){\@tempcntb #2\relax
+\ifnum\@tempcntb <\z@ \@tempcntb -\@tempcntb\relax\fi
+\ifcase \@tempcntb\relax \@tempcnta 45 % '55
+\or
+\ifnum #1<\thr@@ \@tempcnta #1\relax\multiply\@tempcnta
+24\advance\@tempcnta -6 \else \ifnum #1=\thr@@ \@tempcnta 49
+\else\@tempcnta 58 \fi\fi\or
+\ifnum #1<\thr@@ \@tempcnta=#1\relax\multiply\@tempcnta
+24\advance\@tempcnta -\thr@@ \else \@tempcnta 51 \fi\or
+\@tempcnta #1\relax\multiply\@tempcnta
+\sixt@@n \advance\@tempcnta -\tw@ \else
+\@tempcnta #1\relax\multiply\@tempcnta
+\sixt@@n \advance\@tempcnta 7 \fi\ifnum #2<\z@ \advance\@tempcnta 64 \fi
+\char\@tempcnta}
+\gdef\@vline{\ifnum \@yarg <\z@ \@downline \else \@upline\fi}
+\gdef\@upline{%
+ \hb@xt@\z@{\hskip -\@halfwidth \vrule \@width \@wholewidth
+ \@height \@linelen \@depth \z@\hss}}
+\gdef\@downline{%
+ \hb@xt@\z@{\hskip -\@halfwidth \vrule \@width \@wholewidth
+ \@height \z@ \@depth \@linelen \hss}}
+\gdef\@upvector{\@upline\setbox\@tempboxa\hbox{\@linefnt\char 54}% % '66
+ \raise \@linelen \hb@xt@\z@{\lower \ht\@tempboxa\box\@tempboxa\hss}}
+\gdef\@downvector{\@downline\lower \@linelen
+ \hb@xt@\z@{\@linefnt\char 63 % '77
+ \hss}}
+\gdef\dashbox#1(#2,#3){\leavevmode\hb@xt@\z@{\baselineskip \z@skip
+\lineskip \z@skip
+\@dashdim #2\unitlength
+\@dashcnt \@dashdim \advance\@dashcnt 200
+\@dashdim #1\unitlength\divide\@dashcnt \@dashdim
+\ifodd\@dashcnt\@dashdim \z@
+\advance\@dashcnt \@ne \divide\@dashcnt \tw@
+\else \divide\@dashdim \tw@ \divide\@dashcnt \tw@
+\advance\@dashcnt \m@ne
+\setbox\@dashbox \hbox{\vrule \@height \@halfwidth \@depth \@halfwidth
+\@width \@dashdim}\put(0,0){\copy\@dashbox}%
+\put(0,#3){\copy\@dashbox}%
+\put(#2,0){\hskip-\@dashdim\copy\@dashbox}%
+\put(#2,#3){\hskip-\@dashdim\box\@dashbox}%
+\multiply\@dashdim \thr@@
+\fi
+\setbox\@dashbox \hbox{\vrule \@height \@halfwidth \@depth \@halfwidth
+\@width #1\unitlength\hskip #1\unitlength}\@tempcnta\z@
+\put(0,0){\hskip\@dashdim \@whilenum \@tempcnta <\@dashcnt
+\do{\copy\@dashbox\advance\@tempcnta \@ne }}\@tempcnta\z@
+\put(0,#3){\hskip\@dashdim \@whilenum \@tempcnta <\@dashcnt
+\do{\copy\@dashbox\advance\@tempcnta \@ne }}%
+\@dashdim #3\unitlength
+\@dashcnt \@dashdim \advance\@dashcnt 200
+\@dashdim #1\unitlength\divide\@dashcnt \@dashdim
+\ifodd\@dashcnt \@dashdim \z@
+\advance\@dashcnt \@ne \divide\@dashcnt \tw@
+\else
+\divide\@dashdim \tw@ \divide\@dashcnt \tw@
+\advance\@dashcnt \m@ne
+\setbox\@dashbox\hbox{\hskip -\@halfwidth
+\vrule \@width \@wholewidth
+\@height \@dashdim}\put(0,0){\copy\@dashbox}%
+\put(#2,0){\copy\@dashbox}%
+\put(0,#3){\lower\@dashdim\copy\@dashbox}%
+\put(#2,#3){\lower\@dashdim\copy\@dashbox}%
+\multiply\@dashdim \thr@@
+\fi
+\setbox\@dashbox\hbox{\vrule \@width \@wholewidth
+\@height #1\unitlength}\@tempcnta\z@
+\put(0,0){\hskip -\@halfwidth \vbox{\@whilenum \@tempcnta <\@dashcnt
+\do{\vskip #1\unitlength\copy\@dashbox\advance\@tempcnta \@ne }%
+\vskip\@dashdim}}\@tempcnta\z@
+\put(#2,0){\hskip -\@halfwidth \vbox{\@whilenum \@tempcnta<\@dashcnt
+\do{\vskip #1\unitlength\copy\@dashbox\advance\@tempcnta \@ne }%
+\vskip\@dashdim}}}\@makepicbox(#2,#3)}
+\newif\if@ovt
+\newif\if@ovb
+\newif\if@ovl
+\newif\if@ovr
+\gdef\@getcirc#1{\@tempdima #1\relax \advance\@tempdima 2\p@
+ \@tempcnta\@tempdima
+ \@tempdima 4\p@ \divide\@tempcnta\@tempdima
+ \ifnum \@tempcnta >10\relax
+ \@picture@warn
+ \@tempcnta 10\relax
+ \fi
+ \ifnum \@tempcnta >\z@ \advance\@tempcnta\m@ne
+ \else \@picture@warn \fi
+ \multiply\@tempcnta 4\relax
+ \setbox \@tempboxa \hbox{\@circlefnt
+ \char \@tempcnta}\@tempdima \wd \@tempboxa}
+\def\@picture@warn{\@latex@warning{%
+ \string\oval, \string\circle, or \string\line\space
+ size unavailable}}
+\gdef\@put#1#2#3{\raise #2\hb@xt@\z@{\hskip #1#3\hss}}
+\gdef\oval(#1,#2){\@ifnextchar[{\@oval(#1,#2)}{\@oval(#1,#2)[]}}
+\gdef\@oval(#1,#2)[#3]{\begingroup\boxmaxdepth \maxdimen
+ \@ovttrue \@ovbtrue \@ovltrue \@ovrtrue
+ \@tfor\reserved@a :=#3\do{\csname @ov\reserved@a false\endcsname}%
+ \@ovxx
+ #1\unitlength \@ovyy #2\unitlength
+ \@tempdimb \ifdim \@ovyy >\@ovxx \@ovxx\else \@ovyy \fi
+ \advance \@tempdimb -2\p@
+ \@getcirc \@tempdimb
+ \@ovro \ht\@tempboxa \@ovri \dp\@tempboxa
+ \@ovdx\@ovxx \advance\@ovdx -\@tempdima \divide\@ovdx \tw@
+ \@ovdy\@ovyy \advance\@ovdy -\@tempdima \divide\@ovdy \tw@
+ \@circlefnt \setbox\@tempboxa
+ \hbox{\if@ovr \@ovvert32\kern -\@tempdima \fi
+ \if@ovl \kern \@ovxx \@ovvert01\kern -\@tempdima \kern -\@ovxx \fi
+ \if@ovt \@ovhorz \kern -\@ovxx \fi
+ \if@ovb \raise \@ovyy \@ovhorz \fi}\advance\@ovdx\@ovro
+ \advance\@ovdy\@ovro \ht\@tempboxa\z@ \dp\@tempboxa\z@
+ \@put{-\@ovdx}{-\@ovdy}{\box\@tempboxa}%
+ \endgroup}
+\gdef\@ovvert#1#2{\vbox to\@ovyy{%
+ \if@ovb \@tempcntb \@tempcnta \advance \@tempcntb #1\relax
+ \kern -\@ovro \hbox{\char \@tempcntb}\nointerlineskip
+ \else \kern \@ovri \kern \@ovdy \fi
+ \leaders\vrule \@width \@wholewidth\vfil \nointerlineskip
+ \if@ovt \@tempcntb \@tempcnta \advance \@tempcntb #2\relax
+ \hbox{\char \@tempcntb}%
+ \else \kern \@ovdy \kern \@ovro \fi}}
+\gdef\@ovhorz{\hb@xt@\@ovxx{\kern \@ovro
+ \if@ovr \else \kern \@ovdx \fi
+ \leaders \hrule \@height \@wholewidth \hfil
+ \if@ovl \else \kern \@ovdx \fi
+ \kern \@ovri}}
+\gdef\circle{\@inmatherr\circle\@ifstar\@dot\@circle}
+\gdef\@circle#1{%
+ \begingroup \boxmaxdepth \maxdimen \@tempdimb #1\unitlength
+ \ifdim \@tempdimb >15.5\p@ \@getcirc\@tempdimb
+ \@ovro\ht\@tempboxa
+ \setbox\@tempboxa\hbox{\@circlefnt
+ \advance\@tempcnta\tw@ \char \@tempcnta
+ \advance\@tempcnta\m@ne \char \@tempcnta \kern -2\@tempdima
+ \advance\@tempcnta\tw@
+ \raise \@tempdima \hbox{\char\@tempcnta}\raise \@tempdima
+ \box\@tempboxa}\ht\@tempboxa\z@ \dp\@tempboxa\z@
+ \@put{-\@ovro}{-\@ovro}{\box\@tempboxa}%
+ \else \@circ\@tempdimb{96}\fi\endgroup}
+\gdef\@dot#1{\@tempdimb #1\unitlength \@circ\@tempdimb{112}}
+\gdef\@circ#1#2{\@tempdima #1\relax \advance\@tempdima .5\p@
+ \@tempcnta\@tempdima \@tempdima \p@
+ \divide\@tempcnta\@tempdima
+ \ifnum\@tempcnta >15\relax \@tempcnta 15\relax \fi
+ \ifnum \@tempcnta >\z@ \advance\@tempcnta\m@ne\fi
+ \advance\@tempcnta #2\relax
+ \@circlefnt \char\@tempcnta}
+\ifx\qbeziermax\@undefined
+\gdef\qbeziermax{500}
+\fi
+\newcommand\qbezier[2][0]{\bezier{#1}#2}
+\gdef\bezier#1)#2(#3)#4({\@bezier#1)(#3)(}
+\gdef\@bezier#1(#2,#3)(#4,#5)(#6,#7){%
+ \ifnum #1=\z@
+ \@ovxx #4\unitlength
+ \advance\@ovxx -#2\unitlength
+ \ifdim \@ovxx<\z@ \@ovxx -\@ovxx \fi
+ \@ovdx #6\unitlength
+ \advance\@ovdx -#4\unitlength
+ \ifdim \@ovdx<\z@ \@ovdx -\@ovdx \fi
+ \ifdim \@ovxx<\@ovdx \@ovxx \@ovdx \fi
+ \@ovyy #5\unitlength
+ \advance\@ovyy -#3\unitlength
+ \ifdim \@ovyy<\z@ \@ovyy -\@ovyy \fi
+ \@ovdy #7\unitlength
+ \advance\@ovdy -#5\unitlength
+ \ifdim \@ovdy<\z@ \@ovdy -\@ovdy \fi
+ \ifdim \@ovyy<\@ovdy \@ovyy \@ovdy \fi
+ \@multicnt
+ \ifdim \@ovxx>\@ovyy \@ovxx \else \@ovyy \fi
+ \@ovxx .5\@halfwidth \divide\@multicnt\@ovxx
+ \ifnum \qbeziermax<\@multicnt \@multicnt\qbeziermax\relax \fi
+ \else \@multicnt#1\relax \fi
+ \@tempcnta\@multicnt \advance\@tempcnta\@ne
+ \@ovdx #4\unitlength \advance\@ovdx -#2\unitlength
+ \multiply\@ovdx \tw@
+ \@ovxx #6\unitlength \advance\@ovxx -#2\unitlength
+ \advance\@ovxx -\@ovdx \divide\@ovxx\@multicnt
+ \@ovdy #5\unitlength \advance\@ovdy -#3\unitlength
+ \multiply\@ovdy \tw@
+ \@ovyy #7\unitlength \advance\@ovyy -#3\unitlength
+ \advance\@ovyy -\@ovdy \divide\@ovyy\@multicnt
+ \setbox\@tempboxa\hbox{%
+ \hskip -\@halfwidth
+ \vrule \@height\@halfwidth
+ \@depth \@halfwidth
+ \@width \@wholewidth}%
+ \put(#2,#3){%
+ \count@\z@
+ \@whilenum{\count@<\@tempcnta}\do
+ {\@xdim\count@\@ovxx
+ \advance\@xdim\@ovdx
+ \divide\@xdim\@multicnt
+ \multiply\@xdim\count@
+ \@ydim\count@\@ovyy
+ \advance\@ydim\@ovdy
+ \divide\@ydim\@multicnt
+ \multiply\@ydim\count@
+ \raise \@ydim
+ \hb@xt@\z@{\kern\@xdim
+ \unhcopy\@tempboxa\hss}%
+ \advance\count@\@ne}}}
+\endinput
+%%
+%% End of file `autopict.sty'.
diff --git a/macros/plain/graphics/color.tex b/macros/plain/graphics/color.tex
new file mode 100644
index 0000000000..fb8c1284ff
--- /dev/null
+++ b/macros/plain/graphics/color.tex
@@ -0,0 +1,9 @@
+% Plain TeX interface to color package.
+% David Carlisle
+
+\input miniltx
+
+\def\Gin@driver{dvips.def}
+\input color.sty
+
+\resetatcatcode
diff --git a/macros/plain/graphics/exmplcol.tex b/macros/plain/graphics/exmplcol.tex
new file mode 100644
index 0000000000..0442ed9a40
--- /dev/null
+++ b/macros/plain/graphics/exmplcol.tex
@@ -0,0 +1,6 @@
+
+\input color
+
+a \textcolor{red}{bbb} \colorbox{green}{one two}
+
+\bye
diff --git a/macros/plain/graphics/exmplgrf.tex b/macros/plain/graphics/exmplgrf.tex
new file mode 100644
index 0000000000..d1a51b8ef1
--- /dev/null
+++ b/macros/plain/graphics/exmplgrf.tex
@@ -0,0 +1,10 @@
+
+\input graphicx
+
+\includegraphics{a}
+
+\includegraphics[scale=2]{a}
+
+hello\rotatebox[origin=c]{180}{hello}hello
+
+\bye
diff --git a/macros/plain/graphics/exmplpfg.tex b/macros/plain/graphics/exmplpfg.tex
new file mode 100644
index 0000000000..0026cd0ee6
--- /dev/null
+++ b/macros/plain/graphics/exmplpfg.tex
@@ -0,0 +1,17 @@
+
+\input psfrag
+
+First without psfrag:
+
+ \includegraphics[width=3.5in]{example.eps}
+
+and now with:
+
+ \psfragscanon
+ \psfrag{p1}[][l]{$\ast$}
+ \psfrag{p2}[][l]{$\ast$}
+ \psfrag{p3}{$\cos(t)$}
+ \includegraphics[width=3.5in]{example.eps}
+
+
+\bye
diff --git a/macros/plain/graphics/exmplpic.tex b/macros/plain/graphics/exmplpic.tex
new file mode 100644
index 0000000000..cb8852123b
--- /dev/null
+++ b/macros/plain/graphics/exmplpic.tex
@@ -0,0 +1,15 @@
+\input picture
+
+\picture(100,100)
+\put(0,0){\line(1,1){50}}
+\endpicture
+
+\LaTeXbegin
+
+\begin{picture}(40,40)
+\put(0,0){\vector(1,1){40}}
+\multiput(0,5)(10,10){4}{a}
+\end{picture}
+
+\bye
+
diff --git a/macros/plain/graphics/graphicx.tex b/macros/plain/graphics/graphicx.tex
new file mode 100644
index 0000000000..cbe6535769
--- /dev/null
+++ b/macros/plain/graphics/graphicx.tex
@@ -0,0 +1,18 @@
+% Plain TeX interface to graphicx package.
+% David Carlisle
+
+
+\input miniltx
+
+% ttfamily used in draft mode to show filenames.
+\ifx\ttfamily\@undefined
+ \let\ttfamily\tt
+\fi
+
+\def\Gin@driver{dvips.def}
+\input graphicx.sty
+
+
+\resetatcatcode
+
+
diff --git a/macros/plain/graphics/miniltx.tex b/macros/plain/graphics/miniltx.tex
new file mode 100644
index 0000000000..7290959d04
--- /dev/null
+++ b/macros/plain/graphics/miniltx.tex
@@ -0,0 +1,511 @@
+%%%
+%%%
+%%% Parts of LaTeX: Slightly changed/simplified in places.
+%%% Changes
+%%% Copyright 1996-2017 David Carlisle LaTeX3 Project
+%%% Original Code
+%%% Copyright 1993-1996 LaTeX3 Project and original authors
+%%%
+%%% Problems relating to this fileshould not be sent to the LaTeX bugs address,
+%%% or any other LaTeX related support address.
+%%%
+%%% Problems should be reported as issues at
+%%% https://github.com/davidcarlisle/dpctex/tree/master/graphics-pln
+%%%
+%%%
+%%% This file may be distributed under the terms of the LPPL, see
+%%% README.txt for details.
+
+% 1996/01/29 initial version
+% 1996/05/09 a few missing commands added
+% 1996/11/21 fixed @ catcode handling
+% 2010/01/02 import LaTeX's current \filename@parse [KB/DC]
+% (http://sourceforge.net/projects/asymptote/forums/forum/409349/topic/3405573)
+% 2010/01/07 import was incomplete [KB]
+% 2010/02/03 accept *-form of \ProcessOptions [KB/DL]
+% 2016/08/17 fix catcode @ handling (again), document github address [DC]
+% 2017/06/01 assorted updates to cover updated latex drivers
+
+\edef\resetatcatcode{\catcode`\noexpand\@\the\catcode`\@\relax}
+
+\def\makeatletter{\catcode`\@11\relax}
+\def\makeatother{\catcode`\@12\relax}
+\makeatletter
+
+
+% 2016/08/17 move after \makeatletter
+% so \input graphicx \input color works.
+\ifx\miniltx\undefined\else\endinput\fi
+\let\miniltx\box
+
+\def\@makeother#1{\catcode`#1=12\relax}
+
+
+\def\@ifnextchar#1#2#3{%
+ \let\reserved@d=#1%
+ \def\reserved@a{#2}\def\reserved@b{#3}%
+ \futurelet\@let@token\@ifnch}
+\def\@ifnch{%
+ \ifx\@let@token\@sptoken
+ \let\reserved@c\@xifnch
+ \else
+ \ifx\@let@token\reserved@d
+ \let\reserved@c\reserved@a
+ \else
+ \let\reserved@c\reserved@b
+ \fi
+ \fi
+ \reserved@c}
+\begingroup
+\def\:{\global\let\@sptoken= } \: % this makes \@sptoken a space token
+\def\:{\@xifnch} \expandafter\gdef\: {\futurelet\@let@token\@ifnch}
+\endgroup
+
+
+
+\def\@ifstar#1{\@ifnextchar *{\@firstoftwo{#1}}}
+\long\def\@dblarg#1{\@ifnextchar[{#1}{\@xdblarg{#1}}}
+\long\def\@xdblarg#1#2{#1[{#2}]{#2}}
+
+\long\def \@gobble #1{}
+\long\def \@gobbletwo #1#2{}
+\long\def \@gobblefour #1#2#3#4{}
+\long\def\@firstofone#1{#1}
+\long\def\@firstoftwo#1#2{#1}
+\long\def\@secondoftwo#1#2{#2}
+
+\def\NeedsTeXFormat#1{\@ifnextchar[\@needsf@rmat\relax}
+\def\@needsf@rmat[#1]{}
+\def\ProvidesPackage#1{\@ifnextchar[%
+ {\@pr@videpackage{#1}}{\@pr@videpackage#1[]}}
+\def\@pr@videpackage#1[#2]{\wlog{#1: #2}}
+\let\ProvidesFile\ProvidesPackage
+\def\PackageInfo#1#2{{%
+ \newlinechar`\^^J\def\MessageBreak{^^J#1: }%
+ \wlog{#1: #2}}}
+
+\let\DeclareOption\@gobbletwo
+\def\ProcessOptions{\@ifstar\relax\relax}
+
+\def\RequirePackage{%
+ \@fileswithoptions\@pkgextension}
+\def\@fileswithoptions#1{%
+ \@ifnextchar[%]
+ {\@fileswith@ptions#1}%
+ {\@fileswith@ptions#1[]}}
+\def\@fileswith@ptions#1[#2]#3{%
+ \@ifnextchar[%]
+ {\@fileswith@pti@ns#1[#2]#3}%
+ {\@fileswith@pti@ns#1[#2]#3[]}}
+
+\def\@fileswith@pti@ns#1[#2]#3[#4]{%
+ \def\reserved@b##1,{%
+ \ifx\@nil##1\relax\else
+ \ifx\relax##1\relax\else
+ \noexpand\@onefilewithoptions##1[#2][#4]\noexpand\@pkgextension
+ \fi
+ \expandafter\reserved@b
+ \fi}%
+ \edef\reserved@a{\zap@space#3 \@empty}%
+ \edef\reserved@a{\expandafter\reserved@b\reserved@a,\@nil,}%
+ \reserved@a}
+
+\def\zap@space#1 #2{%
+ #1%
+ \ifx#2\@empty\else\expandafter\zap@space\fi
+ #2}
+
+\let\@empty\empty
+\def\@pkgextension{sty}
+
+\def\@onefilewithoptions#1[#2][#3]#4{%
+ \input #1.#4 }
+
+
+
+\def\typein{%
+ \let\@typein\relax
+ \@testopt\@xtypein\@typein}
+\def\@xtypein[#1]#2{%
+ \message{#2}%
+ \advance\endlinechar\@M
+ \read\@inputcheck to#1%
+ \advance\endlinechar-\@M
+ \@typein}
+\def\@namedef#1{\expandafter\def\csname #1\endcsname}
+\def\@nameuse#1{\csname #1\endcsname}
+\def\@cons#1#2{\begingroup\let\@elt\relax\xdef#1{#1\@elt #2}\endgroup}
+\def\@car#1#2\@nil{#1}
+\def\@cdr#1#2\@nil{#2}
+\def\@carcube#1#2#3#4\@nil{#1#2#3}
+\def\@preamblecmds{}
+
+\def\@star@or@long#1{%
+ \@ifstar
+ {\let\l@ngrel@x\relax#1}%
+ {\let\l@ngrel@x\long#1}}
+
+\let\l@ngrel@x\relax
+\def\newcommand{\@star@or@long\new@command}
+\def\new@command#1{%
+ \@testopt{\@newcommand#1}0}
+\def\@newcommand#1[#2]{%
+ \@ifnextchar [{\@xargdef#1[#2]}%
+ {\@argdef#1[#2]}}
+\long\def\@argdef#1[#2]#3{%
+ \@ifdefinable #1{\@yargdef#1\@ne{#2}{#3}}}
+\long\def\@xargdef#1[#2][#3]#4{%
+ \@ifdefinable#1{%
+ \expandafter\def\expandafter#1\expandafter{%
+ \expandafter
+ \@protected@testopt
+ \expandafter
+ #1%
+ \csname\string#1\expandafter\endcsname
+ {#3}}%
+ \expandafter\@yargdef
+ \csname\string#1\endcsname
+ \tw@
+ {#2}%
+ {#4}}}
+\def\@testopt#1#2{%
+ \@ifnextchar[{#1}{#1[#2]}}
+\def\@protected@testopt#1{%%
+ \ifx\protect\@typeset@protect
+ \expandafter\@testopt
+ \else
+ \@x@protect#1%
+ \fi}
+\long\def\@yargdef#1#2#3{%
+ \@tempcnta#3\relax
+ \advance \@tempcnta \@ne
+ \let\@hash@\relax
+ \edef\reserved@a{\ifx#2\tw@ [\@hash@1]\fi}%
+ \@tempcntb #2%
+ \@whilenum\@tempcntb <\@tempcnta
+ \do{%
+ \edef\reserved@a{\reserved@a\@hash@\the\@tempcntb}%
+ \advance\@tempcntb \@ne}%
+ \let\@hash@##%
+ \l@ngrel@x\expandafter\def\expandafter#1\reserved@a}
+\long\def\@reargdef#1[#2]#3{%
+ \@yargdef#1\@ne{#2}{#3}}
+\def\renewcommand{\@star@or@long\renew@command}
+\def\renew@command#1{%
+ {\escapechar\m@ne\xdef\@gtempa{{\string#1}}}%
+ \expandafter\@ifundefined\@gtempa
+ {\@latex@error{\string#1 undefined}\@ehc}%
+ {}%
+ \let\@ifdefinable\@rc@ifdefinable
+ \new@command#1}
+\long\def\@ifdefinable #1#2{%
+ \edef\reserved@a{\expandafter\@gobble\string #1}%
+ \@ifundefined\reserved@a
+ {\edef\reserved@b{\expandafter\@carcube \reserved@a xxx\@nil}%
+ \ifx \reserved@b\@qend \@notdefinable\else
+ \ifx \reserved@a\@qrelax \@notdefinable\else
+ #2%
+ \fi
+ \fi}%
+ \@notdefinable}
+\let\@@ifdefinable\@ifdefinable
+\long\def\@rc@ifdefinable#1#2{%
+ \let\@ifdefinable\@@ifdefinable
+ #2}
+\def\newenvironment{\@star@or@long\new@environment}
+\def\new@environment#1{%
+ \@testopt{\@newenva#1}0}
+\def\@newenva#1[#2]{%
+ \@ifnextchar [{\@newenvb#1[#2]}{\@newenv{#1}{[#2]}}}
+\def\@newenvb#1[#2][#3]{\@newenv{#1}{[#2][#3]}}
+\def\renewenvironment{\@star@or@long\renew@environment}
+\def\renew@environment#1{%
+ \@ifundefined{#1}%
+ {\@latex@error{Environment #1 undefined}\@ehc
+ }{}%
+ \expandafter\let\csname#1\endcsname\relax
+ \expandafter\let\csname end#1\endcsname\relax
+ \new@environment{#1}}
+\long\def\@newenv#1#2#3#4{%
+ \@ifundefined{#1}%
+ {\expandafter\let\csname#1\expandafter\endcsname
+ \csname end#1\endcsname}%
+ \relax
+ \expandafter\new@command
+ \csname #1\endcsname#2{#3}%
+ \l@ngrel@x\expandafter\def\csname end#1\endcsname{#4}}
+
+\def\providecommand{\@star@or@long\provide@command}
+\def\provide@command#1{%
+ {\escapechar\m@ne\xdef\@gtempa{{\string#1}}}%
+ \expandafter\@ifundefined\@gtempa
+ {\def\reserved@a{\new@command#1}}%
+ {\def\reserved@a{\renew@command\reserved@a}}%
+ \reserved@a}%
+
+\def\@ifundefined#1{%
+ \expandafter\ifx\csname#1\endcsname\relax
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+
+\chardef\@xxxii=32
+\mathchardef\@Mi=10001
+\mathchardef\@Mii=10002
+\mathchardef\@Miii=10003
+\mathchardef\@Miv=10004
+
+\newcount\@tempcnta
+\newcount\@tempcntb
+\newif\if@tempswa\@tempswatrue
+\newdimen\@tempdima
+\newdimen\@tempdimb
+\newdimen\@tempdimc
+\newbox\@tempboxa
+\newskip\@tempskipa
+\newskip\@tempskipb
+\newtoks\@temptokena
+
+\long\def\@whilenum#1\do #2{\ifnum #1\relax #2\relax\@iwhilenum{#1\relax
+ #2\relax}\fi}
+\long\def\@iwhilenum#1{\ifnum #1\expandafter\@iwhilenum
+ \else\expandafter\@gobble\fi{#1}}
+\long\def\@whiledim#1\do #2{\ifdim #1\relax#2\@iwhiledim{#1\relax#2}\fi}
+\long\def\@iwhiledim#1{\ifdim #1\expandafter\@iwhiledim
+ \else\expandafter\@gobble\fi{#1}}
+\long\def\@whilesw#1\fi#2{#1#2\@iwhilesw{#1#2}\fi\fi}
+\long\def\@iwhilesw#1\fi{#1\expandafter\@iwhilesw
+ \else\@gobbletwo\fi{#1}\fi}
+\def\@nnil{\@nil}
+\def\@empty{}
+\def\@fornoop#1\@@#2#3{}
+\long\def\@for#1:=#2\do#3{%
+ \expandafter\def\expandafter\@fortmp\expandafter{#2}%
+ \ifx\@fortmp\@empty \else
+ \expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}\fi}
+\long\def\@forloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\@nnil \else
+ #5\def#4{#2}\ifx #4\@nnil \else#5\@iforloop #3\@@#4{#5}\fi\fi}
+\long\def\@iforloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\@nnil
+ \expandafter\@fornoop \else
+ #4\relax\expandafter\@iforloop\fi#2\@@#3{#4}}
+\def\@tfor#1:={\@tf@r#1 }
+\long\def\@tf@r#1#2\do#3{\def\@fortmp{#2}\ifx\@fortmp\space\else
+ \@tforloop#2\@nil\@nil\@@#1{#3}\fi}
+\long\def\@tforloop#1#2\@@#3#4{\def#3{#1}\ifx #3\@nnil
+ \expandafter\@fornoop \else
+ #4\relax\expandafter\@tforloop\fi#2\@@#3{#4}}
+\long\def\@break@tfor#1\@@#2#3{\fi\fi}
+\def\@removeelement#1#2#3{%
+ \def\reserved@a##1,#1,##2\reserved@a{##1,##2\reserved@b}%
+ \def\reserved@b##1,\reserved@b##2\reserved@b{%
+ \ifx,##1\@empty\else##1\fi}%
+ \edef#3{%
+ \expandafter\reserved@b\reserved@a,#2,\reserved@b,#1,\reserved@a}}
+
+\let\ExecuteOptions\@gobble
+
+\def\on@line{ on input line \the\inputlineno}
+\ifx\@ehc\@undefined\def\@ehc{}\fi
+
+\def\PackageError#1#2#3{{%
+ \newlinechar`\^^J\def\MessageBreak{^^J\space\space#1: }%
+ \errhelp{#3}\errmessage{#1: #2}}}
+\def\@latex@error#1#2{\bgroup%
+ \newlinechar`\^^J\def\MessageBreak{^^J\space\space#1: }%
+ \edef\reserved@a{\egroup\errhelp{#2}\errmessage{#1}}%
+ \reserved@a}
+
+
+\bgroup\uccode`\!`\%\uppercase{\egroup
+\def\@percentchar{!}}
+
+% protect against loops in formats other than plain. 1999/04/27
+\ifx\@@input\@undefined
+ \let\@@input\input
+\fi
+
+\def\input{\@ifnextchar\bgroup\@iinput\@@input}
+\def\@iinput#1{\@@input#1 }
+
+\ifx\filename@parse\@undefined
+ \def\reserved@a{./}\ifx\@currdir\reserved@a
+ \wlog{^^JDefining UNIX/DOS style filename parser.^^J}
+ \def\filename@parse#1{%
+ \let\filename@area\@empty
+ \expandafter\filename@path#1/\\}
+ \def\filename@path#1/#2\\{%
+ \ifx\\#2\\%
+ \def\reserved@a{\filename@simple#1.\\}%
+ \else
+ \edef\filename@area{\filename@area#1/}%
+ \def\reserved@a{\filename@path#2\\}%
+ \fi
+ \reserved@a}
+ \else\def\reserved@a{[]}\ifx\@currdir\reserved@a
+ \wlog{^^JDefining VMS style filename parser.^^J}
+ \def\filename@parse#1{%
+ \let\filename@area\@empty
+ \expandafter\filename@path#1]\\}
+ \def\filename@path#1]#2\\{%
+ \ifx\\#2\\%
+ \def\reserved@a{\filename@simple#1.\\}%
+ \else
+ \edef\filename@area{\filename@area#1]}%
+ \def\reserved@a{\filename@path#2\\}%
+ \fi
+ \reserved@a}
+ \else\def\reserved@a{:}\ifx\@currdir\reserved@a
+ \wlog{^^JDefining Mac style filename parser.^^J}
+ \def\filename@parse#1{%
+ \let\filename@area\@empty
+ \expandafter\filename@path#1:\\}
+ \def\filename@path#1:#2\\{%
+ \ifx\\#2\\%
+ \def\reserved@a{\filename@simple#1.\\}%
+ \else
+ \edef\filename@area{\filename@area#1:}%
+ \def\reserved@a{\filename@path#2\\}%
+ \fi
+ \reserved@a}
+ \else
+ \wlog{^^JDefining generic filename parser.^^J}
+ \def\filename@parse#1{%
+ \let\filename@area\@empty
+ \expandafter\filename@simple#1.\\}
+ \fi\fi\fi
+ \def\filename@simple#1.#2\\{%
+ \ifx\\#2\\%
+ \let\filename@ext\relax
+ \else
+ \edef\filename@ext{\filename@dot#2\\}%
+ \fi
+ \edef\filename@base{#1}}
+ \def\filename@dot#1.\\{#1}
+\else
+ \wlog{^^J^^J%
+ \noexpand\filename@parse was defined in texsys.cfg:^^J%
+ \expandafter\strip@prefix\meaning\filename@parse.^^J%
+ }
+\fi
+
+\long\def \IfFileExists#1#2#3{%
+ \openin\@inputcheck#1 %
+ \ifeof\@inputcheck
+ \ifx\input@path\@undefined
+ \def\reserved@a{#3}%
+ \else
+ \def\reserved@a{\@iffileonpath{#1}{#2}{#3}}%
+ \fi
+ \else
+ \closein\@inputcheck
+ \edef\@filef@und{#1 }%
+ \def\reserved@a{#2}%
+ \fi
+ \reserved@a}
+\long\def\@iffileonpath#1{%
+ \let\reserved@a\@secondoftwo
+ \expandafter\@tfor\expandafter\reserved@b\expandafter
+ :\expandafter=\input@path\do{%
+ \openin\@inputcheck\reserved@b#1 %
+ \ifeof\@inputcheck\else
+ \edef\@filef@und{\reserved@b#1 }%
+ \let\reserved@a\@firstoftwo%
+ \closein\@inputcheck
+ \@break@tfor
+ \fi}%
+ \reserved@a}
+\long\def \InputIfFileExists#1#2{%
+ \IfFileExists{#1}%
+ {#2\@addtofilelist{#1}\@@input \@filef@und}}
+
+\chardef\@inputcheck0
+
+\let\@addtofilelist \@gobble
+
+
+\def\@defaultunits{\afterassignment\remove@to@nnil}
+\def\remove@to@nnil#1\@nnil{}
+
+\newdimen\leftmarginv
+\newdimen\leftmarginvi
+
+\newdimen\@ovxx
+\newdimen\@ovyy
+\newdimen\@ovdx
+\newdimen\@ovdy
+\newdimen\@ovro
+\newdimen\@ovri
+\newdimen\@xdim
+\newdimen\@ydim
+\newdimen\@linelen
+\newdimen\@dashdim
+
+
+\long\def\mbox#1{\leavevmode\hbox{#1}}
+
+
+\let\DeclareRobustCommand\newcommand
+\let\@onlypreamble\@gobble
+
+
+\def\AtBeginDocument#1{#1}
+\let\protect\relax
+
+
+\newdimen\fboxsep
+\newdimen\fboxrule
+
+\fboxsep = 3pt
+\fboxrule = .4pt
+
+\def\@height{height} \def\@depth{depth} \def\@width{width}
+\def\@minus{minus}
+\def\@plus{plus}
+\def\hb@xt@{\hbox to}
+
+
+\long\def\@begin@tempboxa#1#2{%
+ \begingroup
+ \setbox\@tempboxa#1{\color@begingroup#2\color@endgroup}%
+ \def\width{\wd\@tempboxa}%
+ \def\height{\ht\@tempboxa}%
+ \def\depth{\dp\@tempboxa}%
+ \let\totalheight\@ovri
+ \totalheight\height
+ \advance\totalheight\depth}
+\let\@end@tempboxa\endgroup
+
+\let\set@color\relax
+\let\color@begingroup\relax
+\let\color@endgroup\relax
+\let\color@setgroup\relax
+\let\normalcolor\relax
+\let\color@hbox\relax
+\let\color@vbox\relax
+\let\color@endbox\relax
+
+% 1996/05/09 \setlength and \strip@pt needed for some
+% \includegraphics options (Thierry Bouche)
+
+\def\setlength#1#2{#1#2\relax}
+
+\begingroup
+ \catcode`P=12
+ \catcode`T=12
+ \lowercase{
+ \def\x{\def\rem@pt##1.##2PT{##1\ifnum##2>\z@.##2\fi}}}
+ \expandafter\endgroup\x
+\def\strip@pt{\expandafter\rem@pt\the}
+
+% 1996/11/13 \AtBeginDvi used in driver files for including headers.
+% \@input added.
+
+
+\def\AtBeginDvi#1{#1}
+
+\def\@input#1{%
+ \IfFileExists{#1}{\@@input\@filef@und}{\message{No file #1.}}}
+
+% 1996/11/21
+\def\@warning{\immediate\write16}
diff --git a/macros/plain/graphics/picture.tex b/macros/plain/graphics/picture.tex
new file mode 100644
index 0000000000..f17a7268ad
--- /dev/null
+++ b/macros/plain/graphics/picture.tex
@@ -0,0 +1,51 @@
+% Plain TeX interface to picture mode.
+% David Carlisle
+
+\input miniltx
+
+\makeatletter
+\let\@@line\line
+\input autopict.sty
+\let\LaTeX@line\line
+\let\line\@@line
+
+
+\newdimen\@wholewidth
+\newdimen\@halfwidth
+\newdimen\unitlength \unitlength =1pt
+\newbox\@picbox
+\newdimen\@picht
+\newcount\@xarg
+\newcount\@yarg
+\newcount\@yyarg
+
+\font\tenln =line10 \font\tenlnw =linew10\relax
+\font\tencirc=lcircle10 \font\tencircw=lcirclew10\relax
+\newcount\@multicnt
+\newdimen\@xdim
+\newdimen\@ydim
+\newbox\@linechar
+\newdimen\@linelen
+\newdimen\@clnwd
+\newdimen\@clnht
+\newdimen\@dashdim
+\newbox\@dashbox
+\newcount\@dashcnt
+\let\@linefnt\tenln
+\let\@circlefnt\tencirc
+\@wholewidth\fontdimen8\tenln
+\@halfwidth .5\@wholewidth
+
+\def\picture#1{%
+ \begingroup
+ \let\line\LaTeX@line
+ \def\end##1{\csname end##1\endcsname}%
+ \pictur@#1}
+
+\let\@@endpicture\endpicture
+\def\endpicture{\@@endpicture\endgroup}
+
+\def\LaTeXbegin{\def\begin##1{\csname##1\endcsname}}
+
+
+\resetatcatcode
diff --git a/macros/plain/graphics/psfrag.tex b/macros/plain/graphics/psfrag.tex
new file mode 100644
index 0000000000..27475c473a
--- /dev/null
+++ b/macros/plain/graphics/psfrag.tex
@@ -0,0 +1,49 @@
+% Plain TeX interface to psfrag.
+% David Carlisle
+
+\input miniltx
+
+\makeatletter
+
+\ifx\@compatibilitytrue\@undefined
+ \csname newif\expandafter\endcsname
+ \csname if@compatibility\endcsname
+\fi
+
+
+\ifx\raisebox\@undefined
+\def\raisebox#1#2{{%
+ \setbox0=\hbox{#2}\def\depth{\dp0}\leavevmode\raise#1\box\z@}}
+\fi
+
+\ifx\@@underline\@undefined
+\let\@@underline\underline
+\def\underline{%
+ \ifmmode\expandafter\@@underline\else\expandafter\underbar\fi}
+\fi
+
+\ifx\sbox\@undefined
+\def\sbox#1{\setbox#1\hbox}
+\fi
+
+
+% psfrag loads the core graphics package, but only the extended
+% graphicx interface is available from plain TeX so just intercept
+% the call and ask for graphicx.
+\let\savedRP\RequirePackage
+\def\RequirePackage#1{%
+ \let\RequirePackage\savedRP
+ \ifx\includegraphics\@undefined
+ \input graphicx\fi\relax}
+\input psfrag.sty
+
+
+
+\ifx\pfg@dp\@undefined
+\csname newdimen\endcsname\pfg@dp
+\csname newdimen\endcsname\pfg@wd
+\csname newdimen\endcsname\pfg@dx
+\csname newdimen\endcsname\pfg@dy
+\fi
+
+\resetatcatcode