How can I see list of labels?

Version of TexMacs is 1.99.18. The codo above by @pireddag is working well.

Sorry, but I have the same problem - when I click C-l C-l I see pop-up window completely black, without any info.

A good step to understand why is finding out the answer to @jeroen’s question: can you use the preview-ref package?
preview-ref is based on balloons so if you can, we should be able to get this code to work too and we can step through the code in your initialization file.

When I wrote one of my first attempts, a few days ago, I also got a black window (for the widget), but I did not save a copy of the code; I have a recollection that I was trying to get the widget to appear conditionally, and had not yet understood that one must use :require

I really do not understand - what is preview-ref package and how can I launch it?

preview-ref is a pretty neat package that implements a pop-up with a preview of what you are referencing to while defining a reference.

You can add it by clicking the plus sign next to the document style selectors (the ones showing e.g. “Article” and “Plain”). You can alternatively reach this by clicking Document → Style → Add package. The preview-ref package is in the “Utilities” category of that menu.

Once added, define a label, for example for an equation. If you then write a reference to that label, a small pop-up showing the equation should pop up. It also shows if the reference is activated and you hover the mouse pointer over it.

1 Like

Thank you. Yes, it works. Small pop-up with equation appeared. I did not know about this possibility. It’s very useful.

Ok, then if it works can you do one of the following two things?

Either

  • Post here your entire initialization file
    Or
  • Put in your initialization file the code I posted last (message 39) only, commenting out all of the rest

The code will work only if preview-ref is not activated (the balloon of preview-ref will replace the one with the list of references), so if you want to figure out why it doesn’t work, you should deactivate it.

As you prefer.

I would say that Scheme is not very specific at all, actually you can think about it as a kind of very low level language, where everything has more or less the same “form”, that of a list. It can take any form you like, like water. In comparison Basic is a kind of very rigid structure. Python in some circles is called “a Lisp” and has some flexibility but you cannot redefine the meaning of the basic operations. Joris in the TeXmacs manual explains well why Scheme was chosen, the idea is that you can fit the language to your needs, in particular in TeXmacs we can define new parts of the language to better describe the menus and the widgets. You can give a look at Help->Scheme extensions->Overview of the extension language which explains the rationale for this choice.

I put in the file my-init-texmacs.scm the your code, only. Preview-ref is deactivated, but I have black window

Why you and/or Giovanni don’t write an article for the blog with some details on how you implemented this new functionality. It would be very interesting to read it.

Is that the result of C-l C-l or the result of result of right-clicking and selection of “Show labels”?

I am available (in a few days). I think that @jeroen has some insights on how to look for relevant functions inside TeXmacs code which I do not have, so he can write that part better than I can.

I can write paper about gravity or graphene but in Scheme I’m stupid lamer. But the texmacs is interested for me and I started to learn a little bit the scheme. Now I started to write a scientific paper by using texmacs in order to see what kind of problems are appeared for scientist who wrote many papers just in Latex. The journal will accept the Latex code only. For this reason I verify the convert to Latex, too. After I’d like to make summary in this forum.

C-l C-l . Show labels is working well.

I see that there are many different utilities but where is description or “how to” for that utilities?

It is puzzling, as the scrollbars indicate a widget, while you should get a balloon.
Here is what I see in my computer (running Linux)

image

I have also tested putting many equations (with the idea that perhaps when the balloon is too high, scrollbars will appear) but there are no scrollbars in that case too. Does anyone have an idea?

I will think up a simpler code, to test further.

Please put this only in your initialization file

(tm-define (test-balloon)
  (display-balloon (cursor-tree) "Hello there!" "auto" "auto" "keyboard"))

(kbd-map
  ("C-1" (test-balloon)))

Then completely close and restart TeXmacs. Open any document. What happens if you press Ctrl-1 ?

The black pop-up appears. For \label command nothing happen. For \ref the black pop-up window.

In this case probably only the developers can solve this problem.
But I have a further question: the behaviour after ctrl-1 should be always the same, there is no condition on this key combination, while you observe a different behaviour, depending on where is the cursor. There must be a difference between my initialization file and yours. Can you notice anything?

Could you try if a balloon added via “Insert -> Note -> Balloon” works? You should get a tag with two empty fields. You can add some random text in both and activate it. The first entry will be shown in the text, the second entry in a balloon that appears if you hover the mouse over this element.

This could have to do with the different magnification factors used in the preview-reference (ref-edit.scm) function and the display-balloon function (generic-edit.scm).

If the balloon note doesn’t work, could you please try adding the following to your my-init-texmacs.scm?

;; Redefine display-balloon with a different magnification
(tm-define (display-balloon body balloon halign valign type)
  (:secure #t)
  (let* ((kind (or (tm->string type) "default"))
       (ha (or (tm->string halign) (if (== kind "mouse") "right" "left")))
       (va (or (tm->string valign) "Bottom")))
    (show-tooltip (or (tree->path body) (tree->stree body))
              body balloon ha va kind 0.6)))