I have code snippets on my github account and I'd like to import the code from them directly into my LaTeX document via something like:
Is this possible? I've searched everywhere but cannot find this.
LaTeX itself has no download or any other Internet functionality, so you can't import website etc. directly. You can however download the text and import it using
In theory it would be possible to write an import macro which does this all for you, i.e. downloads the source code and includes it correctly, but I don't think someone programmed it yet. This would require to call external software from within LaTeX, which is only possible when the
As Joseph mentioned, it's easy with ConTeXt. The macro
Since you want to print external text, you can make use of the ConTeXt vim module, which has this functionality built in. Use:
This results in a page containing the source of the
Note: URLs are sometimes nasty in TeX. When you run into problems with characters of the wrong catcode, you can use