Re: [AUCTeX] Entering maths

2017-06-14 Thread David Kastrup
Denis Bitouzé  writes:

> Le 14/06/17 à 08h54, David Kastrup a écrit :
>
>> Frankly, I never use anything but a U.S. keyboard layout (with
>> whatever actual keyboard layout may be printed on the keys themselves)
>> with some mode shift or whatever else provides compose-key similar
>> functionality.
>
> Wow! I wouldn't be able to type on an AZERTY keyboard with QWERTY
> layout...

I actually right now have a keyboard with Æ Ø Å in the place of ;'[ and
where a German keyboard would have Ä Ö Ü (don't ask me in which order).

The guy selling it put a pad of German keytop stickers in the package
but I did not quite see the point in gluing German keytop stickers on a
keyboard I was going to use with U.S. layout.

I think what makes the bulk of getting used to when switching around and
not typing entirely blind is () being shifted 90 on U.S. keyboards and
shifted 89 on German (Danish?) keyboards.  That's just too close.

-- 
David Kastrup

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Entering maths

2017-06-14 Thread Denis Bitouzé
Le 14/06/17 à 08h54, David Kastrup a écrit :

> Frankly, I never use anything but a U.S. keyboard layout (with
> whatever actual keyboard layout may be printed on the keys themselves)
> with some mode shift or whatever else provides compose-key similar
> functionality.

Wow! I wouldn't be able to type on an AZERTY keyboard with QWERTY
layout...
-- 
Denis


___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Entering maths

2017-06-13 Thread David Kastrup
Denis Bitouzé  writes:

> Le 13/06/17 à 18h12, Jean-Jacques Rétorré a écrit :
>
>> mar. 13 juin 2017, Denis Bitouzé  disait :
>>
>> 
>>
>> (hitting the backslash key on a French keyboard is a nightmare)
>>
>> As an example
>>
>> ,
>> | (define-key key-translation-map [?µ] [?\\])
>> `
>>
>> and the very useless key "µ" is now "\"
>
> Indeed.
>
> I made a mistake since I already used such a trick for the backslash
> (with "²" instead of "µ" :) In fact, I had "[" and "]" in mind.
>
>> On a french PC keyboard, The worst is probably the "`" key.
>> It is a lot of useless key you can re-use...
>
> The problem is, "[" and "]" and "@" and "}" are nightmares as well on
> French keyboards ;)

Frankly, I never use anything but a U.S. keyboard layout (with whatever
actual keyboard layout may be printed on the keys themselves) with some
mode shift or whatever else provides compose-key similar functionality.
Yes, I write German texts with that as well.  Emacs does offer

C-\ runs the command toggle-input-method (found in global-map), which
is an interactive compiled Lisp function in ‘mule-cmds.el’.

It is bound to C-\,.

(toggle-input-method &optional ARG INTERACTIVE)
[...]

but I find that I don't use this except in emergencies (when the Compose
key got lost during some system upgrade and I cannot figure out how to
regain it within minutes).

My mother is actually an American with a history of writing lots of
letters on her U.S. mechanical typewriter, and she is using a German
keyboard layout on computers.  I don't get that but probably playing
around with keyboard layouts is beyond her comprehension.  And she does
need to write in German occasionally and probably would not get the hang
of a Compose key or other contraption not printed on the keyboard.

-- 
David Kastrup

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Entering maths

2017-06-13 Thread Denis Bitouzé
Le 13/06/17 à 19h58, goj...@gmail.com a écrit :

> On 13 June 2017 at 18:12, Jean-Jacques Rétorré  wrote:
>> ,
>> | (define-key key-translation-map [?µ] [?\\])
>> `
>>
>> and the very useless key "µ" is now "\"
>
> Indeed, and there are similar solutions for Windows if you use that
> operating system – let me know if you want more information.

I'm using Linux.

> Another possibility is Autohotkey (also Unix and Windows).
>
> These key-remapping solutions are probably the best for you, Denis, as
> I imagine the backslash also haunts you outside of Emacs.

Indeed.

I guess Autohotkey is not necessary on Linux: `xkb' lets you remap any
key on the keyboard. But, anyway, I'd like to keep most of the keys like
they are :)

Thanks!
-- 
Denis


___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Entering maths

2017-06-13 Thread Denis Bitouzé
Le 13/06/17 à 18h12, Jean-Jacques Rétorré a écrit :

> mar. 13 juin 2017, Denis Bitouzé  disait :
>
> 
>
> (hitting the backslash key on a French keyboard is a nightmare)
>
> As an example
>
> ,
> | (define-key key-translation-map [?µ] [?\\])
> `
>
> and the very useless key "µ" is now "\"

Indeed.

I made a mistake since I already used such a trick for the backslash
(with "²" instead of "µ" :) In fact, I had "[" and "]" in mind.

> On a french PC keyboard, The worst is probably the "`" key.
> It is a lot of useless key you can re-use...

