cdominik / cdlatex

Fast input methods to enter LaTeX environments and math with GNU Emacs
230 stars 47 forks source link

Feature-request: Brackets in math-modify and electric-pairs #47

Closed Sinthoras7 closed 2 years ago

Sinthoras7 commented 2 years ago

It is often the case, that one writes a mathematical expression and then later needs to put the whole expression in some kind of bracket. (e.g. a normal "\left(" "\right)" pair, or an absolute value "|"). For commands like "\underbrace{}" or "\overline{}" this is implemented in cdlatex via the math-modify command '. It would come in handy, if one could do the same for the brackets: Mark text, and type '( or '[ or '{ or '| r '< in order to insert the corresponding brackets. If there is some other way to quickly insert Latex-Brackets around marked text, that I am unaware of, I retract this feature-request and would appreciate it, being told this way.

Edit: The variable cdlatex-paired-parens makes sure, that the brackets in the string get automatically inserted as pairs: When one types ( the corresponding ) get's inserted. It would be good, if - as in the "electric-pair-mode" of plain Emacs - also, when marking text, the corresponding brackets get inserted around that text, such that, when marking "text" and pressing "[" then "[text]" would be the result.

cdominik commented 2 years ago

Hi,

this is an interesting idea, I like it.

One problem is though, that `{' is already doing overbrace.

' ( and ' [ are still free and I could implement it, but do you have a suggestion what to use for the braces?

Carsten

On Thu, Aug 18, 2022 at 11:30 AM Sinthoras @.***> wrote:

It is often the case, that one writes a mathematical expression and then later needs to put the whole expression in some kind of bracket. (e.g. a normal "\left(" "\right)" pair, or an absolute value "|"). For commands like "\underbrace{}" or "\overline{}" this is implemented in cdlatex via the math-modify command '. It would come in handy, if one could do the same for the brackets: Mark text, and type '( or '[ or '{ or '| r '< in order to insert the corresponding brackets. If there is some other way to quickly insert Latex-Brackets around marked text, that I am unaware of, I retract this feature-request and would appreciate it, being told this way.

— Reply to this email directly, view it on GitHub https://github.com/cdominik/cdlatex/issues/47, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAIABMHDE7I3RGEBTHCMU3VZX7E5ANCNFSM564PM5CA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

cdominik commented 2 years ago

Let me first ask this: You do know that you can write

( <TAB>

to get \left( .. \right) vir abbreviations?

Sinthoras7 commented 2 years ago

Do you mean lr( <TAB>? In this case yes.

cdominik commented 2 years ago

Indeed, this is what I mean, my mistake.

OK, so you are saying it happens too often that you decide later that you need the brackets....

Carsten

On Thu, Aug 18, 2022 at 2:36 PM Sinthoras @.***> wrote:

Do you mean lr( ? In this case yes.

— Reply to this email directly, view it on GitHub https://github.com/cdominik/cdlatex/issues/47#issuecomment-1219440492, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAIABNC23OVEMSWNMFIWXLVZYU6NANCNFSM564PM5CA . You are receiving this because you commented.Message ID: @.***>

Sinthoras7 commented 2 years ago

Yes, mostly when writing down notes for a lecture or a talk, where the presenter adds them later.

cdominik commented 2 years ago

OK, thanks for the proposal, I have made the change.

Sinthoras7 commented 2 years ago

Thank you and thank you very much for this package!

cdominik commented 2 years ago

You are welcome.

Carsten

On Fri, Aug 19, 2022 at 10:36 AM Sinthoras @.***> wrote:

Thank you and thank you very much for this package!

— Reply to this email directly, view it on GitHub https://github.com/cdominik/cdlatex/issues/47#issuecomment-1220404431, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAIABJFEKRY4LWEQNGAFJLVZ5BPTANCNFSM564PM5CA . You are receiving this because you modified the open/close state.Message ID: @.***>