Keyboard shortcuts for embedding an image

Hello
I made a keyboard shortcut function that allows you to import texmacs code that is in another file. It works very well.

(delayed
(lazy-keyboard-force)(kbd-map(“A-a” (begin (make-include “/home/biz/Desktop/macro-tabl-multiplication.tm”) (buffer-expand-includes)))))

But I can’t manage to make a similar shortcut that allows to directly incorporate an image in my texmacs document. Here is my test:

(delayed
(lazy-keyboard-force)(kbd-map (“A-i” (make-image “/home/biz/Office/TEXMACS/my-images-texmacs/logo.png”))))))

I tried make-image, link-embedded-image without success.

Thanks for any help you may have.
Thank you for your always interesting answers.

Please try something like this:

(make-inline-image `(,(string->url "/path/to/somefile.pdf") "200pt" "100pt" "100pt" "100pt"))

or make-link-image

Thanks a lot. It works very well. Have a good day.

Good morning,

the scheme make-inline-image instruction works very well under ubuntu (i.e. linux). It allows me to import images that I use often with shortcuts.
But the same instruction doesn’t seem to work on windows.
The link doesn’t seem to work.
Capture%20du%202024-04-21%2019-03-40


You can click on the toolbar icon and import images (it works) but I would like to do the same kind of shortcuts as on Ubuntu.
Is it possible to make make-inline-image work on Windows?
I saw in several discussions that there were file path problems under Windows. They may not be resolved yet.
Thanks for your help.

I saw in several discussions that there were file path problems under Windows. They may not be resolved yet.

In GNU TeXmacs, you should use system->url and url->system to make it work for Windows, Linux and macOS.

And since Mogan v1.2.6 (based on lolly 1.4.x), I’ve changed the semantics of string->url and url->string, your code should work fine on Mogan v1.2.6 (will be released around 2024/05/10).

Currently, string->url is glued to url_unix and system->url is glued to url_system. That’s why string->url does not work on Windows. And it is the root cause why TeXmacs is buggy on Windows.

See https://github.com/XmacsLabs/lolly/commit/3762c8f5157d5336357fda9757082cf19bb48784

And in the C++ part, the implicit conversion from string to url is url_unix before, and I’ve changed the semantics in lolly 1.4.0.

1 Like