<div dir="ltr">Ok, I've just released Asymptote 2.35 to work around this ghostscript eps2write bug.<div>Under MSWindows 7, I noticed an eps2write I/O warning with xelatex and ghostscript 9.15</div><div>but this went away when I upgraded to ghostscript 9.16.</div><div><br></div><div>I would recommend recompiling asy on all platforms to support XeLaTeX and ConTeXt users.</div><div><br></div><div>-- John<br><div><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">John Bowman</b> <span dir="ltr"><<a href="mailto:bowman@ualberta.ca" target="_blank">bowman@ualberta.ca</a>></span><br>Date: Tue, May 19, 2015 at 4:21 PM<br>Subject: Re: Compatibility with ConTeXt was broken in asy 2.33<br>To: Mojca Miklavec <<a href="mailto:mojca.miklavec.lists@gmail.com" target="_blank">mojca.miklavec.lists@gmail.com</a>><br><br><br><div dir="ltr">Hi Mojca,<div>Ok, the work around is implemented in svn r5717. I will release this as asy 2.35.</div><div>I've also updated the asy installation instructions under MacOS, referring to MacPorts.</div><div>It's good to see that  you are the maintainer. :-)</div><div><br></div><div>Regards,</div><div><br></div><div>-- John</div><div><br></div><div><div>Index: <a href="http://runlabel.in" target="_blank">runlabel.in</a></div><div>===================================================================</div><div>--- <a href="http://runlabel.in" target="_blank">runlabel.in</a> (revision 5716)</div><div>+++ <a href="http://runlabel.in" target="_blank">runlabel.in</a> (revision 5717)</div><div>@@ -293,6 +293,8 @@</div><div>   int status=opentex(texname,prefix,!xe);</div><div>   </div><div>   string pdfname,pdfname2,psname2;</div><div>+  bool keep=getSetting<bool>("keep");</div><div>+  </div><div>   if(!status) {</div><div>     if(xe) {</div><div>       pdfname=auxname(prefix,"pdf");</div><div>@@ -324,12 +326,20 @@</div><div>         cmd.push_back("-dBATCH");</div><div>         if(safe) cmd.push_back("-dSAFER");</div><div>         cmd.push_back("-sDEVICE=eps2write");</div><div>-        cmd.push_back("-sOutputFile="+psname2);</div><div>+        // Work around eps2write bug that forces all postscript to first page.</div><div>+        cmd.push_back("-sOutputFile="+psname2+"%d");</div><div>         cmd.push_back(pdfname2);</div><div>         status=System(cmd,0,true,"gs");</div><div>       </div><div>-        std::ifstream in(psname2.c_str(),std::ios::binary);</div><div>-        ps << in.rdbuf();</div><div>+        for(unsigned int i=1; i <= n ; ++i) {</div><div>+          ostringstream buf;</div><div>+          buf << psname2.c_str() << i;</div><div>+          const char *name=buf.str().c_str();</div><div>+          std::ifstream in(name,std::ios::binary);</div><div>+          ps << in.rdbuf();</div><div>+          ps << "(>\n) print flush\n";</div><div>+          if(!keep) unlink(name);</div><div>+        }</div><div>         ps.close();</div><div>       }</div><div>     } else {</div><div>@@ -350,7 +360,6 @@</div><div>   if(status != 0)</div><div>     error("texpath failed");</div><div>     </div><div>-  bool keep=getSetting<bool>("keep");</div><div>   if(!keep) { // Delete temporary files.</div><div>     unlink(texname.c_str());</div><div>     if(!getSetting<bool>("keepaux"))</div><div>@@ -359,12 +368,12 @@</div><div>     if(xe) {</div><div>       unlink(pdfname.c_str());</div><div>       unlink(pdfname2.c_str());</div><div>-      unlink(psname2.c_str());</div><div>     } else</div><div>       unlink(dviname.c_str());</div><div>     if(settings::context(texengine)) {</div><div>       unlink(auxname(prefix,"top").c_str());</div><div>       unlink(auxname(prefix,"tua").c_str());</div><div>+      unlink(auxname(prefix,"tuc").c_str());</div><div>       unlink(auxname(prefix,"tui").c_str());</div><div>     }</div><div>   }</div></div><div><br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 19, 2015 at 5:29 AM, John Bowman <span dir="ltr"><<a href="mailto:bowman@ualberta.ca" target="_blank">bowman@ualberta.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Mojca,<div>Thanks for reporting this issue, which I tracked down to a bug in the new Ghostscript eps2write driver that causes all multipage output to appear on page 1. This effects both the xelatex and context texengines in Asymptote.</div><div><br></div><div>A workaround seems to be to force each page to go to a separate file (using %d in the filename). I should have a fix implemented later today.</div><div><br></div><div>Attached is a minimal example. Each label belongs to a separate page. The generated file gsbug__.pdf is correct but gsbug__.ps, produced by</div><div><br></div><div><div>gs -q -dNOCACHE -dNOPAUSE -dBATCH -dSAFER -sDEVICE=eps2write -sOutputFile=gsbug__.ps gsbug__.pdf</div></div><div><br></div><div>contains 2 pages but all of the postscript now appears only on page 1.</div><div><br></div><div>This needs to be reported to the ghostscript maintainers, but in the meantime we need a workaround since ghostscript 9.15 and 9.16 are now widely in use.</div><span><font color="#888888"><div><br></div><div>-- John</div><div><br></div><div><br></div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 19, 2015 at 12:36 AM, Mojca Miklavec <span dir="ltr"><<a href="mailto:mojca.miklavec.lists@gmail.com" target="_blank">mojca.miklavec.lists@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear John,<br>
<span><br>
On Mon, May 18, 2015 at 10:06 PM, John Bowman wrote:<br>
> Hi Mojca,<br>
><br>
> The change to support rendered 3D context images is easy. In adding support<br>
> for eps2write,<br>
> I didn't worry about supporting 3D context labels since context doesn't<br>
> support vector 3D graphics anyway (it doesn't support embedded PRC content).<br>
<br>
</span>ConTeXt supports PRC by now (or at least I think it does), but we<br>
won't have time to add support for it in time for TL 2015 anyway, so<br>
true, no need to worry about true 3D.<br>
<span><br>
> But as I believe you are pointing out, some context users may be happy just<br>
> to have a rendered preview image.<br>
<br>
</span>Actually this is all that is needed for printed materials.<br>
<br>
In all honesty I could have certainly used another engine, but I'm<br>
more comfortable and familiar doing the font setup in ConTeXt.<br>
<span><br>
> The patch below (snv r5715) tells asy to<br>
> treat context just like xe (these are special cases because they do not<br>
> provide dvi output). I tested this with the context from TL 2014 and it<br>
> seems to work as desired.<br>
<br>
</span>Yes, it works better now, but some things still break. I will send the<br>
source code and some logs off-list.<br>
<br>
In short:<br>
<br>
[context runs succesfully]<br>
system          | total runtime: 1.508 seconds<br>
gs -q -dNOCACHE -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite<br>
-sOutputFile=cylinder__.pdf cylinder_.pdf<br>
gs -q -dNOCACHE -dNOPAUSE -dBATCH -dSAFER -sDEVICE=eps2write<br>
-sOutputFile=cylinder__.ps cylinder__.pdf<br>
gs -q -dBATCH -P -dSAFER -sDEVICE=eps2write -sOutputFile=/dev/null cylinder_.ps<br>
M 0.00146484 -0.000244141L -35.6001 -0.000244141L ...<br>
[really looooooong list of coordinates in a single line]<br>
... -17.0898 148.609 -14.0703 150.828 -13.1211 151.703cM -17.0898 148.609<br>
/opt/local/share/asymptote/plain_Label.asy: 670.23: reading array of<br>
length 1 with out-of-bounds index 1<br>
<span><font color="#888888"><br>
Mojca<br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></div><br></div></div></div>