summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/base/embed.asy
blob: 5695eadab567ad3d7918fd7fe6b6c9ef9bfd47b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
if(latex()) {
  texpreamble("
\ifx\pdfhorigin\undefined%
\usepackage[3D,dvipdfmx]{movie15}
\else%
\usepackage[3D]{movie15}
\fi%
");
  usepackage("hyperref","setpagesize=false,unicode");
}

// See http://www.ctan.org/tex-archive/macros/latex/contrib/movie15/README
// for documentation of the options.

// Embed object in pdf file 
string embed(string name, string options="", real width=0, real height=0)
{
  if(options != "") options="["+options+"]{";
  if(width != 0) options += (string) (width/pt)+"pt"; 
  options += "}{";
  if(height != 0) options += (string) (height/pt)+"pt"; 
  return "\includemovie"+options+"}{"+name+"}";
}

string hyperlink(string url, string text)
{
  return "\href{"+url+"}{"+text+"}";
}

string link(string label, string text, string options="")
{
  // Run LaTeX twice to resolve references.
  settings.twice=true;
  if(options != "") options="["+options+"]";
  return "\movieref"+options+"{"+label+"}{"+text+"}";
}