Hello All,
Tried to change vector symbol from Alt+Shift v to vv using menu: TOOLS->KEYBOARD->EDIT KEYBOARD SHORTCUTS.
Shortcut: vv
Command: (make-wide “”)
I am getting: ‘vect’ instead of the arrow
Need some help.
Hello All,
Tried to change vector symbol from Alt+Shift v to vv using menu: TOOLS->KEYBOARD->EDIT KEYBOARD SHORTCUTS.
Shortcut: vv
Command: (make-wide “”)
I am getting: ‘vect’ instead of the arrow
Need some help.
Hi @User32 and welcome to the forum.
As far as I know that menu entry does not work well. I never investigated why. I tried now and it failed in a way different from yours (no command has been defined).
You can obtain the keyboard shortcut by inserting a kbd-map form in your personal initialization file my-init-texmacs.scm:
(kbd-map (:mode in-math?) ("v v" (make-wide "<vect>") ))
which needs to be wrapped in commands that make it so that the command is executed after the default keyboard shortcuts are assigned, so it is protected from overwriting:
(delayed
(lazy-keyboard-force)
(kbd-map (:mode in-math?)
("v v" (make-wide "<vect>"))))
Please let me know if you need help with this.
Giovanni
Hello Giovanni,
The problem i’m facing is the fact that Texmacs is installed as an app under Windows 11 therefore the location of the files is readonly. Changed the location and used your example and now it is working.
Thanks for the help.
Keep having trouble defining shortcuts: wanted to assign CTRL+S for an inline formula and tried several ways but i can’t get it to work.
(kbd-map ("C-s" (make 'math))) worked when I executed it in Scheme session.
If you put it in the initialization file, it may need to be inserted inside the delayed form and preceded by (lazy-keyboard-force). I did not test this. Please let me know if this works for you. All the definitions can be put together in a single delayed form.
In the Windows look and feel, the keyboard shortcut C-s opens the save file dialogue, so you might want to coordinate your shortcuts with the default shortcuts for common actions.
Works nicely, thanks. I put it in init-texmacs.scm. I would like to know the syntax of these shorcuts to create more . Is there a place where the syntax and working of these commands is explained?
There is the TeXmacs manual, at https://www.texmacs.org/tmweb/documents/manuals/texmacs-manual.en.pdf, which one can complement with the Scheme developer manual, at https://www.texmacs.org/tmweb/documents/manuals/texmacs-scheme.en.pdf, but I don’t think even the combination of the two is pedagogical.
It took me a lot of time to learn how to write the simple things I write, but I haven’t been orderly in my learning.
Please let me think, maybe I will find some documents that help you more. Having a little bit of experience with Scheme helps.
Hello Giovanni,
In my effort to understand things, i tried the following:
(delayed
(lazy-keyboard-force)
(kbd-map (“C-s” (make 'math)))
(kbd-map (“C-u” (make-script #t #t)))
(kbd-map (“C-l” (make-script #f #t)))
(kbd-map (:mode in-math?) (“v v” (make-wide “”))))
(delayed
(lazy-keyboard-force)
(kbd-map (:mode in-math?)
(“p i” (insert '("")))
(“p i var” (insert '(concat “” (rsup “2”))))
(“p i var var” (insert '(“2**”)))))
What puzzles me is the fact that some keys work and some don’t. For instance: inline math works, so does superscript and subscript and vector but for the second part only pi-squared works and i cannot figure out why the others don’t work. Furthermore i have spend a lot of time trying to change the key for Displayed Formula from ALT+$ to CTRL+A but i can’t find the code to do that in the sources. Hoping on your patience, i’m trying to get a grip on this.
In the second group I did not understand why some commands you define are empty strings.
I tried
(kbd-map (:mode in-math?)
("p i" (insert "<pi>"))
("p i var" (insert '(concat "pi" (rsup "2"))))
("p i var var" (insert "2*<pi>")))
Does it do what you want?
An idea to get the Scheme representation of a typeset expression is to copy it to TeXmacs Scheme (see menu). Doing that, I found out that the representation of the Greek letter pi is <pi>.
The code for display equations is also in the document source representation: I would expect (make 'equation*)) to work, since unnumbered display equations are withing an equation* label, and it does. Please play attention that by associating C-a to that you might be disabling the default behaviour: C-a is for “select all” at least in the Windows look and feel.
Some of the characters have not copied over correct. Based on your feedback, this is what i have and all works OK:
(delayed
(lazy-keyboard-force)
(kbd-map (“C-s” (make 'math)))
(kbd-map (“C-e” (make 'equation*)))
(kbd-map (“u u” (make-script #t #t)))
(kbd-map (“l l” (make-script #f #t)))
(kbd-map (“v v” (make-wide “”)))
(kbd-map (“p p” (insert “”)))
(kbd-map (“p i var var” (insert '(concat “” (rsup “2”)))))
(kbd-map (“p i var” (insert “2”))))
I can’t seem to put in the pi-statement, it vanishes after pressing the reply button.
With the insert statement, there is an ’ (apostrophe) what is de function of that?
Another question: say i want to use the keystroke: Ctrl + ‘arrow up’ what would be the code of that?
Pls. try and “Copy to -> Verbatim” from the Edit menu.
Here I would suggest to gain some Scheme knowledge—you don’t need to become an expert, you need just enough to be aware of the fundamental ways of the Scheme programming language. Try for example the first few chapters of https://www.shido.info/lisp/idx_scm_e.html
The apostrophe tells the Scheme interpreter not to evaluate the expression. You need it because you want the list as-is, while (concat “” (rsup “2”)), for example, would look to the Scheme interpreter as if it were the application of the concat function to the “” and (rsup “2”) arguments. But concat is not a function, it is the first element of the (concat “” (rsup “2”)) list.
C-up
I got it by running TeXmacs via the Terminal and then Tools->Debugging tool and in the Debug menu that appears I selected keyboard. Then I pressed the up arrow and looked in the terminal for its code.
Finally
pls. try between backticks.
Great help! Especially the debug tool for finding out keystrokes. I shurely will read the Scheme manual. I’m progressing with my keyboard assigning and i already made some macros. I also made my custom style file. But i stumble on another issue: in my style file i can use a macro and that works well but now only my style is active. When i switch styles (say, to: generic) i loose my macro execution and only the placeholder: <inti> appears.
I there a way to switch between styles without this effect?
You need to put the macros you want to have across styles in a package, in my understanding of things. I understand it in this way: styles are mutually exclusive, packages aren’t.
You can either load the package by hand, or you can load it automatically—see manual, example 12.1, with one necessary change: the function the manual uses, buffer-newly-created?, does not exist in the current version of TeXmacs. Because of this, @jeroen wrote (not (buffer-has-name? (current-buffer)) in a code that acts only on new buffers, see
http://forum.texmacs.cn/t/how-add-something-authomatically-in-preamble/360/4
Here is the example of the manual, which assumes that you have the package CustomStyle in your packages folder, with the modified condition:
(when (not (buffer-has-name? (current-buffer)))
(set-style-list (append (get-style-list) '("CustomStyle")))
(buffer-pretend-saved (current-buffer)))