Changes

Jump to navigation Jump to search
212 bytes added ,  18:51, 20 June 2016
m
Add details about interaction=yes (and some other minor edits)
The conversion generates a PDF file with prefix <tt>m_k_i_v_</tt> and a suffix <tt>.pdf</tt> added to the name of the original file. The result is cached, and the conversion is rerun if the timestamp of the original file is newer than that of the converted file.
 
== Interaction ==
 
By default, the interactive elements of the included PDF file are discarded. To enable the interactive elements of the included PDF file, use
<texcode>\externalfigure[filename.pdf][interaction=yes]</texcode>
== Image Directory ==
To search for images in other directories, for example a <tt>./images</tt> subdirectory and <tt>/home/user/images</tt>, use:
<texcode>\setupexternalfigures [directory={images, /home/user/images}]</texcode>
Note: always use forward slashes (`/`) in path names, regardless of operating system.
The default search order is: the current directory, the parent directory, the grand-parent directory, and then the paths specified by the <tt>directory</tt> key. To restrict image search only to the paths specified by the <tt>directory</tt> key, use:
<texcode>\setupexternalfigures [location=global]</texcode>
To restore the default search behavior, use:
<texcode>\setupexternalfigures [location={local,global}]</texcode>
The ConTeXt distribution includes three sample images: <tt>cow.pdf</tt>, <tt>mill.png</tt>, and <tt>hacker.jpg</tt>, that are useful when creating minimum working examples to illustrate a bug on the mailing list. These images are locating in the <tt>TEXMF</tt> directory. To add the <tt>TEXMF</tt> directory to the image search path, use:
<texcode>\setupexternalfigures [location={local,global,default}]</texcode>
The above alternative adds the ''entire'' <tt>TEXMF</tt> directory to the search path, ''including the'' <tt>doc/</tt> ''directory!'' Therefore, one needs to be extremely careful when using this option. In fact, I would advise not using <tt>location=default</tt> except for illustrative minimal working examples.
 
== Remote Images ==
The {{cmd|externalfigure}} command supports reading files from web servers, for example:
<texcode>\externalfigure [http://tug.org/images/logobw.jpg]</texcode>
When a document containing a remote file is compiled for the first time, the remote file is downloaded from the server and stored in the LuaTeX cache directory. This cached file is used during subsequent runs.
<pre>context --directives=schemes.threshold=120 <em>filename</em></pre>
The variable <tt>schemes.threshold</tt> is global, so changing its value affects all other macros like <tt>\input</tt>, <tt>\usemodule</tt>, <tt>\component</tt>, etc. that load remote files.
 
=== HTTP Proxy ===
 
To use an http proxy for fetching images, the http variable ([http://w3.impa.br/~diego/software/luasocket/http.html LuaSocket]) has to be set up as follows:
 
<texcode>
\ctxlua{http = require("socket.http"); http.PROXY = "http://proxy.example.com:3128"}
</texcode>
 
Replace `http://proxy.example.com:3128` with the proxy URL.
 
To disable the proxy again:
 
<texcode>
\ctxlua{http = require("socket.http"); http.PROXY = nil}
</texcode>
 
 
=== HTTPS ===
For self-signed certificates retrieved over HTTPS, the `curl` command requires a flag to retrieve insecure files, which is not enabled by default. Open `tex/texmf-context/tex/context/base/mkiv/data-sch.lua` to find:
<pre>
local command = "curl --insecure --silent --create-dirs --output " .. cachename .. " " .. name
</pre>
 
=== HTTP Proxy ===
 
To use an http proxy for fetching images, the http variable ([http://w3.impa.br/~diego/software/luasocket/http.html LuaSocket]) has to be set up as follows:
 
<texcode>
\ctxlua{http = require("socket.http"); http.PROXY = "http://proxy.example.com:3128"}
</texcode>
 
Replace `http://proxy.example.com:3128` with the proxy URL.
 
To disable the proxy again:
 
<texcode>
\ctxlua{http = require("socket.http"); http.PROXY = nil}
</texcode>
= Transformations =

Navigation menu