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: Fri, 28 Jan 2005 10:35:46 +0100
  • Organization: Ludwig-Maximilian Universität

Hello,

You're right that "var" doesn't get assigned, but the problem is that I do not know how to assign it __inside a macro__ and __before the action__, which is what I need for the "active citation"

Look at the following code (indented for readability):


<assign|bcite|
<macro|x|
<assign|bibfilename|
<find-file|.|/home/qoptik/Literatur|<merge|<arg|x>|.pdf>>>
<action|<arg|x>|
(with s (get-env "bibfilename") (display* "bname=" (substring s 7
(string-length s))))>>>


When clicking in <bcite|Simon1994a> it produces in the terminal:


<unnamed port>:1:52: In procedure substring in expression (substring s 7 ...):
<unnamed port>:1:52: Argument 2 out of range: 7


So bibfilename is not assigned. I remember trying also to put the assign bibfilename statement outside the macro (?) and using a <with|bibfilename|<find-file|...>|<action|x|...>>, but with no results.

Do you know how to assign inside a macro?


Many, many thanks, Alvaro.



Henri Lesourd wrote:


Alvaro Tejero Cantero wrote:

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.]


Most probably, the "var" variable has no value when you do :
<<
<action|stripme|(display (substring (get-env "var") 7 9))>
>>

what output do you obtain if you write :
<<
<action|stripme|(display* "{{" (get-env "var") "}}")>
>>

if you just get :
<<
{{}}
>>

on the console when you double-click the "stripme", then it means that your "var" variable
has not been defined. By the way, the following code :
<<
<assign|var|<find-file|~|.bashrc>>
<action|stripme|(begin (display* "var=" (get-env "var") "\n"))>
<action|stripme2|(with s (get-env "var") (display* "var=" (substring s 7 (string-length s)) "\n"))>
>>

perfectly works, when clicking first on "stripme", next on "stripme2", I obtain :
<<
var=file:///home/henri/.bashrc
var=/home/henri/.bashrc
>>






Archive powered by MHonArc 2.6.19.

Top of Page