texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Texmacs-dev] hlinks using external viewers and macro question


From: texmacs . 5 . pjoyez
Subject: [Texmacs-dev] hlinks using external viewers and macro question
Date: Tue, 11 Sep 2012 09:04:30 +0200
User-agent: Thunderbird 2.0.0.24 (X11/20100411)

Dear all,

I often want to enrich texmacs documents with links to stuff that I cannot (or do not want to) view in texmacs. It can be websites, videos, pdf files... In that case the desired action is to use the default appropriate reader to open that content.

That's actually rather easy to do. Define a scheme function:

(tm-define (ext-viewer dest)
(:secure #t)
(:synopsis "uses system default apps to open a destination")
(:argument dest "string that designates a web url, a file...")
(eval-system*
  (cond
         ((os-macos?) "open ")
         ((os-win32?) "start ")
         (else "xdg-open "))
  dest))

then in the document use for instance:

<action|lemonde|(ext-viewer "http://www.lemonde.fr";)>

<action|musique!|(ext-viewer "'~/my music/my song.mp3'")>

It just works.

Now I'd like to simplify entering such links by defining a macro <hlink2|x|y> that would expand to <action|x|(ext-viewer "y")>. I've tried to play with <extern|> but with not much success... Any idea on how to do that?

Oh, and after that I'd like those hlinks to survive in the pdf output :)

best,
Philippe






reply via email to

[Prev in Thread] Current Thread [Next in Thread]