diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/mma2ltx/mmatext.sty |
Initial commit
Diffstat (limited to 'graphics/mma2ltx/mmatext.sty')
-rw-r--r-- | graphics/mma2ltx/mmatext.sty | 289 |
1 files changed, 289 insertions, 0 deletions
diff --git a/graphics/mma2ltx/mmatext.sty b/graphics/mma2ltx/mmatext.sty new file mode 100644 index 0000000000..3ffbdb8e60 --- /dev/null +++ b/graphics/mma2ltx/mmatext.sty @@ -0,0 +1,289 @@ +% +% macros for picture produced by "mma2ltx" +% version 1.23 - 21 Jun 1995 +% +% Copyright (C) 1994, 1995 by Giuseppe Ghib\`o (<ghibo@galileo.polito.it>) +% +% ---------------------------------------------------------------------------- +% +\typeout{Document Style `mmatext' - v1.23 (21/6/95) - (C) 1994,1995 by Giuseppe Ghibo`} +% +% +\gdef\mma@prologue{texmma22.pro}% Mathematica v2.2 PostScript prologue file. +% +% +\newdimen\mma@tmpdima +\newdimen\mma@tmpdimb +\newdimen\mma@tmpdimc +\newdimen\mma@tmpdimd +\newbox\mma@tmpbox +% +% +% \mmaheaderprotrue = include the prologue file \mma@prologue (once) using +% the \special{header=...}. +% \mmaheaderprofalse = don't include the prologue file \mma@prologue. +% \mma@proloadedtrue = the prologue \mma@prologue has been already loaded. +% \mma@proloadedfalse = the prologue \mma@prologue has not been loaded. +% \mma@whitebgtrue = the object will have a white background +% \mma@whitebgfalse = the object will have a transparent background +\newif\ifmmaheaderpro \mmaheaderprotrue +\newif\ifmma@proloaded \mma@proloadedfalse +\newif\ifmma@whitebg +% +% +% \@nameedef is similar to the LaTeX command \@namedef, except it uses \edef +% instead of \def. +\def\@nameedef#1{\expandafter\edef\csname #1\endcsname} +% +\let\ccd=\catcode +\ccd`\p=12\ccd`\t=12 +\def\del@dim#1pt{#1}% +\ccd`\p=11\ccd`\t=11 +% +\def\pt@mm{0.3514598}\def\unit@mm{mm}% +\def\pt@cm{0.03514598}\def\unit@cm{cm}% +\def\pt@pt{1}\def\unit@pt{pt}% +\def\pt@bp{0.99626401}\def\unit@bp{bp}% +\def\pt@pc{0.08333333}\def\unit@pc{pc}% +\def\pt@in{0.013837}\def\unit@in{in}% +\def\pt@dd{0.9345719}\def\unit@dd{dd}% +\def\pt@cc{0.07788099}\def\unit@cc{cc}% +\def\pt@dbp{9.9626401}\def\unit@dbp{dbp}% +% +\def\deldim#1{\expandafter\del@dim\the#1}%trash the trailing 'pt' +\def\dimtomac#1#2#3{% +% \dimtomac (expands a dimension register into a macro) +% #1 = a dimension register (e.g., \mydim, \dimen0, ...) +% #2 = conversion factor from pt to a choosed unit or +% one of mm, cm, pt, bp, pc, in, dd, cc, sp, dbp. +% #3 = macro to which assign the converted value. +\lowercase{\edef\convfactor{#2}} +\ifx\convfactor\unit@mm\def\convfactor{\pt@mm}\else +\ifx\convfactor\unit@cm\def\convfactor{\pt@cm}\else +\ifx\convfactor\unit@pt\def\convfactor{\pt@pt}\else +\ifx\convfactor\unit@bp\def\convfactor{\pt@bp}\else +\ifx\convfactor\unit@dbp\def\convfactor{\pt@dbp}\else +\ifx\convfactor\unit@pc\def\convfactor{\pt@pc}\else +\ifx\convfactor\unit@in\def\convfactor{\pt@in}\else +\ifx\convfactor\unit@dd\def\convfactor{\pt@dd}\else +\ifx\convfactor\unit@cc\def\convfactor{\pt@cc}\else +\fi\fi\fi\fi\fi\fi\fi\fi\fi +\mma@tmpdima=#1% +\ifx\convfactor\unit@sp\@nameedef{#3}{\number\mma@tmpdima}\else +\mma@tmpdimb=\convfactor\mma@tmpdima% +\@nameedef{#3}{\deldim\mma@tmpdimb}\fi +}% end of dimtomac definition +% +% +\newdimen\mma@dimunit \mma@dimunit=1bp +\newdimen\mma@llx \newdimen\mma@urx \newdimen\mma@width \newdimen\mma@oldwd +\newdimen\mma@lly \newdimen\mma@ury \newdimen\mma@height \newdimen\mma@oldht +\newdimen\mma@x \newdimen\mma@y +\newdimen\mma@deltax \newdimen\mma@deltay +% +\gdef\mma@wd{161}% default width in bp +\gdef\mma@ht{100}% default height in bp +\gdef\mma@unit{bp}% default unit = bp +\mma@width=\mma@wd bp +\mma@height=\mma@ht bp +\mma@llx=\z@ \mma@urx=\mma@width +\mma@lly=\z@ \mma@ury=\mma@height +\mma@deltax=\z@ \mma@deltay=\z@ +% +% +% ************* +% * * +% * mmasetpic * +% * * +% ************* +\def\mmasetpic(#1,#2){\@ifnextchar({\mma@oldsetpic(#1,#2)}{% +\mma@setpic(#1,#2)}} +% +\def\mma@setpic(#1,#2)[#3]#4{% +% #1 = width of Mathematica PostScript picture +% #2 = height of Mathematica PostScript picture +% #3 = unit of measure +% #4 = PostScript filename +\lowercase{\edef\mma@unit{#3}} +\mma@dimunit=1\mma@unit +\mma@llx=\z@ \mma@urx=#1\mma@dimunit +\mma@lly=\z@ \mma@ury=#2\mma@dimunit +\mma@width=#1\mma@dimunit \mma@height=#2\mma@dimunit +\mma@oldwd=\mma@width \mma@oldht=\mma@height +\dimtomac{\mma@oldwd}{bp}{mma@wd} +\dimtomac{\mma@oldht}{bp}{mma@ht} +\def\mma@psname{#4} +% +% include the prologue file \mma@prologue at most once. +\ifmma@proloaded\else +\ifmmaheaderpro +\@killglue\special{header=texmma22.pro} +\global\mma@proloadedtrue\fi\fi +} +% +% +% *************** +% * * +% * mmatextfits * +% * * +% *************** +\def\mmatextfits(#1,#2)(#3,#4){\@ifnextchar({\mma@textfits(#1,#2)(#3,#4)}{% + \mma@textfits(#1,#2)(#3,#4)(0,0)}} +% +\def\mma@textfits(#1,#2)(#3,#4)(#5,#6)#7{% +% #1 = x coord. +% #2 = y coord. +% #3 = sdx (bounding box x offs., like the Mathematica command "Text") +% #4 = sdx (bounding box y offs., like the Mathematica command "Text") +% #5 = extra offset to the x coord. +% #6 = extra offset to the y coord. +% #7 = text to fit. +\setbox\mma@tmpbox=\hbox{#7} +% +% tmpllx = x - 1/2*wd*(sdx+1) +\mma@tmpdima=#1\mma@dimunit \advance\mma@tmpdima by #5\mma@dimunit +\mma@tmpdimb=#3\wd\mma@tmpbox +\advance\mma@tmpdimb by \wd\mma@tmpbox +\divide\mma@tmpdimb by 2 +\advance\mma@tmpdima by -\mma@tmpdimb +\ifdim\mma@tmpdima < \mma@llx \mma@llx=\mma@tmpdima\fi +% +% tmplly = y - 1/2*(ht+dp)*(sdy+1) +\mma@tmpdima=#2\mma@dimunit \advance\mma@tmpdima by #6\mma@dimunit +\mma@tmpdimb=\ht\mma@tmpbox +\advance\mma@tmpdimb by \dp\mma@tmpbox +\mma@tmpdimb=#4\mma@tmpdimb +\advance\mma@tmpdimb by \ht\mma@tmpbox +\advance\mma@tmpdimb by \dp\mma@tmpbox +\divide\mma@tmpdimb by 2 +\advance\mma@tmpdima by -\mma@tmpdimb +\ifdim\mma@tmpdima < \mma@lly \mma@lly=\mma@tmpdima\fi +% +% tmpurx = x - 1/2*wd*(sdx-1) +\mma@tmpdima=#1\mma@dimunit \advance\mma@tmpdima by #5\mma@dimunit +\mma@tmpdimb=#3\wd\mma@tmpbox +\advance\mma@tmpdimb by -\wd\mma@tmpbox +\divide\mma@tmpdimb by 2 +\advance\mma@tmpdima by -\mma@tmpdimb +\ifdim\mma@tmpdima > \mma@urx \mma@urx=\mma@tmpdima\fi +% +% tmpury = y - 1/2*(ht+dp)*(sdy-1) +\mma@tmpdima=#2\mma@dimunit \advance\mma@tmpdima by #6\mma@dimunit +\mma@tmpdimb=\ht\mma@tmpbox +\advance\mma@tmpdimb by \dp\mma@tmpbox +\mma@tmpdimb=#4\mma@tmpdimb +\advance\mma@tmpdimb by -\ht\mma@tmpbox +\advance\mma@tmpdimb by -\dp\mma@tmpbox +\divide\mma@tmpdimb by 2 +\advance\mma@tmpdima by -\mma@tmpdimb +\ifdim\mma@tmpdima > \mma@ury \mma@ury=\mma@tmpdima\fi +% +% Recalculate new picture size +\mma@width=\mma@urx \advance\mma@width by -\mma@llx +\mma@height=\mma@ury \advance\mma@height by -\mma@lly +\mma@deltax=\mma@width \advance\mma@deltax by -\mma@oldwd +\mma@deltay=\mma@height \advance\mma@deltay by -\mma@oldht +}% end of \mmatextfits definition +% +% +% ************** +% * * +% * mmapicture * +% * * +% ************** +\def\mmapicture{% +\bgroup +\unitlength=1sp% so we can use the command \number +\dimtomac{\mma@width}{\mma@unit}{mma@truewd} +\dimtomac{\mma@height}{\mma@unit}{mma@trueht} +\dimtomac{\mma@deltax}{\mma@unit}{mma@dx} +\dimtomac{\mma@deltay}{\mma@unit}{mma@dy} +\typeout{Mathematica picture:\space'\mma@psname'\space% + size=(\mma@truewd\space x\space\mma@trueht\space\mma@unit)} +\ifdim\mma@deltax > 0pt + \typeout{Mathematica picture:\space'\mma@psname'\space% + deltax=\mma@dx\space\mma@unit} +\fi +\ifdim\mma@deltay > 0pt + \typeout{Mathematica picture:\space'\mma@psname'\space% + deltay=\mma@dy\space\mma@unit} +\fi +\@killglue +\begin{picture}(\number\mma@width,\number\mma@height)(\number\mma@llx,\number\mma@lly) +\put(0,0){\special{psfile=\mma@psname\space hsize=\mma@wd\space vsize=\mma@ht}}} +% +\def\endmmapicture{\end{picture}\egroup} +% +% +% ************** +% * * +% * mmaputtext * +% * * +% ************** +\def\mmaputtext{\@ifstar{\mma@whitebgtrue\mma@puttext}{\mma@whitebgfalse% +\mma@puttext}} + +\def\mma@puttext(#1,#2)(#3,#4){\@ifnextchar({\mma@@puttext(#1,#2)(#3,#4)}{% + \mma@@puttext(#1,#2)(#3,#4)(0,0)}} +% +\def\mma@@puttext(#1,#2)(#3,#4)(#5,#6)#7{% +% #1 = x coord. +% #2 = y coord. +% #3 = sdx (bounding box x offs., like the command "Text" of Mathematica) +% #4 = sdx (bounding box y offs., like the command "Text" of Mathematica) +% #5 = offset to the x coord. +% #6 = offset to the y coord. +% #7 = text (or object) to put. +% +\setbox\mma@tmpbox=\hbox{#7} +\mma@x=#1\mma@dimunit \advance\mma@x by #5\mma@dimunit +\mma@y=#2\mma@dimunit \advance\mma@y by #6\mma@dimunit +% +% xp = x - 1/2 * wd * (sdx + 1) +\mma@tmpdima=#3\wd\mma@tmpbox +\advance\mma@tmpdima by \wd\mma@tmpbox +\divide\mma@tmpdima by 2 +\advance\mma@x by -\mma@tmpdima +% +% yp = y - 1/2*(sdy*htot + ht - dp) +\mma@tmpdima=\ht\mma@tmpbox +\advance\mma@tmpdima by \dp\mma@tmpbox +\mma@tmpdima=#4\mma@tmpdima +\advance\mma@tmpdima by \ht\mma@tmpbox +\advance\mma@tmpdima by -\dp\mma@tmpbox +\divide\mma@tmpdima by 2 +\advance\mma@y by -\mma@tmpdima +% +\mma@tmpdimc=\dp\mma@tmpbox +\ifmma@whitebg +\mma@tmpdimc=\wd\mma@tmpbox +\mma@tmpdimd=\ht\mma@tmpbox \advance\mma@tmpdimd by \dp\mma@tmpbox +\dimtomac{\mma@tmpdimc}{bp}{mma@tmpwd} +\dimtomac{\mma@tmpdimd}{bp}{mma@tmpht} +\advance\mma@y by -\dp\mma@tmpbox% special{psfile=mmawhite.eps...} has zero depth +\put(\number\mma@x,\number\mma@y){\makebox(0,0)[lb]{\special{psfile=mmawhite.eps\space hsize=\mma@tmpwd\space vsize=\mma@tmpht}}} +\advance\mma@y by \dp\mma@tmpbox\fi +\put(\number\mma@x,\number\mma@y){\makebox(0,0)[lb]{\box\mma@tmpbox}} +}% end of \mma@puttext definition +% +% +% For backward compatibility with mma2ltx v1.03 +\def\mmashowunit#1{\gdef\mma@unit{#1}\global\mma@dimunit=1bp} +% +% For backward compatibility with mma2ltx v1.03 +\def\mma@oldsetpic(#1,#2)(#3,#4,#5,#6)#7{% +% #1 = width of Mathematica PostScript picture in bp +% #2 = height of Mathematica PostScript picture in bp +% #3,#4,#5,#6 = transformation matrix (never used). +% #7 = PostScript filename +% +\mma@llx=\z@ \mma@urx=#1\mma@dimunit +\mma@lly=\z@ \mma@ury=#2\mma@dimunit +\mma@width=#1\mma@dimunit \mma@height=#2\mma@dimunit +\mma@oldwd=\mma@width \mma@oldht=\mma@height +\gdef\mma@wd{#1} \gdef\mma@ht{#2} +\gdef\mma@psname{#7} +\ifmma@proloaded\else +\@killglue\special{header=texmma22.pro} +\global\mma@proloadedtrue\fi +}% end of mmaoldsetpic definition |