summaryrefslogtreecommitdiff
path: root/Master/texmf/asymptote/external.asy
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-06-08 01:04:41 +0000
committerKarl Berry <karl@freefriends.org>2009-06-08 01:04:41 +0000
commitefda44c2e2e6bd08bf58ebdfb2f1879cff9e6f37 (patch)
tree105b5092688d84851b40816150f4a5c77df3ed08 /Master/texmf/asymptote/external.asy
parent9e32dd6aee7faf4e59888cfbd7a927d497b563ad (diff)
first commit of asymptote binaries + support
git-svn-id: svn://tug.org/texlive/trunk@13665 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf/asymptote/external.asy')
-rw-r--r--Master/texmf/asymptote/external.asy36
1 files changed, 36 insertions, 0 deletions
diff --git a/Master/texmf/asymptote/external.asy b/Master/texmf/asymptote/external.asy
new file mode 100644
index 00000000000..5573561fc36
--- /dev/null
+++ b/Master/texmf/asymptote/external.asy
@@ -0,0 +1,36 @@
+usepackage("hyperref","setpagesize=false,unicode");
+
+// Embed object to be run in an external window. An image file name can be
+// specified; if not given one will be automatically generated.
+string embed(string name, string options="", real width=0, real height=0,
+ string image="")
+{
+ string options; // Ignore movie15 options.
+ if(image == "") {
+ image=stripdirectory(stripextension(name))+"."+nativeformat();
+ convert(name+"[0]",image,nativeformat());
+
+ if(!settings.keep) {
+ exitfcn currentexitfunction=atexit();
+ void exitfunction() {
+ if(currentexitfunction != null) currentexitfunction();
+ delete(image);
+ }
+ atexit(exitfunction);
+ }
+ }
+ if(width != 0) options += ", width="+(string) (width*pt)+"pt";
+ if(height != 0) options +=", height="+(string) (height*pt)+"pt";
+ return "\href{run:"+name+"}{"+graphic(image,options)+"}";
+}
+
+string hyperlink(string url, string text)
+{
+ return "\href{"+url+"}{"+text+"}";
+}
+
+string link(string url, string text, string options="")
+{
+ return hyperlink("run:"+url,text);
+}
+