Skip to Content.
Sympa Menu

texmacs-users - Re: Creating tables, math and drawings from scheme session

Subject: mailing-list for TeXmacs Users

List archive

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:42:51 +0100

Hi Michael,

TeXmacs internally represents all documents as trees.
The current buffer can be retrieved using

(buffer-tree)

You can next use the routines 'tree-ref' and 'tree-set' to
extract subtrees and modify them. For instance, assume that
you created a document with an empty first line and
that you created a Scheme session just below.
Then the buffer tree will be of the form

(document
""
...your Scheme session...)

You may then do

(tree-set (tree-ref (buffer-tree) 0) `(strong "Hi there!"))

to change the first line into a welcome greeting.

I hope that this helps to get you started.
For more info, see "The Jolly Writer", chapter 14.

Best wishes, --Joris



On Thu, Nov 05, 2020 at 11:38:19PM +0500, Михаил Бахтерев 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