[texhax] Include online files when compiling

Tom Schneider toms at strawberry.ncifcrf.gov
Thu Nov 6 18:12:45 CET 2003

> > I would like to know if there is any way to include a http file, not just
> > hyperreffing, when compiling for example
> > 
> > \begin{document}
> > \include{http://wordsmith.org/awad/archives/0103}
> > \end{document}
> not until someone integrates the capabilities of the web into their
> file system ... or writes a tex library that decodes the file name
> enough to detect a web address, and also includes a wget-like library
> in their build.
> you may gather that i don't believe it's possible.  yet.
> one might write something based on \write18 that emits a script to
> copy the stuff using wget, then inputs the result -- \httpinput, sort
> of thing.  i'll do that (for use under un*x systems) if i get a free
> moment (i don't know how one would do it under widnoze).

Hey!  This would be easy using atchange!


This is a perl script which watches files and then does whatever you
program it to do.  I use it to automate EVERYTHING including running
latex and bibtex if needed ... (see the descriptions on that page). 
My fingers never leave the keyboard, I only mouse when absolutely
necessary - it saves a lot of effort!

So how to use this tool in this case?

I will assume that write18 can write a fresh file into the
current directory.

Then the simplest thing to do is to have atchange
watch for a trigger file that contains the URL.  Run wget
as you suggested.  You would probably want to rename the wget output
using -O.  The wgetas script does this:


The trouble is that you would have to pause latex while all this
is going on.

Another way to do this would be more straight forward (!) - grep
through the file for 'input{http://', sed away the stuff to get the
url, then wgetas.  Sed the input latex using the url and replace the
url with the file path and name and put it into a temporary file (eg
/tmp/tmp`whoami`.tex).  Then run latex using the temp file.


  Dr. Thomas D. Schneider
  National Cancer Institute
  Laboratory of Experimental and Computational Biology
  Frederick, Maryland  21702-1201
  toms at ncifcrf.gov
  permanent email: toms at alum.mit.edu (use only if first address fails)

More information about the texhax mailing list