aslushnikov / latex-online

Online latex compiler. You give it a link, it gives you PDF
http://latexonline.cc
MIT License
497 stars 89 forks source link

Allow embedding images by URL #7

Closed Itangalo closed 10 years ago

Itangalo commented 10 years ago

I just found this project, and I'm trying it out as a tool for a large collaborative document on GitHub.

The document will need quite a few images, and I'm hesitant to upload them all to GitHub – we don't really need version control on all the images and I don't want to take up too much disk space. Instead I'm thinking of putting images on archive.org.

I'm new to TeX, but there seems to be some ways to embed images by URL, for example:

\externalfigure[https://ia700401.us.archive.org/22/items/dpdpnadw/dpdpnadw_2_3.jpg]

\write18{https://ia700401.us.archive.org/22/items/dpdpnadw/dpdpnadw_2_3.jpg} \includegraphics{dpdpnadw_2_3.jpg}

I can't make either of these methods work through http://latex.aslushnikov.com/, which I guess is because they use libraries which aren't available (and the latter method is probably a security risk as well).

It would be awesome if I could use this script and http://latex.aslushnikov.com/ to embed images by URL. (Unfortunately I don't have the skills to propose any code changes, so I just write a feature request.)

aslushnikov commented 10 years ago

\externalfigure[https://ia700401.us.archive.org/22/items/dpdpnadw/dpdpnadw_2_3.jpg]

As far as I understand, this method is a feature of ConTeXt document processor and is not available in Latex.

\write18{https://ia700401.us.archive.org/22/items/dpdpnadw/dpdpnadw_2_3.jpg} \includegraphics{dpdpnadw_2_3.jpg}

As you noted, \write18 support is risky and thus disabled on http://latex.aslushnikov.com

Could you please describe your user scenario? Do you want to store your sources on http://arxiv.org and to have a public link that compiles that sources into pdf, or do you want to just compile pdf locally?

Itangalo commented 10 years ago

Thanks for the quick feedback!

Do you want to store your sources on http://arxiv.org and to have a public link that compiles that sources into pdf, or do you want to just compile pdf locally?

A public link, if possible. In the ideal scenario, you should always be able to get a snapshot of what the document (actually book) looks like through a public URL on the project page. But I want to avoid taking up GitHub disk space with potentially large (and many) images.

The use case is a math text book for high school, and by placing it on GitHub I want to make it as easy as possible for other math teachers (and students) to comment and improve the book. Most users won't know how to use GitHub or LaTeX, though, so I want to have a direct link to a 'nightly build' of the book that anyone can download.

The alternative right now is that I build the pdf locally and upload to archive.org every week or so, and update the link on the project page.

aslushnikov commented 10 years ago

But I want to avoid taking up GitHub disk space with potentially large (and many) images.

FYI: github can handle pretty big (1Gb) repositories easiliy.

The alternative right now is that I build the pdf locally and upload to archive.org every week or so, and update the link on the project page.

Doesn't arxiv.org recompile PDF on its own every time you update sources?

As far as I'm not familiar with any way to include image by URL in latex document (please, let me know if there are any!), it is going to be hard to support your initial feature-request. The only way to go here might be supporting a compile?url=<...>&resources[]=<...>&resources[]=<..> command, but you'll have to

I'm not sure this solution worth it due to its doubtful convenience for clients. If you absolutely want to stick to github, I would try hosting images inside repository.

Itangalo commented 10 years ago

I did not know that GitHub was so generous on disk space – thanks for the pointer.

With this information in mind, it will be much easier to use images uploaded to GitHub in the LaTeX document. (I guess some users will have problems installing a Git client and push image files to GitHub, which is more difficult than uploading to archive.org, but that's a lesser problem.)

Closing this issue. Thanks for the quick response!