Re: Including graphics in MP

ALFREDO DE JESUS NAVARRO ROBLES <[email protected]> Thu, 18 May 2023 13:41:36 +0000
Newsgroups gmane.comp.tex.metapost
Message-ID <PA4PR01MB8876614B4DC54BD9BEA653B0B37F9@PA4PR01MB8876.eurprd01.prod.exchangelabs.com>
--===============5270798383356724498==
Content-Language: es-ES
Content-Type: multipart/alternative;
	boundary="_000_PA4PR01MB8876614B4DC54BD9BEA653B0B37F9PA4PR01MB8876eurp_"

--_000_PA4PR01MB8876614B4DC54BD9BEA653B0B37F9PA4PR01MB8876eurp_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

Perhaps it is this what you are looking for?

https://www.ctan.org/pkg/exteps
exteps =96 Include EPS figures in METAPOST

Exteps is a module for including external EPS figures into METAPOST figures=
. It is written entirely in METAPOST, and does not therefore require any po=
st processing of the METAPOST output.

________________________________
De: metapost <[email protected]> en nombre de Lauren=
[email protected] <[email protected]>
Enviado: jueves, 18 de mayo de 2023 10:31
Para: [email protected] <[email protected]>
Asunto: [metapost] Including graphics in MP

Hello,

Is it possible to include PostScript graphics, or literal PostScript in gen=
eral, in MP files?
The purpose is to composite multiple images with correct alignment.
It's possible to do this in TeX (see below), but it would be nice to be abl=
e to do this directly in MP.

I've determined that this doesn't work:

%prologues :=3D 3;
%outputtemplate :=3D "%j_%c.ps";

outputformat:=3D"png";
outputformatoptions:=3D"format=3Drgb antialias=3Dnone";
outputtemplate :=3D "%j_%c.png";

verbatimtex \input epsf etex;

path q[];

beginfig(1);
  q0 =3D (unitsquare scaled 2cm) shifted (-1cm, -1cm);
  draw q0 withpen pencircle scaled .333mm;
  label(btex \vbox{\hbox{\epsffile{testdot1.eps}}} etex, origin);
endfig;
end;

It fails silently and the resulting PNG file is just a white square (see at=
tachment).  It doesn't work with EPS output, either.

It does work to do this in TeX:

\input epsf
\parindent=3D0pt
\parskip=3D0pt
\baselineskip=3D0pt
\advance\hoffset by -1in
\advance\voffset by -1in
\nopagenumbers
\def\epsfsize#1#2{#1}

\vbox to 0pt{\vskip2cm\hbox to 0pt{\hskip1cm
\epsffile{testdot1.eps}\hss}\vss}
\vbox to 0pt{\vskip2cm
\hbox to 0pt{\hskip1cm\epsffile{testdot2.eps}\hss}\vss}
\vfil\eject
\bye

