summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/texfile.cc
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/asymptote/texfile.cc')
-rw-r--r--Build/source/utils/asymptote/texfile.cc30
1 files changed, 17 insertions, 13 deletions
diff --git a/Build/source/utils/asymptote/texfile.cc b/Build/source/utils/asymptote/texfile.cc
index c1e22b9a7cf..9437ab389f3 100644
--- a/Build/source/utils/asymptote/texfile.cc
+++ b/Build/source/utils/asymptote/texfile.cc
@@ -44,7 +44,7 @@ texfile::~texfile()
void texfile::miniprologue()
{
- texpreamble(*out,processData().TeXpreamble,false,true);
+ texpreamble(*out,processData().TeXpreamble,false);
if(settings::latex(texengine)) {
*out << "\\pagestyle{empty}" << newl
<< "\\textheight=2048pt" << newl
@@ -62,11 +62,8 @@ void texfile::prologue()
{
if(inlinetex) {
string prename=buildname(settings::outname(),"pre");
- std::ifstream exists(prename.c_str());
- std::ofstream *outpreamble=
- new std::ofstream(prename.c_str(),std::ios::app);
- bool ASYdefines=!exists;
- texpreamble(*outpreamble,processData().TeXpreamble,ASYdefines,ASYdefines);
+ std::ofstream *outpreamble=new std::ofstream(prename.c_str());
+ texpreamble(*outpreamble,processData().TeXpreamble);
outpreamble->close();
}
@@ -149,15 +146,22 @@ void texfile::beginlayer(const string& psname, bool postscript)
<< "\\includegraphics";
bool pdf=settings::pdf(texengine);
string quote;
- if(stripDir(psname) != psname)
- quote="\"";
+ string name=stripExt(psname);
+ if(inlinetex) {
+ size_t pos=name.rfind("-");
+ if(pos < string::npos) name="\\ASYprefix\\jobname"+name.substr(pos);
+ } else {
+ name=pdf ? stripExt(psname) : psname;
+ if(stripDir(name) != name)
+ quote="\"";
+ }
- if(!pdf)
+ if(pdf) *out << "{" << quote << name << quote << ".pdf}%" << newl;
+ else {
*out << "[bb=" << box.left << " " << box.bottom << " "
- << box.right << " " << box.top << "]";
- if(pdf) *out << "{" << quote << stripExt(psname) << quote << ".pdf}%"
- << newl;
- else *out << "{" << quote << psname << quote << "}%" << newl;
+ << box.right << " " << box.top << "]"
+ << "{" << quote << name << quote << "}%" << newl;
+ }
*out << "}%" << newl;
}
if(!inlinetex)