mailing-list for TeXmacs Users

Text archives Help


Re: Creating tables, math and drawings from scheme session


Chronological Thread 
  • From: TeXmacs <address@hidden>
  • To: address@hidden
  • Subject: Re: Creating tables, math and drawings from scheme session
  • Date: Thu, 5 Nov 2020 23:45:44 +0100

Hi Giovanni,

The 'extern' primitive is useful for letting Scheme do part of the
typesetting.
It is not intended for the modification of documents, so it indeed is not
allowed to insert content into the document while typesetting.

See section 14.4 of "The Jolly Writer" for legit applications
of the 'extern' primitive.

Best wishes, --Joris


On Thu, Nov 05, 2020 at 09:03:02PM +0100, Giovanni Piredda wrote:
> I figured out something else:
>
> <extern|(lambda (x) `(concat "Hallo " ,x))|Piet>
>
> (got from
> https://www.iam.uni-bonn.de/fileadmin/user_upload/gubinelli/texmacs/talk-texmacs-guile-strasbourg-june-2019.pdf)
> works, while
>
> <extern|(lambda (x) (insert x))|Piet>
>
> crashes TeXmacs 1.99.14 on Linux Ubuntu with the error on terminal
>
> double free or corruption (out)
>
> Still the extern procedure might be the way to insert code in the
> document, but I am not able to make it work (maybe one of the
> developers can say something?).
>
> G.
>
> On 05.11.20 20:28, Giovanni Piredda wrote:
> >I never tried with the insert procedure; I did it through a helper
> >macro, calling the Scheme one through the extern primitive. That
> >worked (for tables and for graphics), but - I am guessing - it
> >does not do what you want, that is having the code inserted in the
> >source code of the document (I do not know if I am guessing
> >correctly!); instead, it inserts the typeset output (text or table
> >or graphics) in the document.
> >
> >Despite this, I have an idea, which I have not been able to get to
> >immediately work but maybe is good, I explain myself with a
> >not-yet-working code
> >
> ><assign|insertHere|<\macro|x>
> >    <extern|(lambda (x) '(insert ,x))|<arg|x>>
> >
> >Then use as <insertHere|arg> at the insertion point. In my test it
> >seems to me that TeXmacs does not recognize the argument x of the
> >macro as argument to the Scheme function--but I do not know how to
> >fix that.
> >
> >G.
> >
> >On 05.11.20 19:38, Михаил Бахтерев wrote:
> >>Greetings!
> >>
> >>First of all i would like to thank TeXMacs developers heartily
> >>for the great software.
> >>
> >>My question is following.
> >>
> >>I would like to generate interactively (in notepad manner) some
> >>math, tables and drawings during some not such a big data
> >>analysis. I've managed to generate expression trees and
> >>drawings, for instance, like this
> >>
> >>   (define (frac x)
> >>     (insert `(with "mode" "math" (frac "a" ,x))))
> >>
> >>But i cannot put this structure into the document correctly. As
> >>far, as i understand, insert procedure inserts an object at the
> >>cursor position. But the cursor position is right at the next
> >>Scheme] prompt. So the formulae or the drawing are putted, where
> >>next expression should be entered, not at the document itself,
> >>or at the usual position for the result of expression
> >>evaluation.
> >>
> >>   Scheme] 1
> >>     1 ; i mean here
> >>
> >>Could this behaviour be changed somehow? Is there any way to
> >>place generated construction at the result position (which would
> >>be ideal) or at the document somewhere?
> >>
> >>- Michael Bakhterev, respectfully



Archive powered by MHonArc 2.6.19.

Top of page