The result is in `testinclude.pdf' (attached).

Any help would be much appreciated.

Laurence Finston






--_000_PA4PR01MB8876614B4DC54BD9BEA653B0B37F9PA4PR01MB8876eurp_
Content-Type: text/html; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
252">
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0);" class=3D"elementToProof">
Perhaps it is this what you are looking for?</div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0);" class=3D"elementToProof">
<br>
</div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0);" class=3D"elementToProof ContentPasted1">
<a href=3D"https://www.ctan.org/pkg/exteps" id=3D"LPlnk793570">https://www.=
ctan.org/pkg/exteps</a><br>
</div>
<div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0);" class=3D"elementToProof">
<h1 lang=3D"none" style=3D"margin-bottom: 0.4em; margin-top: 0.7em; padding=
: 0.2em 0px; font-size: 28px; line-height: 33.6px; border-radius: 6pt 6pt 0=
px 0px; font-family: Helvetica, Arial, Verdana, sans-serif; color: rgb(66, =
66, 133); background-color: rgb(255, 255, 255);" class=3D"ContentPasted0">
exteps =96 Include EPS figures in<span class=3D"ContentPasted0">&nbsp;</spa=
n><span class=3D"mflogo ContentPasted0" style=3D"font-family:MFLogo, sans-s=
erif;font-size:25.2px">METAPOST</span></h1>
<div class=3D"left" style=3D"margin-top: 1em; max-width: 65em; min-width: 1=
5em; float: left; font-family: Helvetica, Arial, Verdana, sans-serif; font-=
size: medium; background-color: rgb(255, 255, 255);">
<p style=3D"margin-bottom:0.4em;margin-top:0.3em" class=3D"ContentPasted0">=
</p>
<p style=3D"margin-bottom:0.4em;margin-top:0.3em" class=3D"ContentPasted0">=
Exteps is a module for including external EPS figures into<span class=3D"Co=
ntentPasted0">&nbsp;</span><span class=3D"mflogo ContentPasted0" style=3D"f=
ont-family:MFLogo, sans-serif;font-size:14.4px">METAPOST</span><span class=
=3D"ContentPasted0">&nbsp;</span>figures.
 It is written entirely in<span class=3D"ContentPasted0">&nbsp;</span><span=
 class=3D"mflogo ContentPasted0" style=3D"font-family:MFLogo, sans-serif;fo=
nt-size:14.4px">METAPOST</span>, and does not therefore require any post pr=
ocessing of the<span class=3D"ContentPasted0">&nbsp;</span><span class=3D"m=
flogo ContentPasted0" style=3D"font-family:MFLogo, sans-serif;font-size:14.=
4px">METAPOST</span><span class=3D"ContentPasted0">&nbsp;</span>output.</p>
</div>
<br>
</div>
<div id=3D"appendonsend"></div>
<hr style=3D"display:inline-block;width:98%" tabindex=3D"-1">
<div id=3D"divRplyFwdMsg" dir=3D"ltr"><font face=3D"Calibri, sans-serif" st=
yle=3D"font-size:11pt" color=3D"#000000"><b>De:</b> metapost &lt;metapost-b=
[email protected]&gt; en nombre de [email protected] &l=
t;[email protected]&gt;<br>
<b>Enviado:</b> jueves, 18 de mayo de 2023 10:31<br>
<b>Para:</b> [email protected] &lt;[email protected]&gt;<br>
<b>Asunto:</b> [metapost] Including graphics in MP</font>
<div>&nbsp;</div>
</div>
<div class=3D"BodyFragment"><font size=3D"2"><span style=3D"font-size:11pt;=
">
<div class=3D"PlainText">Hello,<br>
<br>
Is it possible to include PostScript graphics, or literal PostScript in gen=
eral, in MP files?<br>
The purpose is to composite multiple images with correct alignment.<br>
It's possible to do this in TeX (see below), but it would be nice to be abl=
e to do this directly in MP.<br>
<br>
I've determined that this doesn't work:<br>
<br>
%prologues :=3D 3;<br>
%outputtemplate :=3D &quot;%j_%c.ps&quot;;<br>
<br>
outputformat:=3D&quot;png&quot;;<br>
outputformatoptions:=3D&quot;format=3Drgb antialias=3Dnone&quot;;<br>
outputtemplate :=3D &quot;%j_%c.png&quot;;<br>
<br>
verbatimtex \input epsf etex;<br>
<br>
path q[];<br>
<br>
beginfig(1);<br>
&nbsp; q0 =3D (unitsquare scaled 2cm) shifted (-1cm, -1cm);<br>
&nbsp; draw q0 withpen pencircle scaled .333mm;<br>
&nbsp; label(btex \vbox{\hbox{\epsffile{testdot1.eps}}} etex, origin);<br>
endfig;<br>
end;<br>
<br>
It fails silently and the resulting PNG file is just a white square (see at=
tachment).&nbsp; It doesn't work with EPS output, either.<br>
<br>
It does work to do this in TeX:<br>
<br>
\input epsf<br>
\parindent=3D0pt<br>
\parskip=3D0pt<br>
\baselineskip=3D0pt<br>
\advance\hoffset by -1in<br>
\advance\voffset by -1in<br>
\nopagenumbers<br>
\def\epsfsize#1#2{#1}<br>
<br>
\vbox to 0pt{\vskip2cm\hbox to 0pt{\hskip1cm<br>
\epsffile{testdot1.eps}\hss}\vss}<br>
\vbox to 0pt{\vskip2cm<br>
\hbox to 0pt{\hskip1cm\epsffile{testdot2.eps}\hss}\vss}<br>
\vfil\eject<br>
\bye<br>
<br>
The result is in `testinclude.pdf' (attached).<br>
<br>
Any help would be much appreciated.<br>
<br>
Laurence Finston<br>
<br>
<br>
<br>
<br>
<br>
</div>
</span></font></div>
</body>
</html>

--_000_PA4PR01MB8876614B4DC54BD9BEA653B0B37F9PA4PR01MB8876eurp_--

--===============5270798383356724498==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

--
http://tug.org/metapost/

--===============5270798383356724498==--