Skip to Content.
Sympa Menu

texmacs-users - Re: [TeXmacs] Help on action

Subject: mailing-list for TeXmacs Users

List archive

Re: [TeXmacs] Help on action


Chronological Thread 
  • From: Alvaro Tejero Cantero <address@hidden>
  • To: address@hidden, address@hidden
  • Subject: Re: [TeXmacs] Help on action
  • Date: Thu, 27 Jan 2005 12:13:56 +0100
  • Organization: Ludwig-Maximilian Universität

Hello,

I am still fiddling with it: for the path of the file, I would like to use find-file, since it searches in several directories (i.e. first locally, then a repository of pdf files...). But <find-file|path1|path2|<merge|key|.pdf>> gives me a url like

file:///home/qoptik/Literatur/Simon1994a.pdf

which acroread doesn't like. So my current problem is getting substring to work in order to strip file:// (7 characters) out of find-files' output:

<action|stripme|(display (substring (get-env "var") 7 9))>

TeXmacs complains in the terminal:

<unnamed port>:1:10: In procedure substring in expression (substring
(get-env "var") 2 ...):
<unnamed port>:1:10: Argument 2 out of range: 2


[Afterwards I would substitute '9' with (string-lenght (get-var "var")) or, better (string-length s) if I manage to (let s (get-var "var")), which I don't, in the body of the action, prior to the (system... ) call.]


Thank you very much for your help!



'Alvaro.



Henri Lesourd wrote:


Alvaro Tejero Cantero wrote:

Hello,

I am trying to define a macro so that when I click in a certain text (actually, the key for a bibliographic item) the pdf file gets opened.

For this I am trying to use the following (inside a more complicated macro that will eventually also show the complete BibTeX record for the given key)

<action|text|(system "acroread name_of_the_file")>

does anybody know how can I pass a TeXmacs variable


You mean, a Scheme variable (inside TeXmacs) ? In this latter case, if your
Scheme variable is called 'name-of-the-file', you should write :
<<
<action|text|(system (string-append "acroread " name-of-the-file))>
>>

Or either, if the name of the file is contained in a TeXmacs variable inside the
document (i.e., the kind of variable you set using '<assign|my-variable|value>'),
then you can use (get-env "my-variable") from inside your Scheme code. So
you write :
<<
<action|text|(system (string-append "acroread " (get-env "name-of-the-file")))>
>>

For example, you can cut & paste the following markup in a TeXmacs document :
<<
<assign|var|123>
<action|abcde|(display (string-append "Hello!" (get-env "var")))>
>>

then when you double-click on the blue "abcde" text, you obtain :
<<
Hello!123
>>

on the TeXmacs console.

(containing the name of the file) to the (system ) scheme command?

If I suceed to do it I will publish the utility macro for 'active citations'.


That would be great.






Archive powered by MHonArc 2.6.19.

Top of Page