From aeecf951b2d292ab5afce830bc1b85bf7ea22e0b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 20 May 2015 17:51:10 +0000 Subject: asy 2.35 sources git-svn-id: svn://tug.org/texlive/trunk@37458 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/utils/asymptote/runlabel.in | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'Build/source/utils/asymptote/runlabel.in') diff --git a/Build/source/utils/asymptote/runlabel.in b/Build/source/utils/asymptote/runlabel.in index b4595741251..3b1d5f360cc 100644 --- a/Build/source/utils/asymptote/runlabel.in +++ b/Build/source/utils/asymptote/runlabel.in @@ -259,7 +259,7 @@ patharray2 *_texpath(stringarray *s, penarray *p) string dviname=auxname(prefix,"dvi"); bbox b; string texengine=getSetting("tex"); - bool xe=settings::xe(texengine); + bool xe=settings::xe(texengine) || settings::context(texengine); texfile tex(texname,b,true); tex.miniprologue(); @@ -293,6 +293,8 @@ patharray2 *_texpath(stringarray *s, penarray *p) int status=opentex(texname,prefix,!xe); string pdfname,pdfname2,psname2; + bool keep=getSetting("keep"); + if(!status) { if(xe) { pdfname=auxname(prefix,"pdf"); @@ -324,12 +326,20 @@ patharray2 *_texpath(stringarray *s, penarray *p) cmd.push_back("-dBATCH"); if(safe) cmd.push_back("-dSAFER"); cmd.push_back("-sDEVICE=eps2write"); - cmd.push_back("-sOutputFile="+psname2); + // Work around eps2write bug that forces all postscript to first page. + cmd.push_back("-sOutputFile="+psname2+"%d"); cmd.push_back(pdfname2); status=System(cmd,0,true,"gs"); - std::ifstream in(psname2.c_str(),std::ios::binary); - ps << in.rdbuf(); + for(unsigned int i=1; i <= n ; ++i) { + ostringstream buf; + buf << psname2.c_str() << i; + const char *name=buf.str().c_str(); + std::ifstream in(name,std::ios::binary); + ps << in.rdbuf(); + ps << "(>\n) print flush\n"; + if(!keep) unlink(name); + } ps.close(); } } else { @@ -350,7 +360,6 @@ patharray2 *_texpath(stringarray *s, penarray *p) if(status != 0) error("texpath failed"); - bool keep=getSetting("keep"); if(!keep) { // Delete temporary files. unlink(texname.c_str()); if(!getSetting("keepaux")) @@ -359,12 +368,12 @@ patharray2 *_texpath(stringarray *s, penarray *p) if(xe) { unlink(pdfname.c_str()); unlink(pdfname2.c_str()); - unlink(psname2.c_str()); } else unlink(dviname.c_str()); if(settings::context(texengine)) { unlink(auxname(prefix,"top").c_str()); unlink(auxname(prefix,"tua").c_str()); + unlink(auxname(prefix,"tuc").c_str()); unlink(auxname(prefix,"tui").c_str()); } } -- cgit v1.2.3