comer
2021-1-17 19:31:34

Hi Racket friends:


comer
2021-1-17 19:41:03

Could you inform me about how to add a new LaTeX macro name for DrRacket editor. For example with \triangle (followed by alt-) we can write a triangle symbol in our editor. I would like to be able to write \inv? (for example) and write the symbol ¿ .

Thank you in advance for any pointers or ideas concerning how to accomplish this. Please Keep Safe.


laurent.orseau
2021-1-17 19:45:06

The problem is that these constants are hardcoded, so adding a name for this macro can only be done via a pull request. However, fortunately you can easily use a quickscript for this. There’s already one that demonstrates how to do this: https://github.com/Metaxal/quickscript-extra/blob/master/scripts/complete-word.rkt


soegaard2
2021-1-17 19:45:32

Here is a commit, that adds a new TeX command to DrRacket: https://github.com/racket/gui/commit/8f804e752d16c458faac7f049ecfd2f790ab86ec


laurent.orseau
2021-1-17 19:47:34

To tune this to your needs, hit Scripts\|Manage scripts\|New script..., name it “latex-macro” for example, then paste the code linked above. Change the words to your needs, and the #:shortcut and #:shortcut-prefix also if you want to. Save it. You now have a new entry in the Scripts menu, and also an associated keybinding


laurent.orseau
2021-1-17 19:49:22

Note that the completion have both a before and an after parts, so in your case you only need the before ("\inv?" "¿" "")


laurent.orseau
2021-1-17 19:49:46

@comer :point_up:


comer
2021-1-17 20:11:51

Thank you @laurent.orseau and @soegaard2 for sharing ideas and solutions concerning my problem. I hope to experiment with them. Thank you again.


comer
2021-1-17 21:35:24

Thanks again. For the moment I use the following lines: #lang s-exp framework/keybinding-lang (keybinding "c:?" (λ (editor evt) (send editor insert "¿"))) (keybinding "c:!" (λ (editor evt) (send editor insert "¡"))) and they worked fine under DrRacket editor, after adding them with the preferences menu. It would be nice to have these keybindings by default (for example) in the new Racket 8.0 (that is: if they don’t affect negatively previous bindings). Please Keep Safe.


notjack
2021-1-17 23:42:06

Is this behavior intended? It looks like a bug to me. (define flip-scope (make-syntax-introducer)) (define stx #'(+ 1 2 3)) (equal? stx (flip-scope (flip-scope stx))) ;; produces #f


mflatt
2021-1-18 00:05:43

Syntax-object equal? is just eq?, so not especially useful.


notjack
2021-1-18 00:14:28

can it be equal? I have this syntax-original-components function that takes a syntax object and returns a set of all of the pieces of it that are syntax-original?, and I’d like to test it by checking that the set it returns is equal? to the set of syntax objects I expect it to find.


notjack
2021-1-18 00:15:30

I could just check the result of syntax->datum on the outputs, but I’d like to make sure I’m not throwing away source location information or other useful metadata.


mflatt
2021-1-18 00:20:28

I think we probably shouldn’t drastically change the cost of equal? on syntax objects at this point (i.e., a full comparison might involve checking a lot of structure), even if it’s not all that useful as-is.


notjack
2021-1-18 00:22:54

that unfortunately makes sense


samth
2021-1-18 01:26:35

There’s so some laziness involved in syntax objects, right? Which would need to be forced for a general equality function.


shu--hung
2021-1-18 01:46:23

It could still make sense to have a syntax=? function in racket/syntax, much like other kinds of data. Different kinds of equality on syntax objects can also be configured using some keyword argument or so.


samth
2021-1-18 01:49:34

I agree, although it would have to be implemented in the core


shu--hung
2021-1-18 01:50:12

unsafe-syntax-scope-set=?


samth
2021-1-18 01:50:59

Probably doesn’t need to be unsafe


ebirman77
2021-1-18 03:39:50

So I’ve adapted a Dockerfile and a docker-compose.yaml from your examples. They are at https://github.com/stormwatch/koyo-shorty/tree/ci I plead to anyone with some spare minutes to look and try them. Do you see any mistake or opportunities for improvement? Thanks in advance