The problem is, "[" and "]" and "@" and "}" are nightmares as well on
French keyboards ;)
-- 
Denis


___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Entering maths

2017-06-13 Thread gojjoe
On 13 June 2017 at 18:12, Jean-Jacques Rétorré  wrote:
> ,
> | (define-key key-translation-map [?µ] [?\\])
> `
>
> and the very useless key "µ" is now "\"

Indeed, and there are similar solutions for Windows if you use that
operating system – let me know if you want more information.

Another possibility is Autohotkey (also Unix and Windows).

These key-remapping solutions are probably the best for you, Denis, as
I imagine the backslash also haunts you outside of Emacs.

Sorry for going off-Auctex topic now.

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Entering maths

2017-06-13 Thread Jean-Jacques Rétorré
mar. 13 juin 2017, Denis Bitouzé  disait :



(hitting the backslash key on a French keyboard is a nightmare)

As an example

,
| (define-key key-translation-map [?µ] [?\\])
`

and the very useless key "µ" is now "\"

On a french PC keyboard, The worst is probably the "`" key.
It is a lot of useless key you can re-use...

--
JJR.

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Entering maths

2017-06-13 Thread Denis Bitouzé
Le 13/06/17 à 15h19, goj...@gmail.com a écrit :

> Hi Denis,

Hi,

> take a look at the smartparens package (available on Elpa):
>
> https://github.com/Fuco1/smartparens/wiki
>
> I use it to get self-inserting parentheses and dollar signs instead of
> Auctex's electric capabilities, and it works fine for the most part.
> Maybe it'll give you more customization possibilities.

Nice indeed.

But too bad pressing repeatedly $ while the region is active, it doesn't
toggle between ‘$|$‘ and ‘\[|\]‘ (hitting the backslash key on a French
keyboard is a nightmare): I'll probably open an issue on this subject on
the github repository of `smartparens'.
-- 
Denis


___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Entering maths

2017-06-13 Thread gojjoe
Hi Denis, take a look at the smartparens package (available on Elpa):

https://github.com/Fuco1/smartparens/wiki

I use it to get self-inserting parentheses and dollar signs instead of
Auctex's electric capabilities, and it works fine for the most part.
Maybe it'll give you more customization possibilities.

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Entering maths

2017-06-13 Thread Denis Bitouzé
Le 13/06/17 à 14h52, Mosè Giordano a écrit :

> 2017-06-13 14:21 GMT+02:00 Denis Bitouzé :
>> IMHO, too bad TeX-electric-math is nil by default...
>
> I'd expect some people complaining about any value we'd choose as
> default ;-)

Except that this is the only one which is complainable :) 

>> But how to get:
>>
>> - ‘$|$’   with an "unrepeated" `$',
>> - ‘\[|\]’ with an "repeated"   `$'?
>
> The associations "$...$" → "$$...$$" and "\(...\)" → "\[...\]" are
> hard-coded in `TeX-insert-dollar', there is currently no easy way to
> overturn them.

Very bad news, indeed...
-- 
Denis


___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Entering maths

2017-06-13 Thread Mosè Giordano
2017-06-13 14:21 GMT+02:00 Denis Bitouzé :
> IMHO, too bad TeX-electric-math is nil by default...

I'd expect some people complaining about any value we'd choose as default ;-)

> But how to get:
>
> - ‘$|$’   with an "unrepeated" `$',
> - ‘\[|\]’ with an "repeated"   `$'?

The associations "$...$" → "$$...$$" and "\(...\)" → "\[...\]" are
hard-coded in `TeX-insert-dollar', there is currently no easy way to
overturn them.

Bye,
Mosè

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Entering maths

2017-06-13 Thread Denis Bitouzé
Le 13/06/17 à 13h09, Mosè Giordano a écrit :

> Hi Denis,

Hi Mosé,

> 2017-06-13 12:51 GMT+02:00 Denis Bitouzé :
>> Hi,
>>
>> does AUCTeX provide something making life easier for inline-math
>> expressions (`|' standing for the cursor position):
>>
>> - `\(|\)',
>> - `$|$' (OK, it's easy to type two dollar signs and go back to write the
>>   expression between the dollar signs, but would be better if done by
>>   a shortcut)?
>
> Yes, of course ;-)  You have to customize the `TeX-electric-math'
> option 
> (https://www.gnu.org/software/auctex/manual/auctex.html#index-TeX_002delectric_002dmath):
>
> [...]

Ooops, sorry for the noise: I looked at the AUCTeX documentation, but
not at the right place:
  ┌
  │ https://www.gnu.org/software/auctex/manual/auctex/Mathematics.html
  └

IMHO, too bad TeX-electric-math is nil by default...

As an extra question, documentation says:

  By pressing repeatedly $ while the region is active you can toggle
  between an inline equation, a display equation, and no equation. To be
  precise, ‘$...$’ is replaced by ‘$$...$$’, whereas ‘\(...\)’ is
  replaced by ‘\[...\]’. 

But how to get:

- ‘$|$’   with an "unrepeated" `$',
- ‘\[|\]’ with an "repeated"   `$'?

>> In the same vein, I know constructing display-math expressions with
>> `\[...\]':
>>
>> - has some drawbacks if `amsmath' is not loaded,
>
> I believe this is fixed if you have a recent LaTeX version (2015/01/01
> or newer, which is in TeX Live 2016).

Ah, good to know!

>> - is synonym to `\begin{equation*}...\end{equation*}' if `amsmath' is
>>   loaded,
>>
>> but does AUCTeX provide something for `\[|\]'?
>
> If you set `LaTeX-electric-left-right-brace'
> (https://www.gnu.org/software/auctex/manual/auctex.html#index-LaTeX_002delectric_002dleft_002dright_002dbrace)
> to non nil, as you as you type "\[", the closing "\]" is inserted
> after point.

OK.

Thanks!
-- 
Denis


___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] Entering maths

