Skip to Content.
Sympa Menu

texmacs-users - Re: How to set default width for images?

Subject: mailing-list for TeXmacs Users

List archive

Re: How to set default width for images?


Chronological Thread 
  • From: Giovanni Piredda <address@hidden>
  • To: address@hidden
  • Subject: Re: How to set default width for images?
  • Date: Sat, 18 Sep 2021 11:56:04 +0000


On 16.09.21 13:24, Giovanni Piredda wrote:
In the GitHub repository I found the default image width (0.618par) only in src/Data/Convert/Generic/input.cpp, it is possible that it is only coded in there; I did not try to figure out how the code works and whether it is possible to modify the default width without recompiling TeXmacs.

I wrote a few functions ...

I have made a step forward: the function that executes the executable fold is alternate-toggle

The following still does not work

(kbd-map ("C-i"
          (begin (alternate-toggle (cursor-tree))
                 (let ((t (find-image (cursor-tree))))
                   (set-image-size t)))))

because immediately after toggling the tree is not yet the output but

<tree <script-busy>>

(the red "Busy ..." notice).

Perhaps checking if the tree has the script-label output in a loop till it has could be the way to write the function, but I have not been able to make it work yet. I have tried with

(define (image-set-default-size)
  (if (equal? (tree-label (cursor-tree)) 'script-busy)
      (begin (usleep 250000)
             (image-set-default-size))
      (let ((t (find-image (cursor-tree))))
                   (set-image-size t))))

but TeXmacs hangs.

Of course when one succeeds one can improve the function by making it behave well if the script never stops. Again, I have yet to make the function conditional on being in a script and conditional on the script output being an image :-)

G.

P.S. Following messages from Joris in the past, I will post on TeXmacs-devs if I have developments on this (with a link to the thread here)





Archive powered by MHonArc 2.6.19.

Top of Page