mailing-list for TeXmacs Users

Text archives Help


Re: create tables from external data


Chronological Thread 
  • From: Joris van der Hoeven <address@hidden>
  • To: address@hidden
  • Subject: Re: create tables from external data
  • Date: Thu, 1 Aug 2002 10:23:58 +0200 (MET DST)


> Hi all, I'm new to this mailing-list.
>
> A few years ago, i hacked latex so that i was able to create tables by
> looking for data in flat files, which was *very* convenient. I don't
> remember the exact details, but the idea was to call a perl script which
> read each line of the flat file, such as
>
> a ; b ; c ; d
>
> and printed out to the standard output
>
> a & b & c & d \\
>
> i.e. what a row looks like in LaTeX.
>
> Now I'd like to achieve the similar result with TeXmacs. That is, to
> call within a macro an external script which prints, in the appropriate
> conditions:
>
> <row|<\cell>a</cell><\cell>b</cell><\cell>c</cell><\cell>d</cell>>\
>
> Is there a way to interact with a program or a shell script like this ?

At the moment, there is not. It would not be very difficult to
add such a feature, and we indeed intend to do so since a while,
but there is one important problem: security.
With actions, the advantage is that you can prompt the user;
this is no longer possible in the case of automatic typesetting.

> Sessions are a way of interacting which is well documented, but this is
> not the same kind of interaction i need here.

I understand...

> I considered using the following operators:
> - hybrid
> - specific
> - action
>
> but they aren't documented so i don't know neither if they are suited,
> nor how i could include them in a macro. Or maybe this is not directly
> possible due to security reasons, but indirectly as an extension,
> which seems to be far from obvious... Anyway this kind of interaction
> would be of the highest interest for many other uses, such as
> collaborative documents
>
> Could you show me a starting point ?

I actually waited for someone to request this feature.
So now it is time for me to implement it...
At a first stage, I will not implement advanced security checks.
In order to use the feature, you will need to select

Edit -> Preferences -> Security -> Accept all scripts

The primitive will be called "extern". It will convert
the arguments to scheme trees and execute the obtained
scheme command. The result will be converted back.
From this, you should be able to do what you want,
using the "system" command and doing the appropriate conversions.
I recommend to use the scheme format for all I/O.
For instance: (row (cell "a") (cell "b") (cell "c") (cell "d))

Good luck (after the release of 1.0.0.12),

<Joris>




Archive powered by MHonArc 2.6.19.

Top of page