2017-06-13 Thread Mosè Giordano
Hi Denis,

2017-06-13 12:51 GMT+02:00 Denis Bitouzé :
> Hi,
>
> does AUCTeX provide something making life easier for inline-math
> expressions (`|' standing for the cursor position):
>
> - `\(|\)',
> - `$|$' (OK, it's easy to type two dollar signs and go back to write the
>   expression between the dollar signs, but would be better if done by
>   a shortcut)?

Yes, of course ;-)  You have to customize the `TeX-electric-math'
option 
(https://www.gnu.org/software/auctex/manual/auctex.html#index-TeX_002delectric_002dmath):


 -- User Option: TeX-electric-math
 If the variable is non-nil and you type '$' outside math mode,
 AUCTeX will automatically insert the opening and closing symbols
 for an inline equation and put the point between them.  The opening
 symbol will blink when 'blink-matching-paren' is non-nil.  If
 'TeX-electric-math' is nil, typing '$' simply inserts '$' at point,
 this is the default.

 Besides 'nil', possible values for this variable are '(cons "$"
 "$")' for TeX inline equations '$...$', and '(cons "\\(" "\\)")'
 for LaTeX inline equations '\(...\)'.

 If the variable is non-nil and point is inside math mode right
 between a couple of single dollars, pressing '$' will insert
 another pair of dollar signs and leave the point between them.
 Thus, if 'TeX-electric-math' is set to '(cons "$" "$")' you can
 easily obtain a TeX display equation '$$...$$' by pressing '$'
 twice in a row.  (Note that you should not use double dollar signs
 in LaTeX because this practice can lead to wrong spacing in typeset
 documents.)

 In addition, when the variable is non-nil and there is an active
 region outside math mode, typing '$' will put around the active
 region symbols for opening and closing inline equation and keep the
 region active, leaving point after the closing symbol.  By pressing
 repeatedly '$' while the region is active you can toggle between an
 inline equation, a display equation, and no equation.  To be
 precise, '$...$' is replaced by '$$...$$', whereas '\(...\)' is
 replaced by '\[...\]'.

   If you want to automatically insert '$...$' in plain TeX files, and
'\(...\)' in LaTeX files by pressing '$', add the following to your init
file
 (add-hook 'plain-TeX-mode-hook
   (lambda () (set (make-variable-buffer-local 'TeX-electric-math)
   (cons "$" "$"
 (add-hook 'LaTeX-mode-hook
   (lambda () (set (make-variable-buffer-local 'TeX-electric-math)
   (cons "\\(" "\\)"


> In the same vein, I know constructing display-math expressions with
> `\[...\]':
>
> - has some drawbacks if `amsmath' is not loaded,

I believe this is fixed if you have a recent LaTeX version (2015/01/01
or newer, which is in TeX Live 2016).

> - is synonym to `\begin{equation*}...\end{equation*}' if `amsmath' is
>   loaded,
>
> but does AUCTeX provide something for `\[|\]'?

If you set `LaTeX-electric-left-right-brace'
(https://www.gnu.org/software/auctex/manual/auctex.html#index-LaTeX_002delectric_002dleft_002dright_002dbrace)
to non nil, as you as you type "\[", the closing "\]" is inserted
after point.

Bye,
Mosè

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


[AUCTeX] Entering maths

2017-06-13 Thread Denis Bitouzé
Hi,

does AUCTeX provide something making life easier for inline-math
expressions (`|' standing for the cursor position):

- `\(|\)',
- `$|$' (OK, it's easy to type two dollar signs and go back to write the
  expression between the dollar signs, but would be better if done by
  a shortcut)?

In the same vein, I know constructing display-math expressions with
`\[...\]':

- has some drawbacks if `amsmath' is not loaded,
- is synonym to `\begin{equation*}...\end{equation*}' if `amsmath' is
  loaded,

but does AUCTeX provide something for `\[|\]'?

All the best.
-- 
Denis


___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex