Christian Moe <[email protected]> writes:
>>> David Masterson <[email protected]> writes:
>>>
>>>> Org Need: A new hyperlink that will be treated as HTTP in most export
>>>> cases except when exporting to Latex/PDF. In that case, it would do the
>>>> following:
>>>> + create a temporary directory (if doesn't already exist)
>>>> + wget (or...) the file to the temporary directory
>>>> + change the link to a file: link in the export process
>>>> + remove the temporary directory when done exporting
>
> IIUC, you just need linked image files and pdfs on a remote system to be
> downloaded and inlined as figures in LaTeX/PDF export?
I think that's what I want...
> Org can already do this for remote image files with normal https links.
> By default, however, it only inlines local PDFs linked by =file:= links.
> But this behavior can be changed by customizing
> `org-latex-inline-image-rules' to include PDFs in the "https" group.
>
> #+begin_elisp
> (custom-set-variables
> '(org-latex-inline-image-rules
> '(("file"
> .
> "\\.\\(?:eps\\|jp\\(?:e?g\\)\\|p\\(?:df\\|gf\\|ng\\|s\\)\\|svg\\|tikz\\)\\'")
> ("https"
> .
> "\\.\\(?:eps\\|jp\\(?:e?g\\)\\|p\\(?:df\\|gf\\|ng\\|s\\)\\|svg\\|tikz\\)\\'"))))
> ;; Add PDFs here: ^^^^^
> #+end_elisp
Interesting. A couple of questions:
1. I'm not sure I understand the "Add PDF's here" line. This will
pickup files ending in .pdf, correct? Oh, I see -- that's your new
change.
2. Can I make this apply to links to specific systems only?
> With this enabled, I can export a PDF with another PDF inlined as a
> figure simply by adding a normal https link, just as for image files,
> e.g.:
>
> #+name: fig:understanding-slr
> #+caption: Understanding sea-level change (source: Met Office)
>
> https://www.metoffice.gov.uk/binaries/content/assets/metofficegovuk/pdf/research/climate-science/ukcp/profsea/sea-level-infographic-1.pdf
Cool!
> That raises the question if you even need a special link type or other
> custom code at all...?
True. This does appear to answer my need!
> Of course, with this customization, if you want to give actual links to
> PDFs /without/ inlining them, as one often does, you cannot use the raw
> URL as it will result in an image; you need to add a description to the
> link. So a custom link type makes sense if you want to mix links to PDFs
> and inlined figures of PDFs in the same document.
Ah. Answer to my 2nd question above. Hmm.
> It seems like it should be easy to make a custom link by using the
> existing functionality of `org-latex--inline-image',
> `org-export-link-localise' and `org-export-link--remote-local-copy',
> but I haven't actually found out how to make it work. The
> `org-export-link--remote-local-copy' includes the comment: "TODO work
> this into ol.el as a link parameter, say :download." That might be
> helpful in the future.
Ihor gave me a piece of code awhile for, essentially, setting a variable
based on the backend that was running. I wonder if that might apply...
> Regards,
> Christian
Thanks,
David
> PS. I guess `org-export-link-localise' will need to be renamed with
> "-ize" after the policy clarification on American English.
You say "to-mat-o", I say "to-ma-to". Let's call the whole thing off.
:-)