latex picture v plainu

HORAKK at EARN.CVUT.CZ HORAKK at EARN.CVUT.CZ
Tue Nov 21 14:08:39 CET 1995


% Dobry den,
% chcel som puzit dvipaste na vtiahnutie latexovych obrazkov do plainTexu.
% Zial, zda sa, ze z Latexu sa obrazku pomocou dvipaste nedaju exportovat.
% Neexistuje Latexova verzia dvipaste? (Vadi zrejme predefinovana \output
% routina v Latexu.)
%
% Zdravi
%
% Anton Surda

Existuje neco lepsiho (aspon ja s tim mam vzborne zkusenosti):
jsou napsana makra, ktera umoznuji pouzivat podmnozinu latexoveho
prostredi picture v plainu. Puvodni idea byla prave pouziti
dvipaste pro zpracovani napr. vystupu texcadu v plainu. Prikladam
moji soucasnou verzi (neco jsem tusim casem doplnil), puvodnimi
autory snad byli Stepan Kasal, Richard Nemec

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                         %
% This is a PLAINCAD.TEX file                                             %
%                             written by Richard Nemec                    %
%                             (without permission of Leslie L.)           %
%     for using *.PIC files generated by TEXCAD                           %
%     in PLAIN TeX and AMS TeX.                                           %
%                                                                         %
%     Last changes: 11.5.1992      Modified by kh 27.12.1993              %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\let\plainend=\end
\let\plainline=\line
\catcode`\@=11
\let\@warning\message
\newdimen\@wholewidth
\newdimen\@halfwidth
\newdimen\unitlength \unitlength =1pt
\def\setlength#1#2{#1=#2}

\newbox\@picbox
\newdimen\@picht
\newif\if at ignore
\newdimen\@tempdima
\newdimen\@tempdimb
\newcount\@tempcnta
\newcount\@tempcntb
\newbox\@tempboxa
\newcount\@xarg
\newcount\@yarg
\newcount\@yyarg
\newcount\@multicnt
\newdimen\@xdim
\newdimen\@ydim
\newbox\@linechar
\newdimen\@linelen
\newdimen\@clnwd
\newdimen\@clnht
\newdimen\@dashdim
\newbox\@dashbox
\newcount\@dashcnt

\font\tenln=line10
\font\tenlnw=linew10
\font\tencirc=lcircle1
\font\tencircw=lcirclew

\def\thinlines{\let\@linefnt\tenln \let\@circlefnt\tencirc
  \@wholewidth\fontdimen8\tenln \@halfwidth .5\@wholewidth}
\def\thicklines{\let\@linefnt\tenlnw \let\@circlefnt\tencircw
  \@wholewidth\fontdimen8\tenlnw \@halfwidth .5\@wholewidth}

\thinlines

\def\picture(#1,#2){\@ifnextchar({\@picture(#1,#2)}{\@picture(#1,#2)(0,0)}}

\def\@picture(#1,#2)(#3,#4){\@picht #2\unitlength
\setbox\@picbox\hbox to #1\unitlength\bgroup
\hskip -#3\unitlength \lower #4\unitlength \hbox\bgroup\ignorespaces}

\def\endpicture{\egroup\hss\egroup\ht\@picbox\@picht
\dp\@picbox\z@\leavevmode\box\@picbox}


\def\@endparenv{\addpenalty\@endparpenalty\addvspace\@topsepadd\@endpetrue}

\def\@doendpe{\@endpetrue
     \def\par{\@restorepar\everypar{}\par\@endpefalse}\everypar
               {\setbox0=\lastbox\everypar{}\@endpefalse}}

\newif\if at endpe
\@endpefalse

\def\linethickness#1{\@wholewidth #1\relax \@halfwidth .5\@wholewidth}
\def\begin#1{\def\@tempa{\def\@currenvir{#1}%
  \csname #1\endcsname}\begingroup\global\@ignorefalse%
   \let\end=\latexend\let\line=\latexline\@endpefalse\@tempa}
\def\latexend#1{\csname end#1\endcsname%
     \if at endpe\global\let\@gtempa\@doendpe
     \else\global\let\@gtempa\relax\fi
    \endgroup
     \@gtempa
     \if at ignore \global\@ignorefalse
     \ignorespaces\fi}

\def\@ifnextchar#1#2#3{\let\@tempe #1\def\@tempa{#2}\def\@tempb{#3}\futurelet
    \@tempc\@ifnch}
\def\@ifnch{\ifx \@tempc \@sptoken \let\@tempd\@xifnch
      \else \ifx \@tempc \@tempe\let\@tempd\@tempa\else\let\@tempd\@tempb\fi
      \fi \@tempd}

\def\:{\let\@sptoken= } \:  % this makes \@sptoken a space token

\def\:{\@xifnch} \expandafter\def\: {\futurelet\@tempc\@ifnch}

\def\@ifstar#1#2{\@ifnextchar *{\def\@tempa*{#1}\@tempa}{#2}}

\long\def\put(#1,#2)#3{\@killglue\raise#2\unitlength\hbox to \z@{\kern
#1\unitlength #3\hss}\ignorespaces}

\def\@killglue{\unskip\@whiledim \lastskip >\z@\do{\unskip}}

\def\@whilenoop#1{}
\def\@whilenum#1\do #2{\ifnum #1\relax #2\relax\@iwhilenum{#1\relax
     #2\relax}\fi}
\def\@iwhilenum#1{\ifnum #1\let\@nextwhile=\@iwhilenum
         \else\let\@nextwhile=\@whilenoop\fi\@nextwhile{#1}}
\def\@whiledim#1\do #2{\ifdim #1\relax#2\@iwhiledim{#1\relax#2}\fi}
\def\@iwhiledim#1{\ifdim #1\let\@nextwhile=\@iwhiledim
        \else\let\@nextwhile=\@whilenoop\fi\@nextwhile{#1}}

\long\def\makebox(#1,#2)[#3]#4{\vbox to#2\unitlength
   {\let\mb at b\vss \let\mb at l\hss\let\mb at r\hss
    \let\mb at t\vss
    \@tfor\@tempa :=#3\do{\expandafter\let
        \csname mb@\@tempa\endcsname\relax}%
\mb at t\hbox to #1\unitlength{\mb at l #4\mb at r}\mb at b}}

\def\@nnil{\@nil}
\def\@empty{}
\def\@fornoop#1\@@#2#3{}

\def\@tfor#1:=#2\do#3{\xdef\@fortmp{#2}\ifx\@fortmp\@empty \else
    \@tforloop#2\@nil\@nil\@@#1{#3}\fi}
\def\@tforloop#1#2\@@#3#4{\def#3{#1}\ifx #3\@nnil
       \let\@nextwhile=\@fornoop \else
      #4\relax\let\@nextwhile=\@tforloop\fi\@nextwhile#2\@@#3{#4}}

\def\rule{\@ifnextchar[{\@rule}{\@rule[\z@]}}

\def\@height{height}
\def\@depth{depth}
\def\@width{width}

\def\@rule[#1]#2#3{\@tempdima#3\advance\@tempdima #1\leavevmode\hbox{\vrule
  \@width#2 \@height\@tempdima \@depth-#1}}

\long\def\framebox(#1,#2)[#3]#4{\frame{\makebox(#1,#2)[#3]{#4}}}

\long\def\frame#1{\leavevmode
    \hbox{\hskip-\@wholewidth
     \vbox{\vskip-\@wholewidth
            \hrule \@height\@wholewidth
          \hbox{\vrule \@width\@wholewidth #1\vrule \@width\@wholewidth}\hrule
           \@height \@wholewidth\vskip -\@halfwidth}\hskip-\@wholewidth}}

\def\dashbox#1(#2,#3){\leavevmode\hbox to \z@{\baselineskip \z@%
\lineskip \z@%
\@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 at 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 3
\fi
\setbox\@dashbox=\hbox{\vrule \@height \@halfwidth \@depth \@halfwidth
\@width #1\unitlength\hskip #1\unitlength}\@tempcnta=0
\put(0,0){\hskip\@dashdim \@whilenum \@tempcnta <\@dashcnt
\do{\copy\@dashbox\advance\@tempcnta \@ne }}\@tempcnta=0
\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 at 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 3
\fi
\setbox\@dashbox\hbox{\vrule \@width \@wholewidth
\@height #1\unitlength}\@tempcnta0
\put(0,0){\hskip -\@halfwidth \vbox{\@whilenum \@tempcnta < \@dashcnt
\do{\vskip #1\unitlength\copy\@dashbox\advance\@tempcnta \@ne }%
\vskip\@dashdim}}\@tempcnta0
\put(#2,0){\hskip -\@halfwidth \vbox{\@whilenum \@tempcnta< \@dashcnt
\relax\do{\vskip #1\unitlength\copy\@dashbox\advance\@tempcnta \@ne }%
\vskip\@dashdim}}}\makebox(#2,#3)}

\newif\if at negarg

\def\latexline(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax
\@linelen=#3\unitlength
\ifnum\@xarg =0 \@vline
  \else \ifnum\@yarg =0 \@hline \else \@sline\fi
\fi}

\def\@sline{\ifnum\@xarg< 0 \@negargtrue \@xarg -\@xarg \@yyarg -\@yarg
  \else \@negargfalse \@yyarg \@yarg \fi
\ifnum \@yyarg >0 \@tempcnta\@yyarg \else \@tempcnta -\@yyarg \fi
\ifnum\@tempcnta>6 \@badlinearg\@tempcnta0 \fi
\ifnum\@xarg>6 \@badlinearg\@xarg 1 \fi
\setbox\@linechar\hbox{\@linefnt\@getlinechar(\@xarg,\@yyarg)}%
\ifnum \@yarg >0 \let\@upordown\raise \@clnht\z@
   \else\let\@upordown\lower \@clnht \ht\@linechar\fi
\@clnwd=\wd\@linechar
\if at negarg \hskip -\wd\@linechar \def\@tempa{\hskip -2\wd\@linechar}\else
     \let\@tempa\relax \fi
\@whiledim \@clnwd <\@linelen \do
  {\@upordown\@clnht\copy\@linechar
   \@tempa
   \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 at 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
  \else\@upordown\@clnht\copy\@linechar\fi}

\def\@hline{\ifnum \@xarg <0 \hskip -\@linelen \fi
\vrule \@height \@halfwidth \@depth \@halfwidth \@width \@linelen
\ifnum \@xarg <0 \hskip -\@linelen \fi}

\def\@vline{\ifnum \@yarg <0 \@downline \else \@upline\fi}
\def\@upline{\hbox to \z@{\hskip -\@halfwidth \vrule \@width \@wholewidth
   \@height \@linelen \@depth \z@\hss}}
\def\@downline{\hbox to \z@{\hskip -\@halfwidth \vrule \@width \@wholewidth
   \@height \z@ \@depth \@linelen \hss}}

\def\@getlinechar(#1,#2){\@tempcnta#1\relax\multiply\@tempcnta 8
\advance\@tempcnta -9 \ifnum #2>0 \advance\@tempcnta #2\relax\else
\advance\@tempcnta -#2\relax\advance\@tempcnta 64 \fi
\char\@tempcnta}

\def\vector(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax
\@tempcnta \ifnum\@xarg<0 -\@xarg\else\@xarg\fi
\ifnum\@tempcnta<5\relax
\@linelen=#3\unitlength
\ifnum\@xarg =0 \@vvector
  \else \ifnum\@yarg =0 \@hvector \else \@svector\fi
\fi
\else\@badlinearg\fi}

\def\@hvector{\@hline\hbox to 0pt{\@linefnt
   \ifnum \@xarg <0 \@getlarrow(1,0)\hss\else
    \hss\@getrarrow(1,0)\fi}}
\def\@vvector{\ifnum \@yarg <0 \@downvector \else \@upvector \fi}

\def\@svector{\@sline
 \@tempcnta\@yarg \ifnum\@tempcnta <0 \@tempcnta=-\@tempcnta\fi
 \ifnum\@tempcnta <5
  \hskip -\wd\@linechar
  \@upordown\@clnht \hbox{\@linefnt  \if at negarg
  \@getlarrow(\@xarg,\@yyarg) \else \@getrarrow(\@xarg,\@yyarg) \fi}%
 \else\@badlinearg\fi}

\def\@getlarrow(#1,#2){\ifnum #2 =\z@ \@tempcnta='33\else
 \@tempcnta=#1\relax\multiply\@tempcnta \sixt@@n \advance\@tempcnta
 -9 \@tempcntb=#2\relax\multiply\@tempcntb \tw@
 \ifnum \@tempcntb >0 \advance\@tempcnta \@tempcntb\relax
 \else\advance\@tempcnta -\@tempcntb\advance\@tempcnta 64
 \fi\fi\char\@tempcnta}

\def\@getrarrow(#1,#2){\@tempcntb=#2\relax
 \ifnum\@tempcntb < 0 \@tempcntb=-\@tempcntb\relax\fi
 \ifcase \@tempcntb\relax \@tempcnta='55 \or
 \ifnum #1<3 \@tempcnta=#1\relax\multiply\@tempcnta
 24 \advance\@tempcnta -6 \else \ifnum #1=3 \@tempcnta=49
 \else\@tempcnta=58 \fi\fi\or
 \ifnum #1<3 \@tempcnta=#1\relax\multiply\@tempcnta
 24 \advance\@tempcnta -3 \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<0 \advance\@tempcnta 64 \fi
 \char\@tempcnta}

\def\@upvector{\@upline\setbox\@tempboxa\hbox{\@linefnt\char'66}\raise
     \@linelen \hbox to\z@{\lower \ht\@tempboxa\box\@tempboxa\hss}}
\def\@downvector{\@downline\lower \@linelen
      \hbox to \z@{\@linefnt\char'77\hss}}

\def\@badlinearg{}

\newif\if at ovt
\newif\if at ovb
\newif\if at ovl
\newif\if at ovr
\newdimen\@ovxx
\newdimen\@ovyy
\newdimen\@ovdx
\newdimen\@ovdy
\newdimen\@ovro
\newdimen\@ovri

\def\@getcirc#1{\@tempdima #1\relax \advance\@tempdima 2pt\relax
  \@tempcnta\@tempdima
  \@tempdima 4pt\relax \divide\@tempcnta\@tempdima
  \ifnum \@tempcnta > 10\relax \@tempcnta 10\relax\fi
  \ifnum \@tempcnta >\z@ \advance\@tempcnta\m at ne
    \else \@warning{Oval too small}\fi
  \multiply\@tempcnta 4\relax
  \setbox \@tempboxa \hbox{\@circlefnt
  \char \@tempcnta}\@tempdima \wd \@tempboxa}

\def\@put#1#2#3{\raise #2\hbox to \z@{\hskip #1#3\hss}}

\long\def\multiput(#1,#2)(#3,#4)#5#6{\@killglue\@multicnt #5\relax
\@xdim #1\unitlength
\@ydim #2\unitlength
\@whilenum \@multicnt >\z@\do
{\raise\@ydim\hbox to\z@{\kern
\@xdim #6\hss}\advance\@multicnt \m at ne\advance\@xdim
#3\unitlength\advance\@ydim #4\unitlength}\ignorespaces}

\def\oval(#1,#2){\@ifnextchar[{\@oval(#1,#2)}{\@oval(#1,#2)[]}}

\def\@oval(#1,#2)[#3]{\begingroup\boxmaxdepth \maxdimen
  \@ovttrue \@ovbtrue \@ovltrue \@ovrtrue
  \@tfor\@tempa :=#3\do{\csname @ov\@tempa false\endcsname}\@ovxx
  #1\unitlength \@ovyy #2\unitlength
  \@tempdimb \ifdim \@ovyy >\@ovxx \@ovxx\else \@ovyy \fi
  \advance \@tempdimb -2pt\relax  %%%% added 7 Dec 89
  \@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 at ovr \@ovvert32\kern -\@tempdima \fi
  \if at ovl \kern \@ovxx \@ovvert01\kern -\@tempdima \kern -\@ovxx \fi
  \if at ovt \@ovhorz \kern -\@ovxx \fi
  \if at ovb \raise \@ovyy \@ovhorz \fi}\advance\@ovdx\@ovro
  \advance\@ovdy\@ovro \ht\@tempboxa\z@ \dp\@tempboxa\z@
  \@put{-\@ovdx}{-\@ovdy}{\box\@tempboxa}%
  \endgroup}

\def\@ovvert#1#2{\vbox to \@ovyy{%
    \if at ovb \@tempcntb \@tempcnta \advance \@tempcntb by #1\relax
      \kern -\@ovro \hbox{\char \@tempcntb}\nointerlineskip
    \else \kern \@ovri \kern \@ovdy \fi
    \leaders\vrule width \@wholewidth\vfil \nointerlineskip
    \if at ovt \@tempcntb \@tempcnta \advance \@tempcntb by #2\relax
      \hbox{\char \@tempcntb}%
    \else \kern \@ovdy \kern \@ovro \fi}}

\def\@ovhorz{\hbox to \@ovxx{\kern \@ovro
    \if at ovr \else \kern \@ovdx \fi
    \leaders \hrule height \@wholewidth \hss
    \if at ovl \else \kern \@ovdx \fi
    \kern \@ovri}}

\def\circle{\@ifstar{\@dot}{\@circle}}
\def\@circle#1{\begingroup \boxmaxdepth \maxdimen \@tempdimb #1\unitlength
   \ifdim \@tempdimb >15.5pt\relax \@getcirc\@tempdimb
      \@ovro\ht\@tempboxa
     \setbox\@tempboxa\hbox{\@circlefnt
      \advance\@tempcnta\tw@ \char \@tempcnta
      \advance\@tempcnta\m at 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}

\def\@dot#1{\@tempdimb #1\unitlength \@circ\@tempdimb{112}}

\def\@circ#1#2{\@tempdima #1\relax \advance\@tempdima .5pt\relax
   \@tempcnta\@tempdima \@tempdima 1pt\relax
   \divide\@tempcnta\@tempdima
   \ifnum\@tempcnta > 15\relax \@tempcnta 15\relax \fi
   \ifnum \@tempcnta >\z@ \advance\@tempcnta\m at ne\fi
   \advance\@tempcnta #2\relax
   \@circlefnt \char\@tempcnta}

\def\emline#1#2#3#4#5#6{%
       \put(#1,#2){\special{em:moveto}}%
       \put(#4,#5){\special{em:lineto}}}

\def\newpic#1{}

\def\newcount{\alloc at 0\count\countdef\insc at unt}
\def\setcounter#1#2{{\global\csname c@#1\endcsname#2\relax}}


\def\newcounter#1{\@definecounter{#1}}

\def\@definecounter#1{\expandafter\newcount\csname c@#1\endcsname
     \setcounter{#1}0 \expandafter\gdef\csname cl@#1\endcsname{}
     \expandafter\gdef\csname p@#1\endcsname{}\expandafter
     \gdef\csname the#1\endcsname{\arabic{#1}}}

\newcounter{@sc}
\newcounter{@scp}
\newcounter{@t}
\newskip{\@x}
\newskip{\@xa}
\newskip{\@xb}
\newskip{\@y}
\newskip{\@ya}
\newskip{\@yb}
\newbox{\@pt}
\def\bezier#1(#2,#3)(#4,#5)(#6,#7){\c@@sc#1\relax
 \c@@scp\c@@sc \advance\c@@scp\@ne
 \@xb #4\unitlength \advance\@xb -#2\unitlength \multiply\@xb \tw@
 \@xa #6\unitlength \advance\@xa -#2\unitlength
 \advance\@xa -\@xb \divide\@xa\c@@sc
 \@yb #5\unitlength \advance\@yb -#3\unitlength \multiply\@yb \tw@
 \@ya #7\unitlength \advance\@ya -#3\unitlength
 \advance\@ya -\@yb \divide\@ya\c@@sc
 \setbox\@pt\hbox{\vrule height\@halfwidth depth\@halfwidth
 width\@wholewidth}\c@@t\z@
 \put(#2,#3){\@whilenum{\c@@t<\c@@scp}\do
 {\@x\c@@t\@xa \advance\@x\@xb \divide\@x\c@@sc \multiply\@x\c@@t
 \@y\c@@t\@ya \advance\@y\@yb \divide\@y\c@@sc \multiply\@y\c@@t
 \raise \@y \hbox to \z@{\hskip \@x\unhcopy\@pt\hss}\advance\c@@t\@ne}}}

\def\newbox{\alloc at 4\box\chardef\insc at unt}
\def\makebox{\@ifnextchar ({\@makepicbox}{\@ifnextchar
     [{\@makebox}{\mbox}}}

\def\mbox#1{\leavevmode\hbox{#1}}

\def\@makebox[#1]{\leavevmode\@ifnextchar [{\@imakebox[#1]}{\@imakebox[#1][x]}}

\long\def\@imakebox[#1][#2]#3{\hbox to#1{\let\mb at l\hss
\let\mb at r\hss \expandafter\let\csname mb@#2\endcsname\relax
\mb at l #3\mb at r}}

\def\@makepicbox(#1,#2){\leavevmode\@ifnextchar
   [{\@imakepicbox(#1,#2)}{\@imakepicbox(#1,#2)[]}}

\long\def\@imakepicbox(#1,#2)[#3]#4{\vbox to#2\unitlength
   {\let\mb at b\vss \let\mb at l\hss\let\mb at r\hss
    \let\mb at t\vss
    \@tfor\@tempa :=#3\do{\expandafter\let
        \csname mb@\@tempa\endcsname\relax}%
\mb at t\hbox to #1\unitlength{\mb at l #4\mb at r}\mb at b}}

\def\newsavebox#1{{\newbox#1}}

\def\savebox#1{\@ifnextchar ({\@savepicbox#1}{\@ifnextchar
     [{\@savebox#1}{\sbox#1}}}

\def\sbox#1#2{\setbox#1\hbox{#2}}

\def\@savebox#1[#2]{\@ifnextchar [{\@isavebox#1[#2]}{\@isavebox#1[#2][x]}}

\long\def\@isavebox#1[#2][#3]#4{\setbox#1 \hbox{\@imakebox[#2][#3]{#4}}}

\def\@savepicbox#1(#2,#3){\@ifnextchar
   [{\@isavepicbox#1(#2,#3)}{\@isavepicbox#1(#2,#3)[]}}

\long\def\@isavepicbox#1(#2,#3)[#4]#5{\setbox#1 \hbox{\@imakepicbox
     (#2,#3)[#4]{#5}}}

\def\usebox#1{\leavevmode\copy #1\relax}

\def\addtocounter#1#2{%
        {\global\advance\csname c@#1\endcsname #2\relax}}
\def\value#1{\csname c@#1\endcsname}

\catcode`\@=12



More information about the csTeX mailing list