mailing-list for TeXmacs Users

Text archives Help


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: Thu, 16 Sep 2021 11:24:33 +0000

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 that change the width once the image has been generated; I have not found out how to execute these functions automatically just after the generation of the image by the executable fold, but maybe either I will or you or someone else will. For the moment, I post here the code, which I have associated to a keyboard shortcut; it works if the cursor is at the right end of the image (so one can use it e.g. immediately after one has generated the image).

One should as well restrict the mode where the shortcut is active, I have not yet done that.

(define (image? t) (tree-is? t 'image))

(define (find-image t)
  (car (tree-search (tree-outer t) image?)))

(define (set-image-size t)
  (tree-set! t 1 (string->tree "0.5par"))) ; set to one's wishes

(kbd-map ("C-w"
          (let ((t (find-image (cursor-tree))))
            (set-image-size t))))


For your second question.

Do you know which command is associated to F10? One way to unfold the executable fold that you want is to place your cursor on its right and press return; pls. see details at https://texmacs.github.io/notes/docs/embedding-tikz-figures-short.html (text starting with "Placing the cursor at the generated figure").

Otherwise let me think :-)

G.

On 15.09.21 16:46, Hammer Functor wrote:
Hi there,

I’m trying to write some documents containing a lot of commutative diagrams,
while the diagram created by tikz with default width looks large. I looked
around to find some methods to define the default size or some function to
modify the tree (like in-graphics? or get-graphical-object) and find nothing.

And possibly another question. How to unfold a specific `executable fold’? To
keep the codes with diagrams, I have to press F10 many times to revert a
former diagram to the code each time when I want to modify them. So is there
any workaround?

Thanks!

Sincerely,
Hammer Hu



Archive powered by MHonArc 2.6.19.

Top of page