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: Thu, 16 Sep 2021 15:19:05 +0000


On 16.09.21 17:10, vincent douce wrote:
hi Giovanni
i am interested
du you mean that if i copy paste this code in my-init, then when inserting an
image, the width by default, instead of being 1par may be what i want, say
5cm width ?
that would be very very convenient
would it work for each type of inserted image (copypasted image, linked
image…)
Vincent

Not yet :-) THis is designed for images that are generated through executable fold environments, like in

https://texmacs.github.io/notes/docs/embedding-tikz-figures-short.html.

It works on a tree (TeXmacs syntax unit) that contains an image, and it has to be executed with its keyboard shortcut. I do not yet know how to execute it automatically.

For all other images, I have to work on that, and maybe for inserting images the solution is different.

Pls. give me some time to think---if I find a general solution for changing the default width of images, I will post it.

Giovanni




Le 16 sept. 2021 à 13:24, Giovanni Piredda <address@hidden> a écrit :

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