combine with siunitx #11

Open
opened 2021-05-25 14:51:06 +00:00 by fbraennstroem · 7 comments
fbraennstroem commented 2021-05-25 14:51:06 +00:00 (Migrated from github.com)

Hi,
very interesting snippets approach... is there some thinking about handling siunitx with the convenient approach as well?
It would be great if the units get converted like m gets converted to \m and e.g. kg to \kg... but only if it is located in the second part of the SI-environment $\SI{10}{\m}... maybe this already possible!?

Thank you in advance!

Fab

Hi, very interesting snippets approach... is there some thinking about handling siunitx with the convenient approach as well? It would be great if the units get converted like `m` gets converted to `\m` and e.g. `kg` to `\kg`... but only if it is located in the second part of the SI-environment `$\SI{10}{\m}`... maybe this already possible!? Thank you in advance! Fab
tecosaur commented 2021-05-25 15:12:41 +00:00 (Migrated from github.com)

Hmmm. That's would be nice. I can't say I'll work on this any time soon but feel free to propose something.

Hmmm. That's would be nice. I can't say I'll work on this any time soon but feel free to propose something.
fbraennstroem commented 2021-05-25 16:49:24 +00:00 (Migrated from github.com)

ok, thank you for your quick reply; I try to get familiar with it

ok, thank you for your quick reply; I try to get familiar with it
ymarco commented 2021-06-01 17:32:33 +00:00 (Migrated from github.com)

I was about to recommend writing a yasnippet snippet for \SI{}{} with a field transformation in the second {}. But then I thought that maybe my concept of \SI is wrong, so I went to the siunitx documentation and fount:
image

Anyway, having these \m \kg snippets expand only in \SI* macros is troublesome.
If that field transformation is too complicated to write maybe you could make another yasnippet for \SI that enables a snippet keymap only in the context of the snippet.

I was about to recommend writing a `yasnippet` snippet for `\SI{}{}` with a [field transformation](https://joaotavora.github.io/yasnippet/snippet-development.html#org4efa067) in the second `{}`. But then I thought that maybe my concept of `\SI` is wrong, so I went to the `siunitx` documentation and fount: ![image](https://user-images.githubusercontent.com/40410676/120366138-f6f75300-c317-11eb-8f40-d929475a712c.png) Anyway, having these `\m` `\kg` snippets expand only in `\SI`* macros is troublesome. If that field transformation is too complicated to write maybe you could make another yasnippet for `\SI` that [enables](https://github.com/ymarco/auto-activating-snippets/blob/3076cefea0f6ae9d7757f13c27b5602e007b58ec/aas.el#L200) a snippet keymap only in the context of the snippet.
fab6 commented 2022-01-14 18:30:53 +00:00 (Migrated from github.com)

Hi,
could there be the option to use e.g. ,, after the unit as it is a quicker way to write a backslash.

your code from yesterday includes a wrapping

(aas-set-snippets 'laas-mode
  :cond #'laas-object-on-left-condition
  ". " (lambda () (interactive)
         (laas-wrap-previous-object "dot")
         ;; if you want a space after the \dot{}, I think it's an improvement
         ;; and I changed ".. " to this behavior in the latest commit
         ;;(insert " ")
         ))

maybe a similar way exists to just a "" before the previous object?

Thank you in advance!
Fab

Hi, could there be the option to use e.g. `,, ` after the unit as it is a quicker way to write a backslash. your code from yesterday includes a wrapping ``` (aas-set-snippets 'laas-mode :cond #'laas-object-on-left-condition ". " (lambda () (interactive) (laas-wrap-previous-object "dot") ;; if you want a space after the \dot{}, I think it's an improvement ;; and I changed ".. " to this behavior in the latest commit ;;(insert " ") )) ``` maybe a similar way exists to just a "\" before the previous object? Thank you in advance! Fab
ymarco commented 2022-01-14 18:47:42 +00:00 (Migrated from github.com)

maybe a similar way exists to just [add?] a "" before [after?] the previous object?

You can give laas-wrap-previous-object a cons, it's in the function documentation.

could there be the option to use e.g. ",, " after the unit as it is a quicker way to write a backslash.

Not sure how this is quicker.

> maybe a similar way exists to just [add?] a "" before [after?] the previous object? You can give laas-wrap-previous-object a cons, it's in the function documentation. > could there be the option to use e.g. ",, " after the unit as it is a quicker way to write a backslash. Not sure how this is quicker.
fab6 commented 2022-01-14 18:51:01 +00:00 (Migrated from github.com)

Thank you for your quick response!
For my current arm/hand position typing the backslash is a bit outside so I need to twist a bit the fingers... this results (it seems) in a slowdown for me typing siunitx equations.

Thank you for your quick response! For my current arm/hand position typing the backslash is a bit outside so I need to twist a bit the fingers... this results (it seems) in a slowdown for me typing siunitx equations.
fab6 commented 2022-01-14 19:07:14 +00:00 (Migrated from github.com)

ok, not sure yet if this is really better ;-)

      ",, " (lambda () (interactive)
             (laas-wrap-previous-object (cons "\\" " "))
             )
ok, not sure yet if this is really better ;-) ``` ",, " (lambda () (interactive) (laas-wrap-previous-object (cons "\\" " ")) ) ```
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: tec/LaTeX-auto-activating-snippets#11
No description provided.